|
|
|
@ -83,7 +83,7 @@ public class MesProductSnPrintSortStepService extends BaseStepService {
|
|
|
|
|
/**
|
|
|
|
|
* 重构,返回给前端打印数据
|
|
|
|
|
*/
|
|
|
|
|
List<MesProduceSnPrintModel> printModelList = new ArrayList<>();
|
|
|
|
|
//List<MesProduceSnPrintModel> printModelList = new ArrayList<>();
|
|
|
|
|
//2. 获取条码需要模板、模板代码、打印机 --- 循环遍历条码 封装数据
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(productionPartContextList)) return stepResult;
|
|
|
|
@ -96,14 +96,7 @@ public class MesProductSnPrintSortStepService extends BaseStepService {
|
|
|
|
|
|
|
|
|
|
List<MesWorkOrder> needModifyWorkOrderList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack("WH_CUST_SN_RULE", MesPcnExtConstWords.RULE_CODE, packBean);
|
|
|
|
|
MesNumberRule numberRule = numberRuleRepository.getByProperty(packBean);
|
|
|
|
|
|
|
|
|
|
if (numberRule == null) {
|
|
|
|
|
log.error("MesCustSnPrintStepService --- exec --- 客户条码编码规则[WH_CUST_SN_RULE]无效");
|
|
|
|
|
return stepResult;
|
|
|
|
|
}
|
|
|
|
|
List<Map<String, Object>> resultMap = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
for (MesProductionPartContext sn : productionPartContextList) {
|
|
|
|
|
|
|
|
|
@ -112,16 +105,28 @@ public class MesProductSnPrintSortStepService extends BaseStepService {
|
|
|
|
|
|
|
|
|
|
if (workOrder == null) {
|
|
|
|
|
log.error("MesCustSnPrintStepService --- exec --- 工单号:{}无效", sn.getWorkOrderNo());
|
|
|
|
|
stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号:{}无效!", sn.getWorkOrderNo()));
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((partDataContext == null) || (!partDataContext.containsKey(workOrder.getPartNo()))) {
|
|
|
|
|
log.error("MesCustSnPrintStepService --- exec --- 工单号:{}零件{}丢失缓存", sn.getWorkOrderNo(), sn.getPartNo());
|
|
|
|
|
continue;
|
|
|
|
|
stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]丢失零件信息缓存!", sn.getWorkOrderNo(), sn.getPartNo()));
|
|
|
|
|
}
|
|
|
|
|
MesPart mesPart = partDataContext.get(sn.getPartNo());
|
|
|
|
|
|
|
|
|
|
String custMatchRule = StringUtils.isEmpty(mesPart.getCustMatchRule()) ? "WH_CUST_SN_RULE" : mesPart.getCustMatchRule();
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(custMatchRule, MesPcnExtConstWords.RULE_CODE, packBean);
|
|
|
|
|
MesNumberRule numberRule = numberRuleRepository.getByProperty(packBean);
|
|
|
|
|
|
|
|
|
|
if (numberRule == null) {
|
|
|
|
|
log.error("MesCustSnPrintStepService --- exec --- 客户条码编码规则[WH_CUST_SN_RULE]无效");
|
|
|
|
|
stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]客户条码编码规则[%s]无效!", sn.getWorkOrderNo(), sn.getPartNo(), custMatchRule));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 从物料信息中获取标签模板
|
|
|
|
|
String labelTemplateCode = partDataContext.get(sn.getPartNo()).getProductLabelTemplate();
|
|
|
|
|
String labelTemplateCode = partDataContext.get(sn.getPartNo()).getCustLabelTemplate();
|
|
|
|
|
|
|
|
|
|
// 从物料信息中获取打印机
|
|
|
|
|
String productPrinterCode = partDataContext.get(sn.getPartNo()).getProductPrinterCode();
|
|
|
|
@ -156,8 +161,8 @@ public class MesProductSnPrintSortStepService extends BaseStepService {
|
|
|
|
|
}
|
|
|
|
|
IPrintTemplateStrategyService strategyService = (IPrintTemplateStrategyService) SpringContextsUtil.getBean(methodCode);
|
|
|
|
|
// GenSerialNoModel model , MesProduceSnPrintModel mesProduceSnPrintModel, MesNumberRule numberRule, StepResult stepResult, StationRequestBean reqBean, Boolean isStep
|
|
|
|
|
MesProduceSnPrintModel printModel = strategyService.execute(null, mesProduceSnPrintModel, null, stepResult, reqBean, true);
|
|
|
|
|
printModelList.add(printModel);
|
|
|
|
|
MesProduceSnPrintModel printModel = strategyService.execute(null, mesProduceSnPrintModel, numberRule, stepResult, reqBean, true);
|
|
|
|
|
resultMap.addAll(printModel.getPrintContextList());
|
|
|
|
|
needModifyWorkOrderList.add(workOrder);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -165,10 +170,11 @@ public class MesProductSnPrintSortStepService extends BaseStepService {
|
|
|
|
|
//前端接收到busiTyep是customComponent,并且 dataType是file类型的消息,就需要打印后续消息里的数据,一个模板对应多个打印数据
|
|
|
|
|
resultBean.setBusiType(MesPcnEnumUtil.STATION_BUSI_TYPE.CUSTOM_COMPONENT.getValue());
|
|
|
|
|
resultBean.setDataType(MesPcnEnumUtil.STATION_DATA_TYPE.FILE.getValue());
|
|
|
|
|
resultBean.setResultObj(printModelList);
|
|
|
|
|
resultBean.setCustomPageName("SORT_WORK_CENTER_PRINT");
|
|
|
|
|
resultBean.setResultObj(resultMap);
|
|
|
|
|
//3. 发送数据给到前端
|
|
|
|
|
this.sendMessage(reqBean, resultBean);
|
|
|
|
|
List<MesPrintedSnLog> snLogList = printModelList.stream().map(MesProduceSnPrintModel::getMesPrintedSnLogList).flatMap(List::stream).collect(Collectors.toList());
|
|
|
|
|
List<MesPrintedSnLog> snLogList = new ArrayList<>();
|
|
|
|
|
//更新打印状态
|
|
|
|
|
for (MesWorkOrder workOrder : needModifyWorkOrderList) {
|
|
|
|
|
MesPrintedSnLog snLog = new MesPrintedSnLog();
|
|
|
|
|