|
|
|
@ -10,17 +10,11 @@ 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.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentVariableParam;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentVariableParamLog;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPart;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesRawMixCfgDetail;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.*;
|
|
|
|
|
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.repository.MesEquipmentVariableParamLogRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentVariableParamRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesPartRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesRawMixCfgDetailRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.*;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
@ -30,6 +24,7 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description : 统计每摸模自动喷胶量
|
|
|
|
@ -52,6 +47,8 @@ public class MesGlueSprayedAmountStepService extends BaseStepService {
|
|
|
|
|
private MesEquipmentVariableParamLogRepository equipVarParamLogRDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesPartRepository mesPartRDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesProductionRecordRepository productionRecordRDao;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public StepResult execute(StationRequestBean reqBean) {
|
|
|
|
@ -73,6 +70,7 @@ public class MesGlueSprayedAmountStepService extends BaseStepService {
|
|
|
|
|
if (CollectionUtils.isEmpty(prodRuleContextList)) {
|
|
|
|
|
stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前不存在产品加工规则信息,请重置工序解决!");
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, List<MesProdRuleContext>> prodRuleContextMap = prodRuleContextList.stream().collect(Collectors.groupingBy(MesProdRuleContext::getForeignKey));
|
|
|
|
|
|
|
|
|
|
//当前工位使用的设备
|
|
|
|
|
MesCellEquipContext cellEquipContext = productionProcessContext.getCurCellEquip();
|
|
|
|
@ -92,17 +90,18 @@ public class MesGlueSprayedAmountStepService extends BaseStepService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//遍历产品加工规则
|
|
|
|
|
for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
|
|
|
|
|
|
|
|
|
|
//没有装配件的条件
|
|
|
|
|
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
|
|
|
|
|
//1. 获取上下文中生成的主条码
|
|
|
|
|
List<MesProductionPsOutContext> productionPsOutContextList = productionDispatchContextStepService.getProductionPsOutContext(reqBean);
|
|
|
|
|
for (MesProductionPsOutContext sn : productionPsOutContextList) {
|
|
|
|
|
List<MesProdRuleContext> mesProdRuleContexts = prodRuleContextMap.get(sn.getForeignKey());
|
|
|
|
|
MesProdRuleContext prodRuleContext = CollectionUtils.isEmpty(mesProdRuleContexts) ? null : mesProdRuleContexts.get(0);
|
|
|
|
|
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) {
|
|
|
|
|
stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("零件号[%s]的加工规则丢失,请配置!", sn.getPartNo()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取非排序装配件清单
|
|
|
|
|
List<MesProductionAssemblyNosortContext> productionAssemblyNosortContextList = prodRuleContext.getNosortAssemblyDataContext();
|
|
|
|
|
|
|
|
|
|
boolean flag = false;
|
|
|
|
|
|
|
|
|
|
MesEquipmentVariableParamLog paramLog = new MesEquipmentVariableParamLog();
|
|
|
|
|
paramLog.setOrganizeCode(reqBean.getOrganizeCode());
|
|
|
|
|
paramLog.setPartNo(prodRuleContext.getOutPartNo());
|
|
|
|
@ -111,12 +110,19 @@ public class MesGlueSprayedAmountStepService extends BaseStepService {
|
|
|
|
|
if (mesPart != null) {
|
|
|
|
|
paramLog.setPartName(mesPart.getPartName());
|
|
|
|
|
}
|
|
|
|
|
paramLog.setProductSn(prodRuleContext.getProductSn());
|
|
|
|
|
paramLog.setProductSn(sn.getProductSn());
|
|
|
|
|
paramLog.setWorkCellCode(reqBean.getWorkCellCode());
|
|
|
|
|
paramLog.setWorkCenterCode(reqBean.getWorkCenterCode());
|
|
|
|
|
paramLog.setEquipId(cellEquipContext.getEquipId());
|
|
|
|
|
paramLog.setEquipmentCode(cellEquipContext.getEquipmentCode());
|
|
|
|
|
paramLog.setEquipmentName(cellEquipContext.getEquipmentName());
|
|
|
|
|
if (prodRuleContext.getProductionRecordId() != null) {
|
|
|
|
|
MesProductionRecord productionRecord = productionRecordRDao.getById(prodRuleContext.getProductionRecordId());
|
|
|
|
|
if (productionRecord != null) {
|
|
|
|
|
paramLog.setStartDateTime(productionRecord.getStartDateTime());
|
|
|
|
|
paramLog.setCompleteDateTime(productionRecord.getCompleteDateTime());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//遍历装配件清单
|
|
|
|
|
for (MesProductionAssemblyNosortContext productionAssemblyNosortContext : productionAssemblyNosortContextList) {
|
|
|
|
|
String assemblyPartNo = productionAssemblyNosortContext.getAssemblyPartNo();
|
|
|
|
@ -143,8 +149,7 @@ public class MesGlueSprayedAmountStepService extends BaseStepService {
|
|
|
|
|
ConvertBean.serviceModelInitialize(paramLog, reqBean.getUserInfo());
|
|
|
|
|
equipVarParamLogRDao.insert(paramLog);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "统计每摸模自动喷胶量!");
|
|
|
|
|
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "统计每模自动喷胶量!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取设备变量ID对应的变量参数类型
|
|
|
|
|