|
@@ -947,6 +947,10 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
|
|
|
apsReportRecordsDo.setCheckstatus("待检验");
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(apsReportOutputDoList)) {
|
|
|
+ /**
|
|
|
+ * 需求优化:更新工序为’铸轧‘的批次号
|
|
|
+ */
|
|
|
+ updateSerialnumber(apsReportOutputDoList, recordsDo);
|
|
|
apsReportOutputService.updateBatchById(apsReportOutputDoList);
|
|
|
}
|
|
|
if (ObjectUtil.isNotEmpty(apsReportMachiningDoList)) {
|
|
@@ -1970,6 +1974,49 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 更新报工记录-输出物料子表中序列号与批次号
|
|
|
+ * @param apsReportOutputDoList
|
|
|
+ * @param recordsDo
|
|
|
+ */
|
|
|
+ private void updateSerialnumber(List<ApsReportOutputDo> apsReportOutputDoList,ApsReportRecordsDo recordsDo){
|
|
|
+ //查询对应的工序作业
|
|
|
+ ApsProcessOperationDo apsProcessOperationDo = apsProcessOperationService.getById(recordsDo.getProcessoperationid());
|
|
|
+ //查询对应的工序作业明细信息
|
|
|
+ ApsProcessOperationProcessEquDo apsProcessOperationProcessEquDo = apsProcessOperationProcessEquService.getById(recordsDo.getProcessequid());
|
|
|
+ //1.循环输出物料2.判断输出物料序列号字段是否有值是否与批次号后三位相等,不相等则更新批次号和序列号为最新的值3.将平台序列号表更新输出物料流水的最大值4.只针对铸轧
|
|
|
+ String nodeMonthCode = SaveConstans.MONTH_CODE_LIST.get(DateUtil.month(DateUtil.date()));
|
|
|
+ String nowYear = (DateUtil.year(DateUtil.date()) % 100) + "";
|
|
|
+ apsReportOutputDoList.forEach(info ->{
|
|
|
+ if (StringUtils.isNotBlank(info.getOutputnumber())){
|
|
|
+ String outputCode = info.getOutputnumber();
|
|
|
+ String nextChar = "";
|
|
|
+ int index = outputCode.indexOf(nowYear);
|
|
|
+ if (index != -1) {
|
|
|
+ nextChar = String.valueOf(outputCode.charAt(index + nowYear.length()));
|
|
|
+ //需要判断每条数据在当前月
|
|
|
+ if ("铸轧".equals(apsProcessOperationDo.getProcess())&&nodeMonthCode.equals(nextChar)){
|
|
|
+ //取出批次号最后三位字符串
|
|
|
+ String lastThreeChars = outputCode.substring(outputCode.length() - 3);
|
|
|
+ //校验序列号大小是否大于等于批次号后三位
|
|
|
+ if (info.getSerialnumber()!= null&&info.getSerialnumber()!= Long.parseLong(lastThreeChars)){
|
|
|
+ // 删除批次号原来的后三位字符串,将序列号的三位数字更新到批次号中
|
|
|
+ String newOutput = outputCode.substring(0, outputCode.length() - 3);
|
|
|
+ String formatSerialnumber = String.format("%03d", info.getSerialnumber());
|
|
|
+ info.setOutputnumber(newOutput + formatSerialnumber);
|
|
|
+ //加工设备ID
|
|
|
+ String processdeviceid = apsProcessOperationProcessEquDo.getProcessdeviceid();
|
|
|
+ //在流水表中的标识
|
|
|
+ String moduleCode = "aps_report_output_" + processdeviceid;
|
|
|
+ //更新流水表中的当前值
|
|
|
+ apsProcessOperationProcessEquDao.updateSerialNumberCurvalue(moduleCode, info.getSerialnumber());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|