forked from I3-YF/i3plus-mes-pcn-yfai
Merge branch 'dev' of http://git.estsh.com/I3-YF/i3plus-mes-pcn-yfai into dev
commit
af477f4a5c
@ -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, "保存工艺参数成功");
|
||||||
|
}
|
||||||
|
}
|
@ -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, "保存加工结果成功");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue