|
|
|
@ -2,6 +2,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.schedulejob;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesConfigService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionRecordService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesWorkOrderService;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.JsonUtilTool;
|
|
|
|
@ -52,6 +53,9 @@ public class MesReportWorkByPreDayJob extends BaseMesScheduleJob {
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesConfigService configService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesProductionRecordService productionRecordService;
|
|
|
|
|
|
|
|
|
|
public MesReportWorkByPreDayJob() {
|
|
|
|
|
super(MesReportWorkByPreDayJob.class, "根据前一天待报工记录数插入工单并报工JOB");
|
|
|
|
|
}
|
|
|
|
@ -85,26 +89,32 @@ public class MesReportWorkByPreDayJob extends BaseMesScheduleJob {
|
|
|
|
|
//4.根据产线+物料产生的工单报工
|
|
|
|
|
try {
|
|
|
|
|
for (MesWorkOrder mesWorkOrder : mesWorkOrders) {
|
|
|
|
|
List<MesProductionRecord> mesProductionRecords = mesProductionRecordList.stream().filter(
|
|
|
|
|
w -> w.getWorkCenterCode().equalsIgnoreCase(mesWorkOrder.getWorkCenterCode())
|
|
|
|
|
&& w.getPartNo().equalsIgnoreCase(mesWorkOrder.getPartNo())).collect(Collectors.toList());
|
|
|
|
|
workOrderService.doPcnJobProductReport(mesProductionRecords, mesShiftList, wmsJobParamModel.getOrganizeCode(), userName, mesWorkOrder);
|
|
|
|
|
List<MesProductionRecord> mesProductionRecords = mesProductionRecordList.stream().filter(
|
|
|
|
|
w -> w.getWorkCenterCode().equalsIgnoreCase(mesWorkOrder.getWorkCenterCode())
|
|
|
|
|
&& w.getPartNo().equalsIgnoreCase(mesWorkOrder.getPartNo())).collect(Collectors.toList());
|
|
|
|
|
workOrderService.doPcnJobProductReport(mesProductionRecords, mesShiftList, wmsJobParamModel.getOrganizeCode(), userName, mesWorkOrder);
|
|
|
|
|
|
|
|
|
|
for (MesProductionRecord mesProductionRecord : mesProductionRecords) {
|
|
|
|
|
if(StringUtil.isEmpty(mesProductionRecord.getWorkOrderNo())){
|
|
|
|
|
List<MesWorkOrder> collect = mesWorkOrders.stream().filter(w -> w.getWorkCenterCode().equalsIgnoreCase(mesProductionRecord.getWorkCenterCode())
|
|
|
|
|
&& w.getPartNo().equalsIgnoreCase(mesProductionRecord.getPartNo())).collect(Collectors.toList());
|
|
|
|
|
if (!CollectionUtils.isEmpty(collect)){
|
|
|
|
|
mesProductionRecord.setWorkOrderNo(collect.get(0).getWorkOrderNo());
|
|
|
|
|
for (MesProductionRecord mesProductionRecord : mesProductionRecords) {
|
|
|
|
|
try {
|
|
|
|
|
if (StringUtil.isEmpty(mesProductionRecord.getWorkOrderNo())) {
|
|
|
|
|
List<MesWorkOrder> collect = mesWorkOrders.stream().filter(w -> w.getWorkCenterCode().equalsIgnoreCase(mesProductionRecord.getWorkCenterCode())
|
|
|
|
|
&& w.getPartNo().equalsIgnoreCase(mesProductionRecord.getPartNo())).collect(Collectors.toList());
|
|
|
|
|
if (!CollectionUtils.isEmpty(collect)) {
|
|
|
|
|
mesProductionRecord.setWorkOrderNo(collect.get(0).getWorkOrderNo());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
mesProductionRecord.setReportStatus(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_20.getValue());
|
|
|
|
|
mesProductionRecord.setSystemSyncStatus(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
|
|
|
|
ConvertBean.serviceModelUpdate(mesProductionRecord, userName);
|
|
|
|
|
} catch (ImppBusiException e) {
|
|
|
|
|
String errorMsg = StringUtil.isEmpty(e.getErrorDetail()) ? e.getErrorMsg(): e.getErrorDetail();
|
|
|
|
|
LOGGER.error("条码:{}报工失败,{}", mesProductionRecord.getProductSn(), errorMsg);
|
|
|
|
|
productionRecordService.updateProductionRecord(mesProductionRecord.getOrganizeCode(), userName, mesProductionRecord.getId(), errorMsg);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
mesProductionRecord.setReportStatus(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_20.getValue());
|
|
|
|
|
mesProductionRecord.setSystemSyncStatus(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
|
|
|
|
ConvertBean.serviceModelUpdate(mesProductionRecord, userName);
|
|
|
|
|
}
|
|
|
|
|
productionRecordRao.saveAll(mesProductionRecords);
|
|
|
|
|
productionRecordRao.saveAll(mesProductionRecords);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (ImppBusiException e) {
|
|
|
|
|
LOGGER.error("产线:{}报工失败:{}", workCenterCode, e.getErrorDetail());
|
|
|
|
|
}
|
|
|
|
|