...
|
...
|
@@ -146,3 +146,55 @@ func (d *RewardSumaryDao) SeachRewardAccident(companyId int, orgId int, recordDa |
|
|
_, err := tx.Query(&result, sqlStr, companyId, orgId, recordDate)
|
|
|
return result, err
|
|
|
}
|
|
|
|
|
|
// 功过看板-异常
|
|
|
type RewardSummaryMonth struct {
|
|
|
SectionId string `json:"sectionId"` //工段名称
|
|
|
SectionName string `json:"sectionName"` //工段名称
|
|
|
WorkerName string `json:"workerName"` //员工名称
|
|
|
WorkerId string `json:"workerId"` //员工名称
|
|
|
AccidentAmount1 string `json:"accidentAmount1"` //质量事故损失金额
|
|
|
AccidentNum1 string `json:"accidentNum1"` //质量事故次数
|
|
|
AccidentNum3 string `json:"accidentNum3"` //金属异物事故 次数
|
|
|
AccidentNum4 string `json:"accidentNum4"` //非属异物事故 次数
|
|
|
AccidentAmount2 string `json:"accidentAmount2"` //安全事故 损失金额
|
|
|
AccidentNum2 string `json:"accidentNum2"` //安全事故 次数
|
|
|
YieldAvg string `json:"yieldAvg"` //平均产效
|
|
|
YieldMax string `json:"yieldMax"` //产效历史最佳
|
|
|
AmountFine string `json:"amountFine"` //惩,的金额
|
|
|
AmountReward string `json:"amountReward"` //奖,的金额
|
|
|
AmountFinal string `json:"amountFinal"` //最终的 奖惩结果
|
|
|
}
|
|
|
|
|
|
// 功过看板-月榜
|
|
|
func (d *RewardSumaryDao) SeachRewardSummaryMonth(companyId int, orgId int, recordMonth string) ([]RewardSummaryMonth, error) {
|
|
|
sqlStr := `SELECT
|
|
|
work_station->>'sectionId' AS section_id,
|
|
|
work_station->>'sectionName' as section_name,
|
|
|
worker->>'userId' as worker_id,
|
|
|
worker->>'userName' as worker_name,
|
|
|
count(accident_num1) as accident_num1,
|
|
|
count(accident_num2) as accident_num2,
|
|
|
count(accident_num3) as accident_num3,
|
|
|
count(accident_num4) as accident_num4,
|
|
|
count(accident_amount1) as accident_amount1,
|
|
|
count(accident_amount2) as accident_amount2,
|
|
|
'12' as yield_avg,
|
|
|
'13' as yield_max,
|
|
|
'-39' as amount_fine,
|
|
|
'25' as amount_reward,
|
|
|
'-14' as amount_final
|
|
|
FROM manufacture.reward_summary
|
|
|
WHERE company_id=?
|
|
|
and org_id=?
|
|
|
and record_month_str=?
|
|
|
GROUP BY
|
|
|
worker->>'userId' ,
|
|
|
worker->>'userName' ,
|
|
|
work_station->>'sectionId',
|
|
|
work_station->>'sectionName' `
|
|
|
tx := d.transactionContext.PgTx
|
|
|
var result []RewardSummaryMonth
|
|
|
_, err := tx.Query(&result, sqlStr, companyId, orgId, recordMonth)
|
|
|
return result, err
|
|
|
} |
...
|
...
|
|