作者 yangfu

refactor: 数据格式微调

... ... @@ -92,6 +92,7 @@ func (employeeProductRecord *EmployeeProductRecord) UpdateProductWeigh(weigh flo
if productRecordType == RecordTypeWeigh {
employeeProductRecord.ProductWeigh += weigh
}
employeeProductRecord.ProductWeigh = utils.Round(employeeProductRecord.ProductWeigh, 1)
employeeProductRecord.ProductRecordInfo.PreStatistics(employeeProductRecord.ProductWeigh, employeeProductRecord.SecondLevelWeigh, yesterdayWeight, bestWeight)
employeeProductRecord.UpdatedAt = time.Now()
employeeProductRecord.Version += 1
... ...
... ... @@ -74,6 +74,7 @@ func (employeeProductRecord *WorkshopProductRecord) UpdateProductWeigh(weigh flo
if productRecordType == RecordTypeWeigh {
employeeProductRecord.ProductWeigh += weigh
}
employeeProductRecord.ProductWeigh = utils.Round(employeeProductRecord.ProductWeigh, 1)
employeeProductRecord.ProductRecordInfo.PreStatistics(employeeProductRecord.ProductWeigh, employeeProductRecord.SecondLevelWeigh, 0, 0)
employeeProductRecord.UpdatedAt = time.Now()
employeeProductRecord.Version += 1
... ...
... ... @@ -53,7 +53,7 @@ func (ptr *PGWorkerAttendanceReportService) Report(cid, oid int, report *domain.
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
worker, err = userService.UserByCode(cid, oid, report.UserNo)
worker, err = userService.UserByICCode(cid, oid, report.UserNo)
if err != nil {
return nil, err
}
... ...
... ... @@ -61,6 +61,10 @@ func (ptr *PGWorkshopPlanCompletionRecordService) WorkshopPlanCompletion(begin t
if !(totalPlan == 0 || totalReal == 0) {
completionRate = utils.Round(totalReal*100.0/totalPlan, 0)
}
// 超出计划生产的,最多完成效率 100%
if totalPlan <= totalReal {
completionRate = 100
}
var record *models.WorkshopPlanCompletionRecord
if record, err = workshopProductRecordDao.FindOne(cid, oid, workshops[i].WorkshopId, begin); err == domain.ErrorNotFound && record == nil {
... ...
... ... @@ -78,6 +78,9 @@ func (controller *StatisticsController) TaskHandler() func(ctx *context.Context)
}
crontab.SyncProductPlan(bc)
break
case "7":
crontab.AutoTodayWorkshopPlanCompletionRecord(nil)
break
}
Response(ctx, nil, nil)
}
... ...