|
|
|
@ -54,48 +54,7 @@ public class TestController {
|
|
|
|
|
@GetMapping("/reportWorkByPreDayJob")
|
|
|
|
|
@ApiOperation(value = "查询设备交互")
|
|
|
|
|
public ResultBean queryReworkTaskByPager(String organizeCode) {
|
|
|
|
|
try {
|
|
|
|
|
//遍历系统参数指定的产线获取对应班次,找到早班的开始时间,
|
|
|
|
|
String workCenterCodes = configService.getCfgValue(organizeCode, "MES_PCN_WORK_CENTER_NO");
|
|
|
|
|
List<String> workCenterCodeList = Arrays.asList(workCenterCodes.split(","));
|
|
|
|
|
String userName = "REPORT_PRE_DAY_JOB";
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
List<MesShift> mesShiftListAll = mesShiftRepository.findByHqlWhere(packBean);
|
|
|
|
|
for (String workCenterCode : workCenterCodeList) {
|
|
|
|
|
List<MesShift> mesShiftList = mesShiftListAll.stream().filter(s -> s.getWorkCenterCode().equalsIgnoreCase(workCenterCode)).collect(Collectors.toList());
|
|
|
|
|
//1.获取生产加工记录production_record表中,report_status为待汇报状态的工单
|
|
|
|
|
List<MesProductionRecord> mesProductionRecordList = workOrderService.getPreDayReportMesProductionRecord(organizeCode, mesShiftList, workCenterCode);
|
|
|
|
|
if (CollectionUtils.isEmpty(mesProductionRecordList)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//3.插入生产工单表
|
|
|
|
|
List<MesWorkOrder> mesWorkOrders = workOrderService.insertMesWorkOrder(mesProductionRecordList, mesShiftList, organizeCode, userName);
|
|
|
|
|
if (CollectionUtils.isEmpty(mesWorkOrders)) {
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//4.根据产线+物料产生的工单报工
|
|
|
|
|
|
|
|
|
|
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, organizeCode, userName, mesWorkOrder);
|
|
|
|
|
}
|
|
|
|
|
for (MesProductionRecord mesProductionRecord : mesProductionRecordList) {
|
|
|
|
|
mesProductionRecord.setReportStatus(20);
|
|
|
|
|
ConvertBean.serviceModelUpdate(mesProductionRecord, userName);
|
|
|
|
|
}
|
|
|
|
|
productionRecordRao.saveAll(mesProductionRecordList);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return ResultBean.success("查询成功").setResultList(null);
|
|
|
|
|
} catch (ImppBusiException imppException) {
|
|
|
|
|
return ResultBean.fail(imppException);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/reportOrder")
|
|
|
|
|