...
|
...
|
@@ -92,19 +92,20 @@ func (ptr *PGWorkshopDataConsumeService) Consume(companyId, orgId int, record *d |
|
|
if _, err = deviceRunningRecordRepository.Save(deviceRunningRecord); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
// 2.保存设备生产记录 (统计车间、员工产能) 批次跟数量不为空
|
|
|
if record.DeviceType == domain.DeviceTypeChuanChuanJi && plan != nil && deviceRunningData.Count > 0 {
|
|
|
|
|
|
productRecord, _ := ptr.newProductRecord(companyId, orgId, workStation, device, deviceRunningData, plan)
|
|
|
//SendProductRecordStaticsJob(productRecord)
|
|
|
// 2.更新 设备每日运行记录(汇总) - redis更新 十分钟异步刷库
|
|
|
if addSuccess := deviceDailyRecord.AddDeviceRunningData(deviceRunningData.CollectionTime, deviceRunningData); addSuccess {
|
|
|
// 3.保存设备生产记录 (统计车间、员工产能) 批次跟数量不为空
|
|
|
if record.DeviceType == domain.DeviceTypeChuanChuanJi && plan != nil && deviceRunningData.Count > 0 {
|
|
|
|
|
|
productRecordService, _ := NewPGProductRecordService(ptr.transactionContext)
|
|
|
productRecordService.EmployeeProductStatics(productRecord)
|
|
|
productRecordService.WorkshopProductStatics(productRecord)
|
|
|
}
|
|
|
productRecord, _ := ptr.newProductRecord(companyId, orgId, workStation, device, deviceRunningData, plan)
|
|
|
//SendProductRecordStaticsJob(productRecord)
|
|
|
|
|
|
// 3.更新 设备每日运行记录(汇总) - redis更新 十分钟异步刷库
|
|
|
deviceDailyRecord.AddDeviceRunningData(deviceRunningData.CollectionTime, deviceRunningData)
|
|
|
productRecordService, _ := NewPGProductRecordService(ptr.transactionContext)
|
|
|
productRecordService.EmployeeProductStatics(productRecord)
|
|
|
productRecordService.WorkshopProductStatics(productRecord)
|
|
|
}
|
|
|
}
|
|
|
if err = redis.SaveDeviceDailyRunningRecord(deviceDailyRecord); err != nil {
|
|
|
//log.Logger.Error(err.Error())
|
|
|
return nil, err
|
...
|
...
|
|