tags/yfai-pcn-ext-v1.0
gsz 12 months ago
commit af477f4a5c

@ -1,5 +1,6 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.station;
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.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseModuleService;
@ -29,12 +30,18 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
@Autowired
private IMesProductionProcessContextStepService productionProcessContextStepService;
@Autowired
private IMesProductionDispatchContextStepService mesProductionDispatchContextStepService;
@Override
public void init(StationRequestBean reqBean) {
/**
*
*/
StationResultBean resultBean = getStationResultBean(reqBean);
List<List<StationKvBean>> moduleContentContext = mesProductionDispatchContextStepService.getModuleContentContext(reqBean);
StationResultBean resultBean = getStationResultBean(reqBean, moduleContentContext);
StationResultBean resultBean1 = getStationResultBean1(reqBean);
@ -44,62 +51,17 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
this.sendMessage(reqBean, resultBean);
this.sendMessage(reqBean, resultBean);
}
private StationResultBean getStationResultBean(StationRequestBean reqBean) {
private StationResultBean getStationResultBean(StationRequestBean reqBean, List<List<StationKvBean>> moduleContentContext) {
StationResultBean resultBean = new StationResultBean();
resultBean.setBusiType(MesPcnEnumUtil.STATION_BUSI_TYPE.MODULE_CONTENT.getValue());
resultBean.setDataType(MesPcnEnumUtil.STATION_DATA_TYPE.CUSTOM.getValue());
resultBean.setCustomPageName(MesPcnExtConstWords.CUSTOM_PAGE_NAME_DEFAULT);
resultBean.setSpecialDisplayData(getStepColIndent(reqBean));
List<List<StationKvBean>> stationKvBeansList = new ArrayList<>();
List<StationKvBean> stationKvBeans = new ArrayList<>();
StationKvBean stationKvBean = new StationKvBean();
stationKvBean.setKey("orderNo");
stationKvBean.setName("工单号");
stationKvBean.setValue("11111");
stationKvBeans.add(stationKvBean);
StationKvBean stationKvBean1 = new StationKvBean();
stationKvBean1.setKey("partNo");
stationKvBean1.setName("零件号");
stationKvBean1.setValue("111");
stationKvBeans.add(stationKvBean1);
StationKvBean stationKvBean2 = new StationKvBean();
stationKvBean2.setKey("count");
stationKvBean2.setName("单数");
stationKvBean2.setValue("1111");
stationKvBeans.add(stationKvBean2);
stationKvBeansList.add(stationKvBeans);
List<StationKvBean> stationKvBeans1 = new ArrayList<>();
StationKvBean stationKvBean4 = new StationKvBean();
stationKvBean4.setKey("orderNo");
stationKvBean4.setName("工单号");
stationKvBean4.setValue("11111");
stationKvBeans1.add(stationKvBean4);
StationKvBean stationKvBean5 = new StationKvBean();
stationKvBean5.setKey("partNo");
stationKvBean5.setName("零件号");
stationKvBean5.setValue("111");
stationKvBeans1.add(stationKvBean5);
StationKvBean stationKvBean6 = new StationKvBean();
stationKvBean6.setKey("count");
stationKvBean6.setName("单数");
stationKvBean6.setValue("1111");
stationKvBeans1.add(stationKvBean6);
stationKvBeansList.add(stationKvBeans1);
List<StationKvBean> stationKvBeans3 = new ArrayList<>();
StationKvBean stationKvBean7 = new StationKvBean();
@ -115,7 +77,7 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
stationKvBeans3.add(stationKvBean8);
resultBean.setResultObj(stationKvBeans3);
resultBean.setResultList(stationKvBeansList);
resultBean.setResultList(moduleContentContext);
return resultBean;
}

@ -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, "原料名称");

@ -11,6 +11,7 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesEquipVariableCollectContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.MesEnumUtil;
@ -91,6 +92,7 @@ public class MesMouldRecordGenerateStepService extends BaseStepService {
MesProdMouldRecord mesProductionRecord = getMesProdMouldRecord(mesCellEquipContext, mouldNo, mesMouldMappingCfg);
ConvertBean.serviceModelInitialize(mesProductionRecord, reqBean.getUserInfo());
mesProdMouldRecords.add(mesProductionRecord);
}

@ -0,0 +1,90 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
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.pojo.context.MesCellEquipContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.ActorMessage;
import cn.estsh.i3plus.mes.pcn.config.SpringExtProvider;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
import cn.estsh.i3plus.pojo.base.codemaker.SnowflakeIdMaker;
import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn;
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
import cn.estsh.i3plus.pojo.mes.model.StepResult;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @Description :
* @Author : zxw
**/
@Slf4j
@Service
public class MesProductResultErrorHandleStepService extends BaseStepService {
@Autowired
private SnowflakeIdMaker snowflakeIdMaker;
@Autowired
private ActorSystem actorSystem;
@Autowired
private IMesProductionProcessContextStepService productionProcessContextStepService;
@Autowired
private IMesProductionDispatchContextStepService mesProductionDispatchContextStepService;
public static final String ORDER_NO_JIS_SORT = "ORDER_NO_JIS_SORT";
private static final Map<String, ActorRef> refMap = new ConcurrentHashMap<>(200);
@Override
public StepResult execute(StationRequestBean reqBean) {
StationResultBean resultBean = new StationResultBean();
StepResult stepResult = StepResult.getSuccessComplete();
// 获取上下文信息
MesProductionProcessContext productionProcessContext = productionProcessContextStepService.getCurCellEquipment(reqBean);
// 获取条码信息
List<MesProduceSn> mesProduceSns = mesProductionDispatchContextStepService.getOutProduceSnDataContext(reqBean);
// 通过上下文获取工位设备信息
MesCellEquipContext curCellEquip = productionProcessContext.getCurCellEquip();
String mesProduceSnsStr = !CollectionUtils.isEmpty(mesProduceSns) ? JSONObject.toJSONString(mesProduceSns) : null;
ActorMessage actorMessage = ActorMessage.builder()
.equipmentCode(curCellEquip.getEquipmentCode())
.equipId(curCellEquip.getEquipId())
.organizeCode(reqBean.getOrganizeCode())
.organizeName(reqBean.getOrganizeName())
.workCellCode(reqBean.getWorkCellCode())
.workCenterCode(reqBean.getWorkCenterCode())
.areaCode(reqBean.getAreaCode())
.craftCode(productionProcessContext.getCraftCode())
.processCode(reqBean.getProcessCode())
.produceSnJson(mesProduceSnsStr)
.userName(reqBean.getUserInfo())
.build();
// 数据采集信息需要存放到 redis中
String key = this.getFsmBusikey(reqBean, MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PROCESS_FINISH.name());
ActorRef ref = refMap.computeIfAbsent(key,
k -> actorSystem.actorOf(SpringExtProvider.getInstance().get(actorSystem).create("mesHandlerEquipLogActor"), key));
ref.tell(actorMessage, ActorRef.noSender());
return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "保存工艺参数成功");
}
}

