|
|
@ -6,16 +6,20 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepServ
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesCellEquipContext;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesCellEquipContext;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionAssemblyNosortContext;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionAssemblyNosortContext;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesScanMonitorContext;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
|
|
|
import cn.estsh.i3plus.mes.pcn.actor.shipping.dispatch.IFsmRouteDataService;
|
|
|
|
import cn.estsh.i3plus.mes.pcn.actor.shipping.dispatch.IFsmRouteDataService;
|
|
|
|
import cn.estsh.i3plus.mes.pcn.api.iservice.base.IConfigService;
|
|
|
|
import cn.estsh.i3plus.mes.pcn.api.iservice.base.IConfigService;
|
|
|
|
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
|
|
|
|
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.codemaker.SnowflakeIdMaker;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.*;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.*;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.StationKvBean;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.StationKvBean;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
@ -44,6 +48,9 @@ public class MesProductionProcessContextStepService extends BaseStepService impl
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private IConfigService configService;
|
|
|
|
private IConfigService configService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private SnowflakeIdMaker snowflakeIdMaker;
|
|
|
|
|
|
|
|
|
|
|
|
private String getContextKey(StationRequestBean reqBean) { return getFsmBusikey(reqBean, new StringJoiner(MesPcnExtConstWords.COLON).add(MesPcnExtConstWords.PRODUCTION_PROCESS_CONTEXT).add(MesPcnExtConstWords.BASE_DATA_CONTEXT).toString()); }
|
|
|
|
private String getContextKey(StationRequestBean reqBean) { return getFsmBusikey(reqBean, new StringJoiner(MesPcnExtConstWords.COLON).add(MesPcnExtConstWords.PRODUCTION_PROCESS_CONTEXT).add(MesPcnExtConstWords.BASE_DATA_CONTEXT).toString()); }
|
|
|
|
|
|
|
|
|
|
|
|
//清除上下文中的所有基础数据
|
|
|
|
//清除上下文中的所有基础数据
|
|
|
@ -155,29 +162,29 @@ public class MesProductionProcessContextStepService extends BaseStepService impl
|
|
|
|
|
|
|
|
|
|
|
|
//获取工位当前设备信息
|
|
|
|
//获取工位当前设备信息
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public MesProductionProcessContext getCurCellEquipment(StationRequestBean reqBean) {
|
|
|
|
public MesProductionProcessContext doHandleCurCellEquipment(StationRequestBean reqBean) {
|
|
|
|
return getCurCellEquipment(reqBean, getCellEquipmentList(reqBean));
|
|
|
|
return doHandleCurCellEquipment(reqBean, getCellEquipmentList(reqBean));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//获取工位当前设备信息
|
|
|
|
//获取工位当前设备信息
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public MesProductionProcessContext getCurCellEquipment(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext) {
|
|
|
|
public MesProductionProcessContext doHandleCurCellEquipment(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext) {
|
|
|
|
|
|
|
|
|
|
|
|
if (!productionProcessContext.getSuccess()) return productionProcessContext;
|
|
|
|
if (!productionProcessContext.getSuccess()) return productionProcessContext;
|
|
|
|
|
|
|
|
|
|
|
|
return getCurCellEquipment(reqBean, productionProcessContext, getStepParams(reqBean));
|
|
|
|
return doHandleCurCellEquipment(reqBean, productionProcessContext, getStepParams(reqBean));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//获取工位当前设备信息
|
|
|
|
//获取工位当前设备信息
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public MesProductionProcessContext getCurCellEquipment(StationRequestBean reqBean, Optional<Map<String, MesProdRouteOptParam>> stepParamMap) {
|
|
|
|
public MesProductionProcessContext doHandleCurCellEquipment(StationRequestBean reqBean, Optional<Map<String, MesProdRouteOptParam>> stepParamMap) {
|
|
|
|
return getCurCellEquipment(reqBean, getCellEquipmentList(reqBean), stepParamMap);
|
|
|
|
return doHandleCurCellEquipment(reqBean, getCellEquipmentList(reqBean), stepParamMap);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//获取工位当前设备信息
|
|
|
|
//获取工位当前设备信息
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public MesProductionProcessContext getCurCellEquipment(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext, Optional<Map<String, MesProdRouteOptParam>> stepParamMap) {
|
|
|
|
public MesProductionProcessContext doHandleCurCellEquipment(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext, Optional<Map<String, MesProdRouteOptParam>> stepParamMap) {
|
|
|
|
|
|
|
|
|
|
|
|
if (!productionProcessContext.getSuccess()) return productionProcessContext;
|
|
|
|
if (!productionProcessContext.getSuccess()) return productionProcessContext;
|
|
|
|
|
|
|
|
|
|
|
@ -192,6 +199,10 @@ public class MesProductionProcessContextStepService extends BaseStepService impl
|
|
|
|
//从工位设备集合信息中获取当前设备信息
|
|
|
|
//从工位设备集合信息中获取当前设备信息
|
|
|
|
MesCellEquipContext cellEquipmentContext = productionProcessContext.filterCurCellEquip(equipmentCode);
|
|
|
|
MesCellEquipContext cellEquipmentContext = productionProcessContext.filterCurCellEquip(equipmentCode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//保存上下文工位扫描监控信息【设备信息】
|
|
|
|
|
|
|
|
if (null != cellEquipmentContext) saveScanMonitorContext(reqBean,
|
|
|
|
|
|
|
|
doHandleScanMonitorContext(reqBean, true).equipment(cellEquipmentContext.getEquipId(), cellEquipmentContext.getEquipmentCode(), cellEquipmentContext.getEquipmentName()), false);
|
|
|
|
|
|
|
|
|
|
|
|
//生产过程上下文对象赋值当前设备代码
|
|
|
|
//生产过程上下文对象赋值当前设备代码
|
|
|
|
if (null != cellEquipmentContext) return productionProcessContext.curCellEquipJson(cellEquipmentContext.kepwareFlagJson(equipmentExtService.getEquipmentChannelList(reqBean.getOrganizeCode(), cellEquipmentContext.getEquipmentCode())))
|
|
|
|
if (null != cellEquipmentContext) return productionProcessContext.curCellEquipJson(cellEquipmentContext.kepwareFlagJson(equipmentExtService.getEquipmentChannelList(reqBean.getOrganizeCode(), cellEquipmentContext.getEquipmentCode())))
|
|
|
|
.cavityGroupDetailJson(equipmentExtService.getMesCavityGroupDetailCfgList(reqBean.getOrganizeCode(), cellEquipmentContext.getEquipmentCode()));
|
|
|
|
.cavityGroupDetailJson(equipmentExtService.getMesCavityGroupDetailCfgList(reqBean.getOrganizeCode(), cellEquipmentContext.getEquipmentCode()));
|
|
|
@ -204,7 +215,7 @@ public class MesProductionProcessContextStepService extends BaseStepService impl
|
|
|
|
//获取设备数据变量接口逻辑信息
|
|
|
|
//获取设备数据变量接口逻辑信息
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public MesProductionProcessContext getEquipmentVariableCfgList(StationRequestBean reqBean) {
|
|
|
|
public MesProductionProcessContext getEquipmentVariableCfgList(StationRequestBean reqBean) {
|
|
|
|
return getEquipmentVariableCfgList(getCurCellEquipment(reqBean));
|
|
|
|
return getEquipmentVariableCfgList(doHandleCurCellEquipment(reqBean));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//获取设备数据变量接口逻辑信息
|
|
|
|
//获取设备数据变量接口逻辑信息
|
|
|
@ -363,4 +374,61 @@ public class MesProductionProcessContextStepService extends BaseStepService impl
|
|
|
|
deleteFsmBusiData(reqBean.getOrganizeCode(), getContextKey(reqBean), MesPcnExtConstWords.FUNCTION_CHOOSE_CAVITY_ORDER);
|
|
|
|
deleteFsmBusiData(reqBean.getOrganizeCode(), getContextKey(reqBean), MesPcnExtConstWords.FUNCTION_CHOOSE_CAVITY_ORDER);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取上下文工位扫描监控信息, 没有就重新封装工位扫描监控信息, 同时处理基础上下文信息 【其他地方调用 isSave 必须传 true 】
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public MesScanMonitorContext doHandleScanMonitorContext(StationRequestBean reqBean, Boolean isSave) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MesScanMonitorContext scanMonitorContext = getScanMonitorContext(reqBean);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//封装工位扫描监控信息, 同时处理基础上下文信息
|
|
|
|
|
|
|
|
if (null == scanMonitorContext) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取生产过程上下文对象
|
|
|
|
|
|
|
|
MesProductionProcessContext productionProcessContext = getProductionProcessContext(reqBean);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//存储生产过程上下文对象
|
|
|
|
|
|
|
|
saveProductionProcessContext(reqBean, productionProcessContext);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scanMonitorContext = new MesScanMonitorContext(reqBean.getOrganizeCode(),
|
|
|
|
|
|
|
|
productionProcessContext.getProcessCode(), productionProcessContext.getProcessName(), productionProcessContext.getCraftCode(), productionProcessContext.getCraftName());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MesWorkCell workCell = productionProcessContext.getWorkCell();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (null != workCell) BeanUtils.copyProperties(workCell, scanMonitorContext);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isSave) saveScanMonitorContext(reqBean, scanMonitorContext, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return scanMonitorContext;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//保存上下文工位扫描监控信息
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public Boolean saveScanMonitorContext(StationRequestBean reqBean) {
|
|
|
|
|
|
|
|
MesScanMonitorContext scanMonitorContext = doHandleScanMonitorContext(reqBean, false);
|
|
|
|
|
|
|
|
return saveScanMonitorContext(reqBean, scanMonitorContext, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//保存上下文工位扫描监控信息
|
|
|
|
|
|
|
|
private Boolean saveScanMonitorContext(StationRequestBean reqBean, MesScanMonitorContext scanMonitorContext, Boolean isSetMouldRecordId) {
|
|
|
|
|
|
|
|
if (null == scanMonitorContext) return false;
|
|
|
|
|
|
|
|
//开模记录ID, 工序开始时间
|
|
|
|
|
|
|
|
if (isSetMouldRecordId) scanMonitorContext.mouldRecordId(snowflakeIdMaker.nextId()).startDateTime(TimeTool.getNowTime(true));
|
|
|
|
|
|
|
|
return saveFsmBusiData(reqBean.getOrganizeCode(), getContextKey(reqBean), MesPcnExtConstWords.SCAN_MONITOR_CONTEXT, JSONObject.toJSONString(scanMonitorContext));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取上下文工位扫描监控信息
|
|
|
|
|
|
|
|
private MesScanMonitorContext getScanMonitorContext(StationRequestBean reqBean) {
|
|
|
|
|
|
|
|
String scanMonitorContextJson = getFsmBusiData(reqBean.getOrganizeCode(), getContextKey(reqBean), MesPcnExtConstWords.SCAN_MONITOR_CONTEXT);
|
|
|
|
|
|
|
|
return !StringUtils.isEmpty(scanMonitorContextJson) ? JSONObject.parseObject(scanMonitorContextJson, MesScanMonitorContext.class) : null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//删除上下文工位扫描监控信息
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void deleteScanMonitorContext(StationRequestBean reqBean) {
|
|
|
|
|
|
|
|
deleteFsmBusiData(reqBean.getOrganizeCode(), getContextKey(reqBean), MesPcnExtConstWords.SCAN_MONITOR_CONTEXT);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|