排序 显示装配件扫描项

tags/yfai-pcn-ext-v2.3
王杰 8 months ago
parent f1f1d8fcdf
commit d51bcd2278

@ -11,7 +11,6 @@ import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.*;
import cn.estsh.i3plus.pojo.mes.repository.*;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -62,13 +61,9 @@ public class MesAssemblyExtService implements IMesAssemblyExtService {
//获取排序FILE文件URL
Map<Long, String> fileMap = getFileMap(prodRuleContext.getOrganizeCode(), filterSortFileIdList(workOrderAssemblyList));
//获取装配件绑定记录
Map<Long, MesProductionAssembly> productionAssemblyMap = groupProductionAssembly(filterProductionAssemblyList(getProductionAssemblyList(
prodRuleContext.getOrganizeCode(), MesExtEnumUtil.PRODUCTION_ASSEMBLY_DATA_SOURCE.SORT.getValue(), workOrderAssemblyList.stream().filter(o -> null != o).map(MesWorkOrderAssembly::getId).collect(Collectors.toList()))));
List<MesProductionAssemblySortContext> productionAssemblySortContextList = new ArrayList<>();
workOrderAssemblyList.forEach(o -> productionAssemblySortContextList.add(new MesProductionAssemblySortContext().copy(o, getProductionAssembly(productionAssemblyMap, o.getId())).fileUrl(fileMap)));
workOrderAssemblyList.forEach(o -> productionAssemblySortContextList.add(new MesProductionAssemblySortContext().copy(o).fileUrl(fileMap)));
return productionAssemblySortContextList;
}
@ -198,21 +193,6 @@ public class MesAssemblyExtService implements IMesAssemblyExtService {
return workOrderAssemblyRepository.findByHqlWhere(packBean);
}
//剔除解绑的数据
private List<MesProductionAssembly> filterProductionAssemblyList(List<MesProductionAssembly> productionAssemblyList) {
return CollectionUtils.isEmpty(productionAssemblyList) ? null : productionAssemblyList.stream().filter(o -> (null != o && MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_20.getValue() != o.getAssemblyStatus())).collect(Collectors.toList());
}
//根据生产工单装配件清单ID分组
private Map<Long, MesProductionAssembly> groupProductionAssembly(List<MesProductionAssembly> productionAssemblyList) {
return CollectionUtils.isEmpty(productionAssemblyList) ? null : productionAssemblyList.stream().filter(o -> null != o).collect(Collectors.toMap(MesProductionAssembly::getSourceId, o -> o));
}
//根据装配件清单ID获取装配件绑定记录
private MesProductionAssembly getProductionAssembly(Map<Long, MesProductionAssembly> productionAssemblyMap, Long id) {
return CollectionUtils.isEmpty(productionAssemblyMap) ? null : productionAssemblyMap.get(id);
}
//验证装配件规则对应的ID是否存在可复用装配件条码
private String getRepeatAssemblySn(String organizeCode, String workCenterCode, String workCellCode, MesAssemblyNosortCfg assemblyNosortCfg) {

@ -82,7 +82,7 @@ public class MesAssemblyScanStepService extends BaseStepService {
//获取上下文产品加工规则数据信息集合
List<MesProdRuleContext> prodRuleContextList = productionDispatchContextStepService.getProdRuleDataContext(reqBean);
//判断业务场景: 1=唯一加工规则场景; 2=无进无出扫装配件生成零件号场景; 3=有进未匹配加工规则扫装配件生成零件号场景
//判断业务场景: 1=唯一加工规则场景/排序; 2=无进无出扫装配件生成零件号场景; 3=有进未匹配加工规则扫装配件生成零件号场景
Integer busiType = getBusiType(productionPsInContextListNoFinishCode, prodRuleContextList);
//验证场景1 当前是否需要扫描装配件条码: 是否存在装配件清单 【当前验证只能对内部触发生效】
@ -160,7 +160,7 @@ public class MesAssemblyScanStepService extends BaseStepService {
}
//判断业务场景: 1=唯一加工规则场景; 2=无进无出扫装配件生成零件号场景; 3=有进未匹配加工规则扫装配件生成零件号场景
//判断业务场景: 1=唯一加工规则场景/排序线; 2=无进无出扫装配件生成零件号场景; 3=有进未匹配加工规则扫装配件生成零件号场景
private Integer getBusiType(List<MesProductionPsInContext> productionPsInContextListNoFinishCode, List<MesProdRuleContext> prodRuleContextList) {
if (CollectionUtils.isEmpty(productionPsInContextListNoFinishCode) && CollectionUtils.isEmpty(prodRuleContextList)) return BUSI_TYPE.TWO.value;
if (!CollectionUtils.isEmpty(productionPsInContextListNoFinishCode) && (CollectionUtils.isEmpty(prodRuleContextList) || productionPsInContextListNoFinishCode.size() != prodRuleContextList.size())) return BUSI_TYPE.THREE.value;
@ -272,7 +272,7 @@ public class MesAssemblyScanStepService extends BaseStepService {
//装配件扫描的业务场景
enum BUSI_TYPE {
ONE(1, "唯一加工规则场景"),//通过 产出零件 + 进料条码零件 + 设备 找到唯一的非排序产品加工规则, 产出零件与进料条码零件至少存在1个
ONE(1, "唯一加工规则场景或排序线"),//通过 产出零件 + 进料条码零件 + 设备 找到唯一的非排序产品加工规则, 产出零件与进料条码零件至少存在1个 或者 排序线
TWO(2, "无进无出扫装配件生成零件号场景"),//产出零件与进料条码零件均不扫描, 直接扫描装配件, 通过生成零件号工步反向匹配非排序产品加工规则

@ -82,7 +82,7 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
Integer initSize = prodRuleContextList.size();
//封装排序加工规则
doHandleProdRuleData(reqBean, resultBean, stepResult, workCenter, productionProcessContext, cellEquipContext, prodRuleContextList, productionPartContextList, productionPsInContextList);
doHandleProdRuleData(reqBean, resultBean, productionProcessContext, prodRuleContextList, productionPartContextList, productionPsInContextList);
if (prodRuleContextList.size() != initSize) {
//保存上下文产品加工规则信息集合
@ -91,9 +91,7 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
if (!CollectionUtils.isEmpty(productionPartContextList)) productionDispatchContextStepService.dispatchProductionPartContext(reqBean, productionPartContextList);
//保存进料主条码数据
if (!CollectionUtils.isEmpty(productionPsInContextList)) productionDispatchContextStepService.dispatchProductionPsInContext(reqBean, productionPsInContextList);
} else resultBean.checkRepeat();
if (!stepResult.isCompleted()) return stepResult;
}
//显示装配件信息
if (!showProductionAssembly(reqBean, resultBean, workCenter, cellEquipContext, prodRuleContextList))
@ -104,7 +102,7 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
}
//查询排序线加工规则装配件数据信息
private void doHandleProdRuleData(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesWorkCenter workCenter, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext,
private void doHandleProdRuleData(StationRequestBean reqBean, StationResultBean resultBean, MesProductionProcessContext productionProcessContext,
List<MesProdRuleContext> prodRuleContextList, List<MesProductionPartContext> productionPartContextList, List<MesProductionPsInContext> productionPsInContextList) {
//上下文中不存在进料主条码数据信息
@ -142,7 +140,7 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
if (CollectionUtils.isEmpty(assemblyShowContextList)) continue;
//装配件清单列表标题
if (CollectionUtils.isEmpty(attrBeanList)) attrBeanList = dataAttrList();
if (CollectionUtils.isEmpty(attrBeanList)) attrBeanList = dataAttrList(prodRuleContextList);
//封装多表格
resultBean.addStationResultBeans(new StationResultBean().dataType(MesPcnEnumUtil.STATION_DATA_TYPE.TABLE.getValue()).dataAttrList(attrBeanList).resultList(assemblyShowContextList));
@ -186,6 +184,7 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext o) {
MesAssemblyShowContext assemblyShowContext = new MesAssemblyShowContext();
BeanUtils.copyProperties(o, assemblyShowContext);
assemblyShowContext.setMatchTypeName(MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.valueOfDescription(assemblyShowContext.getMatchType()));
assemblyShowContext.setAssemblyStatusName(MesExtEnumUtil.ASSEMBLY_STATUS.valueOfDescription(o.getAssemblyStatus()));
if (MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue() != assemblyShowContext.getAssemblyStatus())
assemblyShowContext.setColor(StringUtils.isEmpty(assemblyShowContext.getShowColor()) ? MesExtEnumUtil.COLOR.GREEN.getValue() : assemblyShowContext.getShowColor());
@ -193,10 +192,11 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
}
//装配件清单列表标题
private List<AttrBean> dataAttrList() {
private List<AttrBean> dataAttrList(List<MesProdRuleContext> prodRuleContextList) {
List<AttrBean> attrBeanList = new ArrayList<>();
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.INDEX, "序号");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.WORK_ORDER_NO, "生产工单编号");
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, "原料名称");

@ -105,21 +105,19 @@ public class MesProductionAssemblySortContext extends MesProductionAssemblyConte
public MesProductionAssemblySortContext() {}
public MesProductionAssemblySortContext copy(MesWorkOrderAssembly workOrderAssembly, MesProductionAssembly productionAssembly) {
public MesProductionAssemblySortContext copy(MesWorkOrderAssembly workOrderAssembly) {
if (null != workOrderAssembly) BeanUtils.copyProperties(workOrderAssembly, this);
if (null != productionAssembly) BeanUtils.copyProperties(productionAssembly, this);
if (StringUtils.isEmpty(this.routeSeq)) this.routeSeq = MesPcnExtConstWords.ZERO;
if (StringUtils.isEmpty(this.isSkip)) this.isSkip = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue();
if (this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0 && !MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNeedScan(this.matchType))
this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue();
if (this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) != 0) this.isResetScan = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue();
this.isSkip = this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_40.getValue()) != 0 ? CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue() : CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue();
return this;
}

Loading…
Cancel
Save