@ -6,6 +6,7 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesEquipVariableCollectContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.pojo.base.codemaker.SnowflakeIdMaker;
import cn.estsh.i3plus.pojo.base.enumutil.MesEnumUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesPart;
@ -63,6 +64,7 @@ public class MesProductionReocrdGenerateStepService extends BaseStepService {
mesProduceSns.forEach(mesProduceSn -> {
MesProductionRecord mesProductionRecord = getMesProductionRecord(productionProcessContext, mesProduceSn, reqBean);
ConvertBean.serviceModelInitialize(mesProductionRecord, reqBean.getUserInfo());
mesProductionRecords.add(mesProductionRecord);
});
@ -78,11 +80,17 @@ public class MesProductionReocrdGenerateStepService extends BaseStepService {
mesProductionRecord.setAreaCode(mesProduceSn.getAreaCode());
mesProductionRecord.setCraftCode(mesProduceSn.getCraftCode());
mesProductionRecord.setCustSn(mesProduceSn.getCustSn());
mesProductionRecord.setEquipmentCode(mesProduceSn.getEquipmentCode());
mesProductionRecord.setProductSn(mesProduceSn.getCustSn());
mesProductionRecord.setEquipmentCode(productionProcessContext.getCurCellEquip().getEquipmentCode());
mesProductionRecord.setEquipmentName(productionProcessContext.getCurCellEquip().getEquipmentName());
mesProductionRecord.setPartNo(mesProduceSn.getPartNo());
mesProductionRecord.setPartName(mesProduceSn.getPartNameRdd());
mesProductionRecord.setIsComplete(MesEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
mesProductionRecord.setCompleteDateTime(DateUtil.formatDateTime(new Date()));
mesProductionRecord.setLotNo(mesProduceSn.getLotNo());
mesProductionRecord.setEquipmentName(mesProduceSn.getEquipmentName());
//mesProductionRecord.setShiftGroup();
//mesProductionRecord.setWorkOrderNo(productionProcessContext.get);
String mouldNo = "";
MesEquipVariableCollectContext mesFirstMouldNoCollectContext = mesProductionDispatchContextStepService.getFirstMouldNoContext(reqBean);

@ -0,0 +1,81 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
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.pojo.context.MesCellEquipContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.ActorMessage;
import cn.estsh.i3plus.mes.pcn.config.SpringExtProvider;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
import cn.estsh.i3plus.pojo.base.codemaker.SnowflakeIdMaker;
import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn;
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
import cn.estsh.i3plus.pojo.mes.model.StepResult;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @Description :
* @Author : zxw
**/
@Slf4j
@Service
public class MesSaveProcessResultStepService extends BaseStepService {
@Autowired
private SnowflakeIdMaker snowflakeIdMaker;
@Autowired
private ActorSystem actorSystem;
@Autowired
private IMesProductionProcessContextStepService productionProcessContextStepService;
@Autowired
private MesVariableWhenFinishedReadStepService mesVariableWhenFinishedReadStepService;
@Autowired
private MesMouldRecordGenerateStepService mesMouldRecordGenerateStepService;
@Autowired
private MesProductSnSaveStepService MesProductSnSaveStepService;
@Autowired
private MesProductionReocrdGenerateStepService mesProductionReocrdGenerateStepService;
@Autowired
private IMesProductionDispatchContextStepService mesProductionDispatchContextStepService;
public static final String ORDER_NO_JIS_SORT = "ORDER_NO_JIS_SORT";
private static final Map<String, ActorRef> refMap = new ConcurrentHashMap<>(200);
@Override
public StepResult execute(StationRequestBean reqBean) {
StationResultBean resultBean = new StationResultBean();
StepResult stepResult = StepResult.getSuccessComplete();
mesMouldRecordGenerateStepService.execute(reqBean);
MesProductSnSaveStepService.execute(reqBean);
mesProductionReocrdGenerateStepService.execute(reqBean);
mesProductionDispatchContextStepService.deleteFirstMouldNoContext(reqBean);
mesProductionDispatchContextStepService.deleteMouldNoContext(reqBean);
mesProductionDispatchContextStepService.deleteProductResultContext(reqBean);
mesProductionDispatchContextStepService.deleteReadySignalContext(reqBean);
return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "保存加工结果成功");
}
}

@ -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