|
|
|
@ -38,13 +38,13 @@ import java.util.stream.Collectors;
|
|
|
|
|
public class MesAssemblyShowSortStepService extends BaseStepService {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesProductionProcessContextStepService productionProcessContextStepService;
|
|
|
|
|
public IMesProductionProcessContextStepService productionProcessContextStepService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesProductionDispatchContextStepService productionDispatchContextStepService;
|
|
|
|
|
public IMesProductionDispatchContextStepService productionDispatchContextStepService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesProdRuleCfgExtService prodRuleCfgExtService;
|
|
|
|
|
public IMesProdRuleCfgExtService prodRuleCfgExtService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public StepResult execute(StationRequestBean reqBean) {
|
|
|
|
@ -82,7 +82,7 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
|
|
|
|
|
Integer initSize = prodRuleContextList.size();
|
|
|
|
|
|
|
|
|
|
//封装排序加工规则
|
|
|
|
|
doHandleProdRuleData(reqBean, resultBean, productionProcessContext, prodRuleContextList, productionPartContextList, productionPsInContextList);
|
|
|
|
|
doHandleProdRuleData(reqBean, resultBean, productionProcessContext, cellEquipContext, prodRuleContextList, productionPartContextList, productionPsInContextList);
|
|
|
|
|
|
|
|
|
|
if (prodRuleContextList.size() != initSize) {
|
|
|
|
|
//保存上下文产品加工规则信息集合
|
|
|
|
@ -94,15 +94,41 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//显示装配件信息
|
|
|
|
|
if (!showProductionAssembly(reqBean, resultBean, workCenter, cellEquipContext, prodRuleContextList))
|
|
|
|
|
if (!showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList))
|
|
|
|
|
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "当前未查询到相关的装配件清单");
|
|
|
|
|
|
|
|
|
|
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "显示装配件扫描项成功!");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MesProdRuleContext getProdRuleSortContext(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, MesProductionPsInContext productionPsInContext) {
|
|
|
|
|
MesProdRuleContext prodRuleContext = new MesProdRuleContext(
|
|
|
|
|
reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), reqBean.getProcessCode(), productionProcessContext.getCraftCode())
|
|
|
|
|
.equipmentCode(cellEquipContext.getEquipmentCode()).workOrderNo(productionPsInContext.getWorkOrderNo()).productSn(productionPsInContext.getProductSn()).foreignKey(productionPsInContext.getForeignKey());
|
|
|
|
|
return prodRuleCfgExtService.getProdRuleSortContext(prodRuleContext);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//装配件清单列表标题
|
|
|
|
|
public List<AttrBean> dataAttrList(List<MesProdRuleContext> prodRuleContextList) {
|
|
|
|
|
List<AttrBean> attrBeanList = new ArrayList<>();
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.INDEX, "序号");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.MATCH_TYPE_NAME, "装配方式");
|
|
|
|
|
if (prodRuleContextList.size() > 1) PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.WORK_ORDER_NO, "生产工单编号");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.PART_NO, "零件编码");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_PART_NO, "原料编码");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_PART_NAME, "原料名称");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_SN, "原料条码");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_STATUS_NAME, "装配状态");
|
|
|
|
|
return attrBeanList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//每个表格重新排序
|
|
|
|
|
public List<MesAssemblyShowContext> sortAssemblyShowContextList(List<MesAssemblyShowContext> assemblyShowContextList) {
|
|
|
|
|
return assemblyShowContextList.stream().filter(o -> null != o).sorted(Comparator.comparing(MesAssemblyShowContext::getRouteSeq)).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//查询排序线加工规则装配件数据信息
|
|
|
|
|
private void doHandleProdRuleData(StationRequestBean reqBean, StationResultBean resultBean, MesProductionProcessContext productionProcessContext,
|
|
|
|
|
private void doHandleProdRuleData(StationRequestBean reqBean, StationResultBean resultBean, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext,
|
|
|
|
|
List<MesProdRuleContext> prodRuleContextList, List<MesProductionPartContext> productionPartContextList, List<MesProductionPsInContext> productionPsInContextList) {
|
|
|
|
|
|
|
|
|
|
//上下文中不存在进料主条码数据信息
|
|
|
|
@ -119,15 +145,15 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
|
|
|
|
|
if (null == productionPsInContext || productionPsInContext.getIsFinishCode().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0 || !StringUtils.isEmpty(productionPsInContext.getForeignKey())) continue;
|
|
|
|
|
|
|
|
|
|
//【排序线】获取产品加工规则(条码对应的装配件绑定记录,目前条码等同工单)
|
|
|
|
|
prodRuleContextList.add(prodRuleCfgExtService.getProdRuleSortContext(
|
|
|
|
|
new MesProdRuleContext(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), reqBean.getProcessCode(), productionProcessContext.getCraftCode()).workOrderNo(productionPsInContext.getWorkOrderNo()).productSn(productionPsInContext.getProductSn()).foreignKey(
|
|
|
|
|
productionPartContextList.stream().filter(o -> (null != o && o.getWorkOrderNo().equals(productionPsInContext.getWorkOrderNo()))).findFirst().get().foreignKey(productionPsInContext.foreignKey(foreignKey += 1).getForeignKey()).getForeignKey())));
|
|
|
|
|
productionPartContextList.stream().filter(o -> (null != o && o.getWorkOrderNo().equals(productionPsInContext.getWorkOrderNo()))).findFirst().get().foreignKey(productionPsInContext.foreignKey(foreignKey += 1).getForeignKey());
|
|
|
|
|
|
|
|
|
|
prodRuleContextList.add(getProdRuleSortContext(reqBean, productionProcessContext, cellEquipContext, productionPsInContext));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Boolean showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter, MesCellEquipContext cellEquipContext, List<MesProdRuleContext> prodRuleContextList) {
|
|
|
|
|
private Boolean showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter, List<MesProdRuleContext> prodRuleContextList) {
|
|
|
|
|
|
|
|
|
|
List<AttrBean> attrBeanList = null;
|
|
|
|
|
|
|
|
|
@ -136,7 +162,7 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
|
|
|
|
|
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
|
|
|
|
|
|
|
|
|
|
//封装匹配当前设备的装配件信息
|
|
|
|
|
List<MesAssemblyShowContext> assemblyShowContextList = getAssemblyShowContextList(cellEquipContext, prodRuleContext.getAssemblyDataContext(workCenter));
|
|
|
|
|
List<MesAssemblyShowContext> assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getAssemblyDataContext(workCenter));
|
|
|
|
|
if (CollectionUtils.isEmpty(assemblyShowContextList)) continue;
|
|
|
|
|
|
|
|
|
|
//装配件清单列表标题
|
|
|
|
@ -157,8 +183,7 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//封装匹配当前设备的装配件信息
|
|
|
|
|
private List<MesAssemblyShowContext> getAssemblyShowContextList(MesCellEquipContext cellEquipContext, List<MesProductionAssemblyContext> productionAssemblyContextList) {
|
|
|
|
|
productionAssemblyContextList = filterProductionAssemblyContextList(cellEquipContext, productionAssemblyContextList);
|
|
|
|
|
private List<MesAssemblyShowContext> getAssemblyShowContextList(List<MesProductionAssemblyContext> productionAssemblyContextList) {
|
|
|
|
|
if (CollectionUtils.isEmpty(productionAssemblyContextList)) return null;
|
|
|
|
|
List<MesAssemblyShowContext> assemblyShowContextList = new ArrayList<>();
|
|
|
|
|
for (MesProductionAssemblyContext item : productionAssemblyContextList) {
|
|
|
|
@ -166,7 +191,8 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
|
|
|
|
|
if (null == item || MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNoShow(item.getMatchType())) continue;
|
|
|
|
|
assemblyShowContextList.add(assemblyShowContext(item));
|
|
|
|
|
}
|
|
|
|
|
assemblyShowContextList = assemblyShowContextList.stream().filter(o -> null != o).sorted(Comparator.comparing(MesAssemblyShowContext::getRouteSeq)).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
assemblyShowContextList = sortAssemblyShowContextList(assemblyShowContextList);
|
|
|
|
|
|
|
|
|
|
AtomicReference<Integer> index = new AtomicReference<>(0);
|
|
|
|
|
assemblyShowContextList.forEach(o -> o.index(index.updateAndGet(v -> v + 1)));
|
|
|
|
@ -174,11 +200,7 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
|
|
|
|
|
return assemblyShowContextList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//搜集匹配当前设备的装配件信息
|
|
|
|
|
private List<MesProductionAssemblyContext> filterProductionAssemblyContextList(MesCellEquipContext cellEquipContext, List<MesProductionAssemblyContext> productionAssemblyContextList) {
|
|
|
|
|
return CollectionUtils.isEmpty(productionAssemblyContextList) ? null :
|
|
|
|
|
productionAssemblyContextList.stream().filter(o -> (null != o && o.getEquipmentCode().equals(cellEquipContext.getEquipmentCode()))).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//封装装配件信息
|
|
|
|
|
private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext o) {
|
|
|
|
@ -191,18 +213,4 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
|
|
|
|
|
return assemblyShowContext;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//装配件清单列表标题
|
|
|
|
|
private List<AttrBean> dataAttrList(List<MesProdRuleContext> prodRuleContextList) {
|
|
|
|
|
List<AttrBean> attrBeanList = new ArrayList<>();
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.INDEX, "序号");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.MATCH_TYPE_NAME, "装配方式");
|
|
|
|
|
if (prodRuleContextList.size() > 1) PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.WORK_ORDER_NO, "生产工单编号");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.PART_NO, "零件编码");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_PART_NO, "原料编码");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_PART_NAME, "原料名称");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_SN, "原料条码");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_STATUS_NAME, "装配状态");
|
|
|
|
|
return attrBeanList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|