tags/yfai-pcn-ext-v1.0
王杰 12 months ago
parent c2088d7828
commit 208d876e29

@ -84,7 +84,7 @@ public class MesAssemblyShowNosortStepService extends BaseStepService {
if (prodRuleContextList.size() != initSize) productionDispatchContextStepService.saveProdRuleDataContext(reqBean, prodRuleContextList);
//显示装配件信息
showProductionAssembly(reqBean, resultBean, workCenter, cellEquipContext, prodRuleContextList);
showProductionAssembly(reqBean, resultBean, workCenter, cellEquipContext, prodRuleContextList, productionPartContextList);
return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "装配件扫描项已查询完毕,请查看!");
}
@ -258,7 +258,9 @@ public class MesAssemblyShowNosortStepService extends BaseStepService {
}
//显示装配件信息
private Boolean showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter, MesCellEquipContext cellEquipContext, List<MesProdRuleContext> prodRuleContextList) {
private Boolean showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter, MesCellEquipContext cellEquipContext, List<MesProdRuleContext> prodRuleContextList, List<MesProductionPartContext> productionPartContextList) {
Map<Integer, MesProductionPartContext> productionPartMap = productionPartContextList.stream().filter(o -> null != o).collect(Collectors.toMap(MesProductionPartContext::getForeignKey, o -> o));
List<AttrBean> attrBeanList = null;
@ -266,12 +268,14 @@ public class MesAssemblyShowNosortStepService extends BaseStepService {
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
String workOrderNo = getWorkOrderNo(productionPartMap, prodRuleContext.getForeignKey());
//封装匹配当前设备的装配件信息
List<MesAssemblyShowContext> assemblyShowContextList = getAssemblyShowContextList(cellEquipContext, prodRuleContext.getAssemblyDataContext(workCenter));
List<MesAssemblyShowContext> assemblyShowContextList = getAssemblyShowContextList(cellEquipContext, prodRuleContext.getAssemblyDataContext(workCenter), prodRuleContext, workOrderNo);
if (CollectionUtils.isEmpty(assemblyShowContextList)) continue;
//装配件清单列表标题
if (CollectionUtils.isEmpty(attrBeanList)) attrBeanList = dataAttrList();
if (CollectionUtils.isEmpty(attrBeanList)) attrBeanList = dataAttrList(workOrderNo);
//封装多表格
resultBean.addStationResultBeans(new StationResultBean().dataType(MesPcnEnumUtil.STATION_DATA_TYPE.TABLE.getValue()).dataAttrList(attrBeanList).resultList(assemblyShowContextList));
@ -287,22 +291,28 @@ public class MesAssemblyShowNosortStepService extends BaseStepService {
}
private String getWorkOrderNo(Map<Integer, MesProductionPartContext> productionPartMap, Integer foreignKey) {
return (!CollectionUtils.isEmpty(productionPartMap) && productionPartMap.containsKey(foreignKey)) ? productionPartMap.get(foreignKey).getWorkOrderNo() : null;
}
//封装匹配当前设备的装配件信息
private List<MesAssemblyShowContext> getAssemblyShowContextList(MesCellEquipContext cellEquipContext, List<MesProductionAssemblyContext> productionAssemblyContextList) {
private List<MesAssemblyShowContext> getAssemblyShowContextList(MesCellEquipContext cellEquipContext, List<MesProductionAssemblyContext> productionAssemblyContextList, MesProdRuleContext prodRuleContext, String workOrderNo) {
if (CollectionUtils.isEmpty(productionAssemblyContextList)) return null;
List<MesAssemblyShowContext> assemblyShowContextList = new ArrayList<>();
for (MesProductionAssemblyContext item : productionAssemblyContextList) {
if (null == item) continue;
assemblyShowContextList.add(assemblyShowContext(item));
assemblyShowContextList.add(assemblyShowContext(item, prodRuleContext, workOrderNo));
}
assemblyShowContextList = assemblyShowContextList.stream().filter(o -> null != o).sorted(Comparator.comparing(MesAssemblyShowContext::getRouteSeq)).collect(Collectors.toList());
return assemblyShowContextList;
}
//封装装配件信息
private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext o) {
private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext o, MesProdRuleContext prodRuleContext, String workOrderNo) {
MesAssemblyShowContext assemblyShowContext = new MesAssemblyShowContext();
BeanUtils.copyProperties(o, assemblyShowContext);
if (!StringUtils.isEmpty(workOrderNo)) assemblyShowContext.setWorkOrderNo(workOrderNo);
assemblyShowContext.setPartNo(prodRuleContext.getOutPartNo());
if (StringUtils.isEmpty(assemblyShowContext.getRouteSeq())) assemblyShowContext.setRouteSeq(MesPcnExtConstWords.ZERO);
if (MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue() == assemblyShowContext.getAssemblyStatus() && (MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_50.getValue() == assemblyShowContext.getMatchType() ||
MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_60.getValue() == assemblyShowContext.getMatchType())) assemblyShowContext.setAssemblyStatus(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue());
@ -313,10 +323,10 @@ public class MesAssemblyShowNosortStepService extends BaseStepService {
}
//装配件清单列表标题
private List<AttrBean> dataAttrList() {
private List<AttrBean> dataAttrList(String workOrderNo) {
List<AttrBean> attrBeanList = new ArrayList<>();
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.INDEX, "序号");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.WORK_ORDER_NO, "生产工单编号");
if (!StringUtils.isEmpty(workOrderNo)) 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, "原料名称");

@ -13,6 +13,9 @@ public class MesAssemblyShowContext implements Serializable {
private static final long serialVersionUID = -3650546953572889323L;
@ApiParam("生产工单号")
private String workOrderNo;
@ApiParam("零件编码")
private String partNo;

Loading…
Cancel
Save