forked from I3-YF/i3plus-mes-pcn-yfai
Merge remote-tracking branch 'origin/uat-temp-nht-2506120000-jialiao' into mes-uat-changshu0609-temp-wj-250616-xisu-merge-nht
commit
431c38f550
@ -0,0 +1,7 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.api.busi;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesAutoLineInterfaceModel;
|
||||
|
||||
public interface IMesEquipmentProductionResultService {
|
||||
void doCreateEquipmentProductionResult(MesAutoLineInterfaceModel info);
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.api.busi;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionAssemblyContext;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionAssemblyNosortContext;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IMesRawSnWeightRecordService {
|
||||
void insertRawRemainWeightRecord(MesProductionPsOutContext productionPsOutContext, MesProductionAssemblyContext context, String organizeCode, String username);
|
||||
void insertOutPartNoWeightRecord(MesProductionPsOutContext productionPsOutContext, List<MesProductionAssemblyNosortContext> productionAssemblyNosortContextList, String organizeCode, String username);
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEquipmentProductionResultService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesAutoLineInterfaceDetailModel;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesAutoLineInterfaceModel;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
||||
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.IShippingDispatchService;
|
||||
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
||||
import cn.estsh.i3plus.platform.common.util.MesPcnConstWords;
|
||||
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesConfig;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentProductionResult;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentProductionResultDetail;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesConfigRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentProductionResultDetailRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentProductionResultRepository;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class MesEquipmentProductionResultServiceImpl implements IMesEquipmentProductionResultService {
|
||||
public static final Logger log = LoggerFactory.getLogger(MesEquipmentProductionResultServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private IShippingDispatchService shippingDispatchService;
|
||||
@Autowired
|
||||
private MesConfigRepository configRao;
|
||||
@Autowired
|
||||
private MesEquipmentProductionResultRepository resultRDao;
|
||||
@Autowired
|
||||
private MesEquipmentProductionResultDetailRepository resultDetailRDao;
|
||||
|
||||
@Override
|
||||
public void doCreateEquipmentProductionResult(MesAutoLineInterfaceModel info) {
|
||||
String organizeCode = "";
|
||||
DdlPackBean packBean = DdlPackBean.getDdlPackBean();
|
||||
DdlPreparedPack.getStringEqualPack(MesPcnExtConstWords.CHANG_SHU_AUTO_LINE_INTERFACE,"cfgCode",packBean);
|
||||
List<MesConfig> configList = configRao.findByHqlWhere(packBean);
|
||||
for (MesConfig mesConfig : configList) {
|
||||
if (mesConfig.getCfgKey().equals(MesPcnExtConstWords.CHANG_SHU_ORGANIZE_CODE)){
|
||||
organizeCode = mesConfig.getCfgValue();
|
||||
}
|
||||
}
|
||||
if (StringUtils.isEmpty(organizeCode)) {
|
||||
log.error("没有配置表mes_config,cfg_code为CHANG_SHU_AUTO_LINE_INTERFACE,key为CHANG_SHU_ORGANIZE_CODE没有配置");
|
||||
return;
|
||||
}
|
||||
StationRequestBean reqBean = new StationRequestBean(organizeCode, info.getWorkCenterCode(), info.getWorkCellCode(), "webservices");
|
||||
reqBean.setBusiType(MesPcnEnumUtil.ACTOR_RECEIVE_STRATEGY.WS_CMD_DO_SCAN.getCode());
|
||||
reqBean.setInterfaceType(MesPcnConstWords.SHIPPING);
|
||||
reqBean.setScanInfo(info.getProductSn());
|
||||
shippingDispatchService.sendScanQueueNextExec(reqBean);
|
||||
|
||||
MesEquipmentProductionResult result = new MesEquipmentProductionResult();
|
||||
result.setOrganizeCode(organizeCode);
|
||||
result.setWorkCenterCode(info.getWorkCenterCode());
|
||||
result.setWorkCellCode(info.getWorkCellCode());
|
||||
result.setProductSn(info.getProductSn());
|
||||
result.setQty(info.getQty());
|
||||
result.setResult(info.getResult());
|
||||
ConvertBean.serviceModelInitialize(result, "webservices");
|
||||
resultRDao.insert(result);
|
||||
|
||||
if (!CollectionUtils.isEmpty(info.getDetails())) {
|
||||
for (MesAutoLineInterfaceDetailModel detailModel : info.getDetails()) {
|
||||
MesEquipmentProductionResultDetail detail = new MesEquipmentProductionResultDetail();
|
||||
detail.setOrganizeCode(organizeCode);
|
||||
detail.setResultId(result.getId());
|
||||
detail.setBarCode(detailModel.getBarCode());
|
||||
detail.setWorkCellCode(detailModel.getWorkCellCode());
|
||||
detail.setType(detailModel.getType());
|
||||
detail.setParamName(detailModel.getParamName());
|
||||
detail.setParamValue(detailModel.getParamValue());
|
||||
ConvertBean.serviceModelInitialize(detail, "webservices");
|
||||
resultDetailRDao.insert(detail);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesPartService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesRawSnWeightRecordService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdRuleContext;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionAssemblyContext;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionAssemblyNosortContext;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext;
|
||||
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.*;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesRawMixCfgDetailRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesRawSnWeightRecordLogRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesRawSnWeightRecordRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesRawWeightCfgRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class MesRawSnWeightRecordServiceImpl implements IMesRawSnWeightRecordService {
|
||||
@Autowired
|
||||
private MesRawSnWeightRecordRepository rawSnWeightRecordRDao;
|
||||
@Autowired
|
||||
private MesRawWeightCfgRepository rawWeightCfgRDao;
|
||||
@Autowired
|
||||
private MesRawMixCfgDetailRepository rawMixCfgDetailRDao;
|
||||
@Autowired
|
||||
private IMesPartService partService;
|
||||
@Autowired
|
||||
private MesRawSnWeightRecordLogRepository rawSnWeightRecordLogRDao;
|
||||
|
||||
@Override
|
||||
public void insertRawRemainWeightRecord(MesProductionPsOutContext productionPsOutContext, MesProductionAssemblyContext context, String organizeCode, String username) {
|
||||
MesRawMixCfgDetail detail = rawMixCfgDetailRDao.getByProperty(
|
||||
new String[]{"organizeCode", "isValid", "isDeleted", "outPartNo", "partNo"},
|
||||
new Object[]{organizeCode, CommonEnumUtil.IS_VAILD.VAILD.getValue(), CommonEnumUtil.IS_DEAL.NO.getValue(), context.getPartNo(), context.getAssemblyPartNo()});
|
||||
if (detail == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
MesRawWeightCfg weightCfg = rawWeightCfgRDao.getByProperty(new String[]{"organizeCode", "isValid", "isDeleted", "partNo"},
|
||||
new Object[]{organizeCode, CommonEnumUtil.IS_VAILD.VAILD.getValue(), CommonEnumUtil.IS_DEAL.NO.getValue(), context.getAssemblyPartNo()});
|
||||
if (weightCfg == null) {
|
||||
return;
|
||||
}
|
||||
double remainQty = getRemainQty(organizeCode, context.getAssemblyPartNo(), context.getAssemblySn());
|
||||
double weightQty = context.getQty() != null ? context.getQty() : 0;
|
||||
// 保留两位小数,四舍五入
|
||||
MathContext mc = new MathContext(8, RoundingMode.HALF_UP);
|
||||
BigDecimal decimalRemainQty = new BigDecimal(remainQty, mc);
|
||||
BigDecimal decimalWeight = new BigDecimal(weightQty, mc);
|
||||
|
||||
MesRawSnWeightRecord record = new MesRawSnWeightRecord();
|
||||
record.setOrganizeCode(organizeCode);
|
||||
record.setBarCode(context.getAssemblySn());
|
||||
record.setPartNo(context.getAssemblyPartNo());
|
||||
record.setPartName(context.getAssemblyPartName());
|
||||
// record.setNetWeight(remainQty - context.getQty());
|
||||
record.setNetWeight(decimalRemainQty.subtract(decimalWeight).doubleValue());
|
||||
record.setNetUnit(weightCfg.getNetUnit());
|
||||
record.setRawType(detail.getRawType());
|
||||
ConvertBean.serviceModelInitialize(record, username);
|
||||
rawSnWeightRecordRDao.insert(record);
|
||||
|
||||
MesRawSnWeightRecordLog recordLog = new MesRawSnWeightRecordLog();
|
||||
recordLog.setOrganizeCode(organizeCode);
|
||||
recordLog.setProductSn(productionPsOutContext.getProductSn());
|
||||
recordLog.setPartNo(productionPsOutContext.getPartNo());
|
||||
recordLog.setPartName(productionPsOutContext.getPartName());
|
||||
recordLog.setAssemblySn(context.getAssemblySn());
|
||||
recordLog.setAssemblyPartNo(context.getAssemblyPartNo());
|
||||
recordLog.setAssemblyPartName(context.getAssemblyPartName());
|
||||
recordLog.setOriginWeight(remainQty);
|
||||
recordLog.setDeductionWeight(context.getQty());
|
||||
recordLog.setRemainWeight(record.getNetWeight());
|
||||
ConvertBean.serviceModelInitialize(recordLog, username);
|
||||
rawSnWeightRecordLogRDao.insert(recordLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertOutPartNoWeightRecord(MesProductionPsOutContext productionPsOutContext, List<MesProductionAssemblyNosortContext> productionAssemblyNosortContextList, String organizeCode, String username) {
|
||||
MesPart mesPart = partService.getMesPartByPartNo(productionPsOutContext.getPartNo(), organizeCode);
|
||||
if (mesPart == null) {
|
||||
return;
|
||||
}
|
||||
double totalWeight = 0.0;
|
||||
for (MesProductionAssemblyNosortContext context : productionAssemblyNosortContextList) {
|
||||
if (Objects.equals(context.getMatchType(), MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_90.getValue())) {
|
||||
totalWeight += context.getQty();
|
||||
}
|
||||
}
|
||||
|
||||
MesRawSnWeightRecord record = new MesRawSnWeightRecord();
|
||||
record.setOrganizeCode(organizeCode);
|
||||
record.setBarCode(productionPsOutContext.getProductSn());
|
||||
record.setPartNo(mesPart.getPartNo());
|
||||
record.setPartName(mesPart.getPartName());
|
||||
record.setNetWeight(totalWeight);
|
||||
record.setNetUnit(mesPart.getWeightUom());
|
||||
record.setRawType(MesExtEnumUtil.RAW_MIX_DETAIL_TYPE.RAW_MIX_DETAIL_TYPE_10.getValue());
|
||||
ConvertBean.serviceModelInitialize(record, username);
|
||||
rawSnWeightRecordRDao.insert(record);
|
||||
}
|
||||
|
||||
private double getRemainQty(String organizeCode, String partNo, String barcode) {
|
||||
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
||||
DdlPreparedPack.getStringEqualPack(partNo, "partNo", ddlPackBean);
|
||||
DdlPreparedPack.getStringEqualPack(barcode, "barCode", ddlPackBean);
|
||||
DdlPreparedPack.getOrderBy("createDatetime", CommonEnumUtil.ASC_OR_DESC.DESC.getValue(), ddlPackBean);
|
||||
MesRawSnWeightRecord record = rawSnWeightRecordRDao.getByProperty(ddlPackBean);
|
||||
if (record != null) {
|
||||
return record.getNetWeight();
|
||||
}
|
||||
|
||||
MesRawWeightCfg weightCfg = rawWeightCfgRDao.getByProperty(new String[]{"organizeCode", "isValid", "isDeleted", "partNo"},
|
||||
new Object[]{organizeCode, CommonEnumUtil.IS_VAILD.VAILD.getValue(), CommonEnumUtil.IS_DEAL.NO.getValue(), partNo});
|
||||
if (weightCfg == null) {
|
||||
return 0.0;
|
||||
}
|
||||
return weightCfg.getNetWeight();
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
|
||||
|
||||
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.MesProductionProcessContext;
|
||||
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Description : 自动化线接口获取生产数据
|
||||
* @Author : jason.niu
|
||||
**/
|
||||
@Slf4j
|
||||
@Service("mesEquipmentLProductionResultStepService")
|
||||
public class MesEquipmentLProductionResultStepService extends BaseStepService {
|
||||
@Autowired
|
||||
private IMesProductionProcessContextStepService productionProcessContextStepService;
|
||||
|
||||
@Autowired
|
||||
private IMesProductionDispatchContextStepService productionDispatchContextStepService;
|
||||
|
||||
@Override
|
||||
public StepResult execute(StationRequestBean reqBean) {
|
||||
|
||||
StationResultBean resultBean = new StationResultBean();
|
||||
|
||||
StepResult stepResult = StepResult.getSuccessComplete();
|
||||
final String organizeCode = reqBean.getOrganizeCode();
|
||||
|
||||
//获取工位当前设备信息
|
||||
MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchCurCellEquipment(reqBean);
|
||||
|
||||
//配置错误 抛出异常
|
||||
if (!productionProcessContext.getSuccess()) {
|
||||
stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage());
|
||||
}
|
||||
|
||||
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "收集自动化线生产结果成功!");
|
||||
}
|
||||
}
|
@ -0,0 +1,170 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEquipmentLogExtService;
|
||||
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.*;
|
||||
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.tool.DdlPreparedPack;
|
||||
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.*;
|
||||
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description : 统计每摸模自动喷胶量
|
||||
* @Author : jason.niu
|
||||
**/
|
||||
@Slf4j
|
||||
@Service("mesGlueSprayedAmountStepService")
|
||||
public class MesGlueSprayedAmountStepService extends BaseStepService {
|
||||
@Autowired
|
||||
private IMesProductionProcessContextStepService productionProcessContextStepService;
|
||||
@Autowired
|
||||
private IMesProductionDispatchContextStepService productionDispatchContextStepService;
|
||||
@Autowired
|
||||
private IMesEquipmentLogExtService equipmentLogExtService;
|
||||
@Autowired
|
||||
private MesEquipmentVariableParamRepository equipVarParamRDao;
|
||||
@Autowired
|
||||
private MesRawMixCfgDetailRepository rawMixCfgDetailRDao;
|
||||
@Autowired
|
||||
private MesEquipmentVariableParamLogRepository equipVarParamLogRDao;
|
||||
@Autowired
|
||||
private MesPartRepository mesPartRDao;
|
||||
@Autowired
|
||||
private MesProductionRecordRepository productionRecordRDao;
|
||||
|
||||
@Override
|
||||
public StepResult execute(StationRequestBean reqBean) {
|
||||
StationResultBean resultBean = new StationResultBean();
|
||||
|
||||
StepResult stepResult = StepResult.getSuccessComplete();
|
||||
final String organizeCode = reqBean.getOrganizeCode();
|
||||
|
||||
//获取工位当前设备信息
|
||||
MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchCurCellEquipment(reqBean);
|
||||
|
||||
//配置错误 抛出异常
|
||||
if (!productionProcessContext.getSuccess()) {
|
||||
stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage());
|
||||
}
|
||||
|
||||
//获取上下文产品加工规则数据信息集合
|
||||
List<MesProdRuleContext> prodRuleContextList = productionDispatchContextStepService.getProdRuleDataContext(reqBean);
|
||||
if (CollectionUtils.isEmpty(prodRuleContextList)) {
|
||||
stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前不存在产品加工规则信息,请重置工序解决!");
|
||||
}
|
||||
Map<Integer, List<MesProdRuleContext>> prodRuleContextMap = prodRuleContextList.stream().collect(Collectors.groupingBy(MesProdRuleContext::getForeignKey));
|
||||
|
||||
//当前工位使用的设备
|
||||
MesCellEquipContext cellEquipContext = productionProcessContext.getCurCellEquip();
|
||||
Map<Long, String> equipVariableIds = getEquipmentVariable(organizeCode, cellEquipContext.getEquipId());
|
||||
if (CollectionUtils.isEmpty(equipVariableIds)) {
|
||||
stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), String.format("设备ID[%s]未匹配到设备变量参数,请检查数据!", cellEquipContext.getEquipId()));
|
||||
}
|
||||
List<MesEquipVariableCollectContext> variableContexts = equipmentLogExtService.getEquipmentLogCollectList(organizeCode, cellEquipContext.getEquipId(), MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.FALSE.getValue(), MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PROCESS_FINISH.getValue(), new ArrayList<>(equipVariableIds.keySet()));
|
||||
if (CollectionUtils.isEmpty(variableContexts)) {
|
||||
stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), String.format("设备ID[%s]未获取到设备数据,请检查数据!", cellEquipContext.getEquipId()));
|
||||
}
|
||||
Map<String, String> variableMap = new HashMap<>();
|
||||
for (MesEquipVariableCollectContext context : variableContexts) {
|
||||
String variableParamType = equipVariableIds.get(context.getEquipVariableId());
|
||||
if (!StringUtils.isEmpty(variableParamType)) {
|
||||
variableMap.put(variableParamType, context.getEquipVariableValue());
|
||||
}
|
||||
}
|
||||
|
||||
//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();
|
||||
|
||||
MesEquipmentVariableParamLog paramLog = new MesEquipmentVariableParamLog();
|
||||
paramLog.setOrganizeCode(reqBean.getOrganizeCode());
|
||||
paramLog.setPartNo(prodRuleContext.getOutPartNo());
|
||||
MesPart mesPart = mesPartRDao.getByProperty(new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.PART_NO},
|
||||
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), prodRuleContext.getOutPartNo()});
|
||||
if (mesPart != null) {
|
||||
paramLog.setPartName(mesPart.getPartName());
|
||||
}
|
||||
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();
|
||||
MesRawMixCfgDetail detail = rawMixCfgDetailRDao.getByProperty(
|
||||
new String[]{"organizeCode", "isValid", "isDeleted", "outPartNo", "partNo"},
|
||||
new Object[]{organizeCode, CommonEnumUtil.IS_VAILD.VAILD.getValue(), CommonEnumUtil.IS_DEAL.NO.getValue(), prodRuleContext.getOutPartNo(), productionAssemblyNosortContext.getAssemblyPartNo()});
|
||||
if (detail == null) {
|
||||
continue;
|
||||
}
|
||||
Integer rawType = detail.getRawType();
|
||||
if (Objects.equals(rawType, MesExtEnumUtil.RAW_MIX_DETAIL_TYPE.RAW_MIX_DETAIL_TYPE_10.getValue())) {
|
||||
paramLog.setGluePartNo(assemblyPartNo);
|
||||
} else if (Objects.equals(rawType, MesExtEnumUtil.RAW_MIX_DETAIL_TYPE.RAW_MIX_DETAIL_TYPE_20.getValue())) {
|
||||
paramLog.setCuringPartNo(assemblyPartNo);
|
||||
} else if (Objects.equals(rawType, MesExtEnumUtil.RAW_MIX_DETAIL_TYPE.RAW_MIX_DETAIL_TYPE_30.getValue())) {
|
||||
paramLog.setAdhesivePartNo(assemblyPartNo);
|
||||
} else if (Objects.equals(rawType, MesExtEnumUtil.RAW_MIX_DETAIL_TYPE.RAW_MIX_DETAIL_TYPE_40.getValue())) {
|
||||
paramLog.setInkPartNo(assemblyPartNo);
|
||||
} else if (Objects.equals(rawType, MesExtEnumUtil.RAW_MIX_DETAIL_TYPE.RAW_MIX_DETAIL_TYPE_50.getValue())) {
|
||||
paramLog.setDiluentPartNo(assemblyPartNo);
|
||||
}
|
||||
}
|
||||
paramLog.setParamValue(JSONUtil.toJsonStr(variableMap));
|
||||
ConvertBean.serviceModelInitialize(paramLog, reqBean.getUserInfo());
|
||||
equipVarParamLogRDao.insert(paramLog);
|
||||
}
|
||||
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "统计每模自动喷胶量!");
|
||||
}
|
||||
|
||||
// 获取设备变量ID对应的变量参数类型
|
||||
private Map<Long, String> getEquipmentVariable(String organizeCode, Integer equipId) {
|
||||
Map<Long, String> result = new HashMap<>();
|
||||
if (equipId != null) {
|
||||
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
||||
DdlPreparedPack.getNumEqualPack(equipId, "equipId", packBean);
|
||||
DdlPreparedPack.getIsNotNull("equipVariableId", packBean);
|
||||
DdlPreparedPack.getIsNotNull("paramType", packBean);
|
||||
List<MesEquipmentVariableParam> variableParams = equipVarParamRDao.findByHqlWhere(packBean);
|
||||
for (MesEquipmentVariableParam param : variableParams) {
|
||||
result.put(param.getEquipVariableId().longValue(), param.getParamType());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEquipmentProductionResultService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesAutoLineInterfaceModel;
|
||||
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.jws.WebMethod;
|
||||
import javax.jws.WebParam;
|
||||
import javax.jws.WebService;
|
||||
|
||||
@WebService(targetNamespace = "http://tempuri.org/services/SyncSPSForEquipmentService")
|
||||
public class WebServiceServerAutoLineInterface {
|
||||
public static final Logger log = LoggerFactory.getLogger(WebServiceServerAutoLineInterface.class);
|
||||
|
||||
@WebMethod(action = "sendMessage", operationName = "sendMessage")
|
||||
public void sendMessage(@WebParam(name = "info") MesAutoLineInterfaceModel info) {
|
||||
IMesEquipmentProductionResultService service = SpringContextsUtil.getBean(IMesEquipmentProductionResultService.class);
|
||||
service.doCreateEquipmentProductionResult(info);
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.pojo.model;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
/**
|
||||
* @author jason
|
||||
*/
|
||||
//@Getter
|
||||
//@Setter
|
||||
//@NoArgsConstructor // 显式生成无参构造函数(关键)
|
||||
//@AllArgsConstructor // 同时保留带参构造函数
|
||||
public class MesAutoLineInterfaceDetailModel {
|
||||
@ApiParam("类型")
|
||||
private Integer type;
|
||||
|
||||
@ApiParam(value = "工位代码")
|
||||
private String workCellCode;
|
||||
|
||||
@ApiParam(value = "条码")
|
||||
private String barCode;
|
||||
|
||||
@ApiParam(value = "参数值")
|
||||
private String paramValue;
|
||||
|
||||
@ApiParam(value = "参数名")
|
||||
private String paramName;
|
||||
|
||||
@XmlElement(name = "Type")
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@XmlElement(name = "Location")
|
||||
public String getWorkCellCode() {
|
||||
return workCellCode;
|
||||
}
|
||||
|
||||
public void setWorkCellCode(String workCellCode) {
|
||||
this.workCellCode = workCellCode;
|
||||
}
|
||||
|
||||
@XmlElement(name = "Barcode")
|
||||
public String getBarCode() {
|
||||
return barCode;
|
||||
}
|
||||
|
||||
public void setBarCode(String barCode) {
|
||||
this.barCode = barCode;
|
||||
}
|
||||
|
||||
@XmlElement(name = "ParamValue")
|
||||
public String getParamValue() {
|
||||
return paramValue;
|
||||
}
|
||||
|
||||
public void setParamValue(String paramValue) {
|
||||
this.paramValue = paramValue;
|
||||
}
|
||||
|
||||
@XmlElement(name = "ParamName")
|
||||
public String getParamName() {
|
||||
return paramName;
|
||||
}
|
||||
|
||||
public void setParamName(String paramName) {
|
||||
this.paramName = paramName;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue