|
|
|
@ -2,6 +2,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesTemplateService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.IPrintTemplateStrategyService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step.method.MesPartDataMapSaveStepService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdRuleContext;
|
|
|
|
@ -43,6 +44,9 @@ import java.util.stream.Collectors;
|
|
|
|
|
public class MesProductSnPrintNosortStepService extends BaseStepService {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesProductionProcessContextStepService productionProcessContextStepService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesProductionDispatchContextStepService productionDispatchContextStepService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@ -90,6 +94,8 @@ public class MesProductSnPrintNosortStepService extends BaseStepService {
|
|
|
|
|
Boolean pcNosortPrinterCfg = getPcNosortPrinterCfg(reqBean.getOrganizeCode());
|
|
|
|
|
//保存零件数据信息
|
|
|
|
|
Map<String, MesPart> partDataMap = savePartDataMap(reqBean, resultBean, stepResult, prodRuleDataContextList, pcNosortPrinterCfg);
|
|
|
|
|
//处理工位零件打印机配置
|
|
|
|
|
List<MesWorkCellPartPrinterCfg> workCellPartPrinterCfgList = productionProcessContextStepService.disPatchWorkCellPartPrinterCfg(reqBean, pcNosortPrinterCfg);
|
|
|
|
|
|
|
|
|
|
//需要打印的数据 String 是打印模板code
|
|
|
|
|
Map<String, List<MesProduceSnPrintDataModel>> resultData = new HashMap<>();
|
|
|
|
@ -130,7 +136,7 @@ public class MesProductSnPrintNosortStepService extends BaseStepService {
|
|
|
|
|
mesProduceSnPrintModel.setUserName(reqBean.getUserInfo());
|
|
|
|
|
if (pcNosortPrinterCfg) {
|
|
|
|
|
//赋值打印机
|
|
|
|
|
String printer = filterPrinter(partDataMap, sn.getPartNo());
|
|
|
|
|
String printer = filterPrinter(reqBean, workCellPartPrinterCfgList, partDataMap, sn.getPartNo());
|
|
|
|
|
if (!StringUtils.isEmpty(printer)) mesProduceSnPrintModel.setPrinter(printer);
|
|
|
|
|
}
|
|
|
|
|
List<MesProduceSn> snList = new ArrayList<>();
|
|
|
|
@ -189,10 +195,19 @@ public class MesProductSnPrintNosortStepService extends BaseStepService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取打印机
|
|
|
|
|
private String filterPrinter(Map<String, MesPart> partDataMap, String partNo) {
|
|
|
|
|
if (CollectionUtils.isEmpty(partDataMap) || !partDataMap.containsKey(partNo)) return null;
|
|
|
|
|
String priter = partDataMap.get(partNo).getProductPrinterCode();
|
|
|
|
|
return !StringUtils.isEmpty(priter) ? priter : null;
|
|
|
|
|
private String filterPrinter(StationRequestBean reqBean, List<MesWorkCellPartPrinterCfg> workCellPartPrinterCfgList, Map<String, MesPart> partDataMap, String partNo) {
|
|
|
|
|
String priter = null;
|
|
|
|
|
if (!CollectionUtils.isEmpty(workCellPartPrinterCfgList)) {
|
|
|
|
|
Optional<MesWorkCellPartPrinterCfg> optional = workCellPartPrinterCfgList.stream().filter(o -> (null != o
|
|
|
|
|
&& !StringUtils.isEmpty(o.getWorkCenterCode()) && o.getWorkCenterCode().equals(reqBean.getWorkCenterCode())
|
|
|
|
|
&& !StringUtils.isEmpty(o.getWorkCellCode()) && o.getWorkCellCode().equals(reqBean.getWorkCellCode())
|
|
|
|
|
&& !StringUtils.isEmpty(o.getPartNo()) && o.getPartNo().equals(partNo) && !StringUtils.isEmpty(o.getPrinterCode()))).findFirst();
|
|
|
|
|
if (null != optional && optional.isPresent()) priter = optional.get().getPrinterCode();
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(priter) && !CollectionUtils.isEmpty(partDataMap) && partDataMap.containsKey(partNo)) {
|
|
|
|
|
priter = partDataMap.get(partNo).getProductPrinterCode();
|
|
|
|
|
}
|
|
|
|
|
return priter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//保存零件数据信息
|
|
|
|
|