Merge remote-tracking branch 'origin/dev' into dev

tags/yfai-pcn-ext-v1.0
臧学普 10 months ago
commit ea346dc813

@ -17,4 +17,7 @@ public interface IMesPartShippingGroupService {
@ApiOperation(value = "查询发运组数据")
public List<MesPartShippingGroup> findAll(DdlPackBean packBean);
@ApiOperation(value = "查询发运组数据")
MesPartShippingGroup getMesPartShippingGroup(String organizeCode,String shippingGroupCode);
}

@ -124,6 +124,9 @@ public interface IMesProductionProcessContextStepService {
@ApiOperation(value = "获取上下文工位扫描监控信息")
MesScanMonitorContext getScanMonitorContext(String organizeCode, String workCenterCode, String workCellCode);
@ApiOperation(value = "获取上下文工位扫描监控信息的开模记录ID")
String getScanMonitorContextMouldRecordId(StationRequestBean reqBean);
@ApiOperation(value = "删除上下文工位扫描监控信息")
void deleteScanMonitorContext(StationRequestBean reqBean);

@ -9,12 +9,14 @@ import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
import java.util.List;
@ConditionalOnExpression("'${pcn.mqtt.flag:false}' == 'true'")
@Slf4j
@Configuration
public class MqttConfig {

@ -11,6 +11,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
*
*/
@ -19,7 +21,8 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping(MesCommonConstant.MES_YANFEN + "/mqtt")
@Slf4j
public class PcnMqttController {
@Autowired
@Autowired(required = false)
private MqttService mqttService;
@GetMapping("/addTopic")

@ -27,7 +27,7 @@ public class PcnMqttCallback implements MqttCallbackExtended {
private static ExecutorService executorService = new ThreadPoolExecutor(1, 20,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(200), r -> {
new LinkedBlockingQueue<>(10000), r -> {
Thread thread = new Thread(r);
thread.setName("executorService--"+r.hashCode());
return thread;
@ -35,7 +35,7 @@ public class PcnMqttCallback implements MqttCallbackExtended {
private static ExecutorService executorServiceTwo = new ThreadPoolExecutor(1, 20,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(200), r -> {
new LinkedBlockingQueue<>(10000), r -> {
Thread thread = new Thread(r);
thread.setName("executorServiceTwo--"+r.hashCode());
return thread;

@ -36,6 +36,7 @@ public class MesWorkCellOperationLogJob extends BaseMesScheduleJob {
@Override
public void executeMesJob(JobExecutionContext context, ApplicationProperties applicationProperties) {
if (true) return;
/**
*
* {

@ -157,15 +157,24 @@ public class MesEquipmentLogService implements IMesEquipmentLogService {
@Override
public void updateValue(EquipLogMqttMsg equipLogMqttMsg) {
log.info("== equipLogMqttMsg ==> messageArrived ,异步处理开始 消息内容: {}", equipLogMqttMsg);
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(equipLogMqttMsg.getKey(), "tagName", ddlPackBean);
DdlPreparedPack.getNumEqualPack(Integer.valueOf(equipLogMqttMsg.getPTCode()), "equipId", ddlPackBean);
log.info("== mesEquipmentVariable查询开始");
MesEquipmentVariable mesEquipmentVariable = equipmentVariableRepository.getByProperty(ddlPackBean);
log.info("== mesEquipmentVariable查询结束");
if (mesEquipmentVariable == null) {
LOGGER.info("tagAddress 不存在【{}】", equipLogMqttMsg.getTagAddress());
}
log.info("== MesEquipmentLog查询开始");
MesEquipmentLog equipmentLog = mesEquipmentLogExtService.queryMesEquipmentLog(mesEquipmentVariable.getOrganizeCode(), Integer.valueOf(equipLogMqttMsg.getPTCode()), mesEquipmentVariable.getId());
log.info("== MesEquipmentLog查询结束");
/*ConvertBean.serviceModelUpdate(equipmentLog, "mqtt");
equipmentLog.setEquipVariableValue(equipLogMqttMsg.getValue());
equipmentLog.setEquipVariableStatus(MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getEquipVariableStatus());
@ -174,13 +183,18 @@ public class MesEquipmentLogService implements IMesEquipmentLogService {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(mesEquipmentVariable.getOrganizeCode());
DdlPreparedPack.getNumEqualPack(equipmentLog.getEquipId(), MesPcnExtConstWords.EQUIP_ID, packBean);
DdlPreparedPack.getNumEqualPack(equipmentLog.getEquipVariableId(), MesPcnExtConstWords.EQUIP_VARIABLE_ID, packBean);
log.info("== MesEquipmentLog修改开始");
mesEquipmentLogRepository.updateByProperties(new String[]{MesPcnExtConstWords.EQUIP_VARIABLE_STATUS,"equipVariableValue"}, new Object[]{MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue(),equipLogMqttMsg.getValue() }, packBean);
log.info("== MesEquipmentLog修改结束");
MesEquipmentLogDetail mesEquipmentLogDetail = new MesEquipmentLogDetail();
BeanUtils.copyProperties(equipmentLog, mesEquipmentLogDetail);
ConvertBean.serviceModelInitialize(mesEquipmentLogDetail, "mqtt");
mesEquipmentLogDetailRepository.saveAll(Arrays.asList(mesEquipmentLogDetail));
log.info("== mesEquipmentLogDetail新增开始");
mesEquipmentLogDetailRepository.insert(mesEquipmentLogDetail);
log.info("== mesEquipmentLogDetail新增结束");
log.info("== equipLogMqttMsg ==> messageArrived ,异步处理结束 消息内容: {}", equipLogMqttMsg);
}
}

@ -98,7 +98,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
//检查物料
MesPart part;
//获取NC-零件检测-单据
MesPartInspection partInspection;
MesPartInspection partInspection = null;
Integer sourceType = null;
if (!StringUtils.isEmpty(inputModel.getSn())) {
// 数据校验
@ -125,7 +125,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
part = checkPartByPartNo(inputModel.getPartNo(), org);
//获取NC-零件检测-单据
partInspection = getPartInspectionByPartAndLot(inputModel, org);
if(!Objects.isNull(inputModel.getId())){
partInspection = getPartInspectionByPartAndLot(inputModel, org);
}
sourceType = MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.LOT.getValue();
}
@ -206,16 +208,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
MesPartInspection partInspection;
//返工单返修完成,需可疑品移正常库
if (model.isTransferFlg()) {
String srcLocate = configService.getCfgValue(org, "UMLGO");
if(!Objects.isNull(model.getPartInspection())){
MesMove mesMove = getMesMove(model, org);
if(!Objects.isNull(mesMove)){
srcLocate = mesMove.getUmlgo();
}
}
if (model.isTransferFlg() && model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) {
//移库
MesMove move = createMove(model,srcLocate,configService.getCfgValue(org, "LGORT"), org);
MesMove move = createMove(model,getDestLocateNo(model, org),configService.getCfgValue(org, "LGORT"), org);
moveRepository.save(move);
}
@ -332,16 +327,21 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
partInspectionDetailRepository.saveAll(model.getPartInspectionDetailList());
String srcLocateNo = null;
//若是扫描条码 则判定条码可疑
if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) {
MesProduceSn produceSn = checkProduceSn(model.getSn(), org);
produceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue());
ConvertBean.serviceModelInitialize(produceSn, AuthUtil.getSessionUser().getUserName());
produceSnExtService.update(produceSn);
//查询条码所在库位
srcLocateNo = getDestLocateNo(model, org);
}
if (Objects.isNull(srcLocateNo)) {
srcLocateNo = configService.getCfgValue(org, "LGORT");
}
//移库
MesMove move = createMove(model, configService.getCfgValue(org, "LGORT"), configService.getCfgValue(org, "UMLGO"), org);
MesMove move = createMove(model,srcLocateNo, configService.getCfgValue(org, "UMLGO"), org);
moveRepository.save(move);
} else {
@ -399,12 +399,19 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
}
}
private String getDestLocateNo(MesPartInspectionInputModel model, String org) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
DdlPreparedPack.getStringEqualPack(model.getSn(), "productSn", packBean);
DdlPreparedPack.getOrderBy(null, null, packBean);
MesMove mesMove = moveRepository.getByProperty(packBean);
return Objects.isNull(mesMove) ? null : mesMove.getUmlgo();
}
private MesMove getMesMove(MesPartInspectionInputModel model, String org) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
DdlPreparedPack.getNumEqualPack(model.getPartInspection().getId(),"partInspectionId",packBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.MOVE_TYPE.RETURN_MOVE.getValue(),"moveType",packBean);
MesMove mesMove = moveRepository.getByProperty(packBean);
return mesMove;
return moveRepository.getByProperty(packBean);
}
/**
@ -438,6 +445,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
private MesPartInspection getPartInspectionByPartAndLot(MesPartInspectionInputModel inputModel, String org) {
//根据扫描的条码查询条码是否存在
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
DdlPreparedPack.getNumEqualPack(inputModel.getId(), "id", packBean);
DdlPreparedPack.getStringEqualPack(inputModel.getPartNo(), "partNo", packBean);
DdlPreparedPack.getStringEqualPack(inputModel.getLotNo(), "lotNo", packBean);
DdlPreparedPack.getNumEqualPack(inputModel.getQty().intValue(), "qty", packBean);

@ -24,4 +24,11 @@ public class MesPartShippingGroupService implements IMesPartShippingGroupService
return detailDeleteList;
}
@Override
public MesPartShippingGroup getMesPartShippingGroup(String organizeCode, String shippingGroupCode) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(shippingGroupCode, "shippingGroupCode", packBean);
return shippingGroupRepository.getByProperty(packBean);
}
}

@ -10,6 +10,7 @@ import cn.estsh.i3plus.platform.common.tool.TimeTool;
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.MesPartShippingGroup;
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder;
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesLoadingList;
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesLoadingListDetail;
@ -23,9 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.*;
/**
* @Description :
@ -54,6 +53,9 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS
@Autowired
private MesJisShippingRepository jisShippingRepository;
@Autowired
private MesPartShippingGroupService mesPartShippingGroupService;
@Override
public MesShippingLoadingCheckModel queryLoadingOrderNo(MesLoadingList loadingList) {
@ -139,15 +141,24 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS
if (StringUtils.isEmpty(vehiclesOrderDetail)) {
throw new ImppBusiException(String.format("【%s】此发运单不存在或还未生成装车单明细请检查数据", model.getShippingCode()));
}
//查询零件发运组
MesPartShippingGroup shippingGroup = getMesPartShippingGroup(org, loadingList.getPartShippingGroupCode());
//根据扫描的发运单以及前端传的发运单明细,进行匹配,若没有找到扫描的发运单,则提示扫描的发运单号不在此装车单中,请检查数据!。
Boolean scanflg = false;
for (MesLoadingListDetail loadingListDetail : model.getDetailList()) {
if (loadingListDetail.getShippingCode().equals(model.getShippingCode())) {
if (loadingListDetail.getTempStatus() == MesCommonConstant.TRUE_INTEGER) {
if (Objects.equals(loadingListDetail.getTempStatus(), MesCommonConstant.TRUE_INTEGER)) {
throw new ImppBusiException(String.format("【%s】此发运单已经扫描过请检查数据", model.getShippingCode()));
}
//校验发运单明细顺序
if(CommonEnumUtil.VALID == shippingGroup.getIsEnableLoadingFailSafe()){
Optional<MesLoadingListDetail> detail = model.getDetailList().stream().filter(k -> k.getShippingCode().compareTo(loadingListDetail.getShippingCode()) < 0 && !Objects.equals(k.getTempStatus(), MesCommonConstant.TRUE_INTEGER)).findFirst();
if(detail.isPresent()){
throw new ImppBusiException(String.format("装车单【%s】启用明细顺序防错发运单【%s】前还有未扫描的发运单请检查数据", loadingList.getOrderCode(), model.getShippingCode()));
}
}
//判断是否需要排序校验 默认排序则需要校验
if (loadingList.getScanSeqWay() == MesExtEnumUtil.SHIPPING_GROUP_SCAN_CONFIRM_SEQ_MODE.DEFAULT_SORT.getValue()) {
@ -232,6 +243,14 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS
return model;
}
private MesPartShippingGroup getMesPartShippingGroup(String org, String partShippingGroupCode) {
MesPartShippingGroup shippingGroup = mesPartShippingGroupService.getMesPartShippingGroup(org, partShippingGroupCode);
if(Objects.isNull(shippingGroup)){
throw new ImppBusiException(String.format("零件发运组【%s】信息不存在请检查数据", partShippingGroupCode));
}
return shippingGroup;
}
/**
*
*

@ -7,6 +7,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesSortShippingCheckService;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.aspect.MonitorLog;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException;
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingLoadingCheckModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesSortShippingCheckModel;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
@ -15,6 +16,7 @@ import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.base.util.StringUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesJisShipping;
import cn.estsh.i3plus.pojo.mes.bean.MesPartShippingGroup;
import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn;
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesLoadingList;
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesLoadingListDetail;
@ -78,6 +80,9 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService
@Autowired
private MesCustomerPartRepository mesCustomerPartRepository;
@Autowired
private MesPartShippingGroupService mesPartShippingGroupService;
@Override
public MesSortShippingCheckModel queryShippingOrderNo(MesShippingOrderManagement shippingOrderManagement) {
@ -209,13 +214,19 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService
//校验发运单是否存在
MesShippingOrderManagement orderManagement = checkMesShippingOrderManagement(model, org);
//零件发运组
MesPartShippingGroup shippingGroup = getMesPartShippingGroup(org, orderManagement.getShippingGroupCode());
//根据条码找到对应的物料号若物料号一致则修改扫描flg将flg改为true.
boolean scanFlg = false;
for (MesShippingOrderManagementDetail detail : model.getDetailList()) {
if (detail.getPartNo().equals(produceSn.getPartNo()) && StringUtils.isEmpty(detail.getBarcode())) {
//校验发运单明细顺序
if(CommonEnumUtil.VALID == shippingGroup.getIsEnableShippingFailSafe()){
Optional<MesShippingOrderManagementDetail> first = model.getDetailList().stream().filter(k -> k.getCustInfoSeq().compareTo(detail.getCustInfoSeq()) < 0 && !Objects.equals(k.getIsScanFlg(), MesCommonConstant.TRUE_INTEGER)).findFirst();
if(first.isPresent()){
throw new ImppBusiException(String.format("发运单【%s】启用明细顺序防错序号【%s】前还有未扫描的发运单明细请检查数据", orderManagement.getShippingCode(), detail.getCustInfoSeq()));
}
}
//判断是否需要排序校验 默认排序则需要校验
if (orderManagement.getScanSeqWay() == MesExtEnumUtil.SHIPPING_GROUP_SCAN_CONFIRM_SEQ_MODE.DEFAULT_SORT.getValue()) {
@ -332,6 +343,14 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService
}
private MesPartShippingGroup getMesPartShippingGroup(String org, String partShippingGroupCode) {
MesPartShippingGroup shippingGroup = mesPartShippingGroupService.getMesPartShippingGroup(org, partShippingGroupCode);
if(Objects.isNull(shippingGroup)){
throw new ImppBusiException(String.format("零件发运组【%s】信息不存在请检查数据", partShippingGroupCode));
}
return shippingGroup;
}
private MesProduceSn checkSn(MesSortShippingCheckModel model, String org) {
//校验条码是否重复扫描
Optional<MesShippingOrderManagementDetail> optional = model.getDetailList().stream().filter(k -> !StringUtils.isEmpty(k.getBarcode()) && k.getBarcode().equals(model.getSn())).findFirst();
@ -359,7 +378,7 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService
}
private MesShippingOrderManagementDetail getMesShippingOrderManagementDetail(MesSortShippingCheckModel model, String org) {
List<MesShippingOrderManagementDetail> detailList = model.getDetailList().stream().filter(k -> !StringUtils.isEmpty(k.getCustPartNo()) && model.getSn().startsWith(k.getCustPartNo()) && !StringUtils.isEmpty(k.getBarcode())).collect(Collectors.toList());
List<MesShippingOrderManagementDetail> detailList = model.getDetailList().stream().filter(k -> !StringUtils.isEmpty(k.getCustPartNo()) && model.getSn().startsWith(k.getCustPartNo()) && StringUtils.isEmpty(k.getBarcode())).collect(Collectors.toList());
MesShippingOrderManagementDetail mesShippingOrderManagementDetail = null;
for (MesShippingOrderManagementDetail managementDetail : detailList) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);

@ -100,13 +100,16 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService {
if(CollectionUtils.isEmpty(mesEquipmentSpotCheckList)){
return null;
}
Map<String, List<MesEquipmentSpotCheck>> mesEquipmentSpotCheckMap = mesEquipmentSpotCheckList.stream().collect(Collectors.groupingBy(MesEquipmentSpotCheck::getEquipCode));
Map<String, List<MesEquipmentSpotCheck>> mesEquipmentSpotCheckMap = mesEquipmentSpotCheckList.stream().filter(t->!StringUtils.isEmpty(t.getEquipCode())).collect(Collectors.groupingBy(MesEquipmentSpotCheck::getEquipCode));
if(Objects.isNull(mesEquipmentSpotCheckMap)){
return null;
}
List<MesEquipmentSpotCheckModel> mesEquipmentSpotCheckModelList = new ArrayList<>();
for (Map.Entry<String, List<MesEquipmentSpotCheck>> mesEquipmentSpotCheckEntry : mesEquipmentSpotCheckMap.entrySet()) {
MesEquipmentSpotCheck next = mesEquipmentSpotCheckEntry.getValue().iterator().next();
MesEquipmentSpotCheckModel mesEquipmentSpotCheckModel = new MesEquipmentSpotCheckModel();
BeanUtils.copyProperties(next,mesEquipmentSpotCheckModel);
Map<Integer, List<MesEquipmentSpotCheck>> listMap = mesEquipmentSpotCheckEntry.getValue().stream().collect(Collectors.groupingBy(MesEquipmentSpotCheck::getSpotCheckOrderType));
Map<Integer, List<MesEquipmentSpotCheck>> listMap = mesEquipmentSpotCheckEntry.getValue().stream().filter(t->!StringUtils.isEmpty(t.getSpotCheckOrderType())).collect(Collectors.groupingBy(MesEquipmentSpotCheck::getSpotCheckOrderType));
for (Map.Entry<Integer, List<MesEquipmentSpotCheck>> entry : listMap.entrySet()) {
MesEquipmentSpotCheckModel.MesEquipmentSpotCheckDataModel mesEquipmentSpotCheckDataModel = new MesEquipmentSpotCheckModel.MesEquipmentSpotCheckDataModel();
mesEquipmentSpotCheckDataModel.setSpotCheckOrderType(entry.getKey());

@ -1,23 +1,24 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesWorkCellScanMonitorLogService;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
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.MesProductionRecord;
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCellScanMonitorLog;
import cn.estsh.i3plus.pojo.mes.repository.MesProductionRecordRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesWorkCellScanMonitorLogRepository;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import com.netflix.discovery.converters.Auto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
//import cn.estsh.i3plus.platform.common.convert.ConvertBean;
//import cn.estsh.i3plus.platform.common.tool.TimeTool;
//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.MesProductionRecord;
//import cn.estsh.i3plus.pojo.mes.bean.MesWorkCellScanMonitorLog;
//import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
//import com.netflix.discovery.converters.Auto;
//import java.util.List;
//import java.util.Map;
//import java.util.stream.Collectors;
/**
* @Description :
@ -43,44 +44,44 @@ public class MesWorkCellScanMonitorLogServiceImpl implements IMesWorkCellScanMon
*/
@Override
public void doRecordCellOperationLog(String organizeCode, Integer pageSize, Integer times) {
//查询serviceFlag是未处理状态,mouldRecordId不为空的记录每次查询pageSize 默认50条
DdlPackBean logPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.MES_LOG_DEAL_STATUS.UNDEAL.getValue(), "dealStatus", logPackBean);
DdlPreparedPack.getNumberSmallerEqualPack(times, "times", logPackBean);
DdlPreparedPack.getIsNotNull("mouldRecordId", logPackBean);
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{"createDatetime"}, logPackBean);
List<MesWorkCellScanMonitorLog> monitorLogs = monitorLogRao.findByHqlTopWhere(logPackBean, pageSize);
if (!monitorLogs.isEmpty()) {
List<Long> mouldRecordIdList = monitorLogs.stream().map(MesWorkCellScanMonitorLog::getMouldRecordId).distinct().collect(Collectors.toList());
Map<Long, List<MesWorkCellScanMonitorLog>> logs = monitorLogs.stream().collect(Collectors.groupingBy(MesWorkCellScanMonitorLog::getMouldRecordId));
for (Long mouldRecordId : mouldRecordIdList) {
DdlPackBean recordPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getNumEqualPack(mouldRecordId, "mouldRecordId", recordPackBean);
List<MesProductionRecord> recordList = productionRecordRao.findByHqlWhere(recordPackBean);
//需要补录如下字段
DdlPackBean monitorLogPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getNumEqualPack(mouldRecordId, "mouldRecordId", monitorLogPackBean);
int newTimes = logs.get(mouldRecordId).get(0).getTimes() + 1;
if (!recordList.isEmpty()) {
String workOrderNoStr = recordList.stream().map(MesProductionRecord::getWorkOrderNo).collect(Collectors.joining(","));
String serialNoStr = recordList.stream().map(MesProductionRecord::getSerialNumber).collect(Collectors.joining(","));
String productSnStr = recordList.stream().map(MesProductionRecord::getProductSn).collect(Collectors.joining(","));
String custSnStr = recordList.stream().map(MesProductionRecord::getCustSn).collect(Collectors.joining(","));
String partNoStr = recordList.stream().map(MesProductionRecord::getPartNo).collect(Collectors.joining(","));
String partNameStr = recordList.stream().map(MesProductionRecord::getPartName).collect(Collectors.joining(","));
monitorLogRao.updateByProperties(new String[]{"workOrderNo", "serialNumber", "productSn", "custSn", "partNo", "partName", "modifyDatetime", "modifyUser", "dealStatus", "times"},
new Object[]{workOrderNoStr, serialNoStr, productSnStr, custSnStr, partNoStr, partNameStr, TimeTool.getNowTime(true), "JOB", MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_SUCCESS.getValue(), newTimes}, monitorLogPackBean);
} else {
if (newTimes > times) {
monitorLogRao.updateByProperties(new String[]{"modifyDatetime", "modifyUser", "times"}, new Object[]{TimeTool.getNowTime(true), "JOB", newTimes}, monitorLogPackBean);
} else {
monitorLogRao.updateByProperties(new String[]{"modifyDatetime", "modifyUser", "times", "dealStatus"}, new Object[]{TimeTool.getNowTime(true), "JOB", newTimes, MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_FAILURE.getValue()}, monitorLogPackBean);
}
}
}
}
// //查询serviceFlag是未处理状态,mouldRecordId不为空的记录每次查询pageSize 默认50条
// DdlPackBean logPackBean = DdlPackBean.getDdlPackBean(organizeCode);
// DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.MES_LOG_DEAL_STATUS.UNDEAL.getValue(), "dealStatus", logPackBean);
// DdlPreparedPack.getNumberSmallerEqualPack(times, "times", logPackBean);
// DdlPreparedPack.getIsNotNull("mouldRecordId", logPackBean);
// DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{"createDatetime"}, logPackBean);
// List<MesWorkCellScanMonitorLog> monitorLogs = monitorLogRao.findByHqlTopWhere(logPackBean, pageSize);
//
// if (!monitorLogs.isEmpty()) {
// List<Long> mouldRecordIdList = monitorLogs.stream().map(MesWorkCellScanMonitorLog::getMouldRecordId).distinct().collect(Collectors.toList());
// Map<Long, List<MesWorkCellScanMonitorLog>> logs = monitorLogs.stream().collect(Collectors.groupingBy(MesWorkCellScanMonitorLog::getMouldRecordId));
// for (Long mouldRecordId : mouldRecordIdList) {
// DdlPackBean recordPackBean = DdlPackBean.getDdlPackBean(organizeCode);
// DdlPreparedPack.getNumEqualPack(mouldRecordId, "mouldRecordId", recordPackBean);
//
// List<MesProductionRecord> recordList = productionRecordRao.findByHqlWhere(recordPackBean);
// //需要补录如下字段
// DdlPackBean monitorLogPackBean = DdlPackBean.getDdlPackBean(organizeCode);
// DdlPreparedPack.getNumEqualPack(mouldRecordId, "mouldRecordId", monitorLogPackBean);
// int newTimes = logs.get(mouldRecordId).get(0).getTimes() + 1;
// if (!recordList.isEmpty()) {
// String workOrderNoStr = recordList.stream().map(MesProductionRecord::getWorkOrderNo).collect(Collectors.joining(","));
// String serialNoStr = recordList.stream().map(MesProductionRecord::getSerialNumber).collect(Collectors.joining(","));
// String productSnStr = recordList.stream().map(MesProductionRecord::getProductSn).collect(Collectors.joining(","));
// String custSnStr = recordList.stream().map(MesProductionRecord::getCustSn).collect(Collectors.joining(","));
// String partNoStr = recordList.stream().map(MesProductionRecord::getPartNo).collect(Collectors.joining(","));
// String partNameStr = recordList.stream().map(MesProductionRecord::getPartName).collect(Collectors.joining(","));
// monitorLogRao.updateByProperties(new String[]{"workOrderNo", "serialNumber", "productSn", "custSn", "partNo", "partName", "modifyDatetime", "modifyUser", "dealStatus", "times"},
// new Object[]{workOrderNoStr, serialNoStr, productSnStr, custSnStr, partNoStr, partNameStr, TimeTool.getNowTime(true), "JOB", MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_SUCCESS.getValue(), newTimes}, monitorLogPackBean);
// } else {
// if (newTimes > times) {
// monitorLogRao.updateByProperties(new String[]{"modifyDatetime", "modifyUser", "times"}, new Object[]{TimeTool.getNowTime(true), "JOB", newTimes}, monitorLogPackBean);
// } else {
// monitorLogRao.updateByProperties(new String[]{"modifyDatetime", "modifyUser", "times", "dealStatus"}, new Object[]{TimeTool.getNowTime(true), "JOB", newTimes, MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_FAILURE.getValue()}, monitorLogPackBean);
// }
// }
// }
// }
}
}

@ -506,10 +506,13 @@ public class MesWorkOrderService implements IMesWorkOrderService {
DdlPreparedPack.getStringEqualPack(productionRecord.getWorkCenterCode(), "workCenterCode", ddlPackBean);
MesWorkCenter mesWorkCenter = mesWorkCenterRDao.getByProperty(ddlPackBean);
if (Objects.isNull(mesWorkCenter)) {
LOGGER.error(String.format("产线【%s】不存在", productionRecord.getWorkCenterCode()));
throw new ImppBusiException(String.format("产线【%s】不存在", productionRecord.getWorkCenterCode()));
}
MesWorkOrder oldMesWorkOrder = getBestWorkOrder(productionRecord, oldMesWorkOrderList, mesWorkCenter);
if (oldMesWorkOrder == null) {
LOGGER.error(String.format("未找到匹配的加工单"));
throw new ImppBusiException(String.format("未找到匹配的加工单"));
}
//获取生产版本
@ -519,6 +522,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
DdlPreparedPack.getStringEqualPack(oldMesWorkOrder.getProductVersion(), "productVersion", ddlPackBean);
MesProductVersion mesProductVersion = mesProductVersionRDao.getByProperty(ddlPackBean);
if (null == mesProductVersion) {
LOGGER.error(String.format("物料【%s】生产版本信息不存在", productionRecord.getPartNo()));
throw new ImppBusiException(String.format("物料【%s】生产版本信息不存在", productionRecord.getPartNo()));
}
@ -528,6 +532,8 @@ public class MesWorkOrderService implements IMesWorkOrderService {
DdlPreparedPack.getStringEqualPack(mesProductVersion.getAlternativePartList(), "bomVersion", ddlPackBean);
List<MesBom> mesBoms = mesBomRDao.findByHqlWhere(ddlPackBean);
if (CollectionUtils.isEmpty(mesBoms)) {
LOGGER.error(String.format("物料【%s】生产版本【%s】对应bom信息不存在",
productionRecord.getPartNo(), mesProductVersion.getProductVersion()));
throw new ImppBusiException(String.format("物料【%s】生产版本【%s】对应bom信息不存在",
productionRecord.getPartNo(), mesProductVersion.getProductVersion()));
}

@ -1,10 +1,12 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.equiplog;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesScanMonitorContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.swslog.ISwsWriteDbLogService;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
@ -17,8 +19,12 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
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;
import java.util.stream.Collectors;
@Slf4j
@Service
public class MesWorkCellScanMonitorLogExtService implements ISwsWriteDbLogService {
@ -70,6 +76,8 @@ public class MesWorkCellScanMonitorLogExtService implements ISwsWriteDbLogServic
if (resultBean.getIsCheckRepeat().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0) return false;
DdlPackBean packBean = DdlPackBean.getDdlPackBean(resultBean.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(resultBean.getWorkCenterCode(), MesPcnExtConstWords.WORK_CENTER_CODE, packBean);
DdlPreparedPack.getStringEqualPack(resultBean.getWorkCellCode(), MesPcnExtConstWords.WORK_CELL_CODE, packBean);
DdlPreparedPack.getNumEqualPack(scanMonitorContext.getMouldRecordId(), MesPcnExtConstWords.MOULD_RECORD_ID, packBean);
DdlPreparedPack.getStringEqualPack(resultBean.getStepCode(), MesPcnExtConstWords.STEP_CODE, packBean);
if (resultBean.getCheckRepeatType().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0) DdlPreparedPack.getStringEqualPack(resultBean.getMessage(), MesPcnExtConstWords.MESSAGE, packBean);
@ -81,5 +89,33 @@ public class MesWorkCellScanMonitorLogExtService implements ISwsWriteDbLogServic
}
@Override
public void doRestoreDbLog(StationResultBean resultBean) {
if (StringUtils.isEmpty(resultBean.getScanInfo()) || CollectionUtils.isEmpty(resultBean.getResultList())) return;
List<MesProductionPsOutContext> productionPsOutContextList = resultBean.getResultList();
String workOrderNo = productionPsOutContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getWorkOrderNo()))).map(MesProductionPsOutContext::getWorkOrderNo).collect(Collectors.joining(MesPcnExtConstWords.SEMICOLON));
String serialNumber = productionPsOutContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getSerialNumber()))).map(MesProductionPsOutContext::getSerialNumber).collect(Collectors.joining(MesPcnExtConstWords.SEMICOLON));
String productSn = productionPsOutContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getProductSn()))).map(MesProductionPsOutContext::getProductSn).collect(Collectors.joining(MesPcnExtConstWords.SEMICOLON));
String custSn = productionPsOutContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getCustSn()))).map(MesProductionPsOutContext::getCustSn).collect(Collectors.joining(MesPcnExtConstWords.SEMICOLON));
String partNo = productionPsOutContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getPartNo()))).map(MesProductionPsOutContext::getPartNo).collect(Collectors.joining(MesPcnExtConstWords.SEMICOLON));
String partName = productionPsOutContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getPartName()))).map(MesProductionPsOutContext::getPartName).collect(Collectors.joining(MesPcnExtConstWords.SEMICOLON));
DdlPackBean packBean = DdlPackBean.getDdlPackBean(resultBean.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(resultBean.getWorkCenterCode(), MesPcnExtConstWords.WORK_CENTER_CODE, packBean);
DdlPreparedPack.getStringEqualPack(resultBean.getWorkCellCode(), MesPcnExtConstWords.WORK_CELL_CODE, packBean);
DdlPreparedPack.getNumEqualPack(Long.valueOf(resultBean.getScanInfo()), MesPcnExtConstWords.MOULD_RECORD_ID, packBean);
workCellScanMonitorLogRepository.updateByProperties(
new String[]{MesPcnExtConstWords.WORK_ORDER_NO, MesPcnExtConstWords.SERIAL_NUMBER, MesPcnExtConstWords.PRODUCT_SN, MesPcnExtConstWords.CUST_SN,
MesPcnExtConstWords.PART_NO, MesPcnExtConstWords.PART_NAME, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.DEAL_STATUS},
new Object[]{workOrderNo, serialNumber, productSn, custSn,
partNo, partName, TimeTool.getNowTime(true), resultBean.getUserInfo(), MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_SUCCESS.getValue()},
packBean);
}
}

@ -13,11 +13,13 @@ import com.google.common.collect.Lists;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@ConditionalOnExpression("'${pcn.mqtt.flag:false}' == 'true'")
@Service
public class MqttServiceImpl implements MqttService {
@ -152,9 +154,9 @@ public class MqttServiceImpl implements MqttService {
@Override
public void testSendList() {
String start ="[";
for (int i=0; i<100 ; i++) {
String aa = "{\"PTCode\":\"156\",\"key\":\"aa " + i +
"\",\"value\":2,\"time\":\"2024-07-17 16:18:13\"}";
for (int i=0; i<10000 ; i++) {
String aa = "{\"PTCode\":\"300\",\"key\":\"aa499" + i +
"\",\"value\":5,\"time\":\"2024-07-17 16:18:13\"}";
start += aa;
}

@ -4,15 +4,18 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.api.iservice.base.IConfigService;
import cn.estsh.i3plus.mes.pcn.api.iservice.busi.INumberRulePackAttributeStrategyService;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.MesConfig;
import cn.estsh.i3plus.pojo.mes.bean.MesCustomerPart;
import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel;
import cn.estsh.i3plus.pojo.mes.repository.MesCustomerPartRepository;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
@ -24,8 +27,13 @@ import java.util.Map;
**/
@Component
public class GqxnyNumberRuleStrategyService implements INumberRulePackAttributeStrategyService {
@Autowired
private IConfigService configService;
@Autowired
private MesCustomerPartRepository customerPartRepository;
@Override
public GenSerialNoModel execute(GenSerialNoModel genSerialNoModel) {
Date date = new Date();
@ -35,20 +43,27 @@ public class GqxnyNumberRuleStrategyService implements INumberRulePackAttributeS
//零件长号---17位,不足17位 右边补*
//获取客户零件号
Map<String, Object> dataMap = genSerialNoModel.getDataMap();
MesCustomerPart mesCustomerPart = (MesCustomerPart)dataMap.get("mesCustomerPart");
String custPartNo = mesCustomerPart.getCustPartNo();
String custPartNoFormat = stringFormat(custPartNo, 17);
genSerialNoModel.setCustPartNo(custPartNoFormat);
MesCustomerPart customerPart = (!CollectionUtils.isEmpty(dataMap) && dataMap.containsKey(MesCustomerPart.class.getSimpleName())) ?
(MesCustomerPart)dataMap.get(MesCustomerPart.class.getSimpleName()) : getMesCustomerPart(genSerialNoModel.getOrganizeCode(), genSerialNoModel.getPartNo());
if (null != customerPart) {
String custPartNo = customerPart.getCustPartNo();
String custPartNoFormat = stringFormat(custPartNo, 17);
genSerialNoModel.setCustPartNo(custPartNoFormat);
}
//拓展位 2位 00 包含0~9,A~Z 不使用时补“0”填充 {SPILTRULE}
//供应商代码 7位 供应商代码 0~9,A~Z;不足7位 右测补*
MesConfig supplierConfig = configService.getMesConfigByCfgCodeKeyOrg(MesPcnExtConstWords.SUPPLIER_CODE, MesExtEnumUtil.MES_PRINT_TEMPLATE.GQXNY.getValue(), genSerialNoModel.getOrganizeCode());
String supplierCode = supplierConfig.getCfgValue();
String supplierCodeFormat = stringFormat(supplierCode, 7);
genSerialNoModel.setCustCode(supplierCodeFormat);
if (null != supplierConfig) {
String supplierCode = supplierConfig.getCfgValue();
String supplierCodeFormat = stringFormat(supplierCode, 7);
genSerialNoModel.setCustCode(supplierCodeFormat);
}
//扩展位 3位 预留扩展位0~9 A~Z 不使用时,补 0 {SPILTRULE}
//产线 1位 供应商产线号表示由数字1~9 和字母A~Z(I/O除外)组成; {SPILTRULE}
//年月日 6位 yyMMdd 零部件生产日期年月日各2位
String year = TimeTool.pareDateToString("yyMMdd", date);
String year = TimeTool.pareDateToString(MesPcnExtConstWords.DATE_FORMAT_SHORT, date);
genSerialNoModel.setYear(year);
//流水号 4位 采用34进制 0001~ZZZZ (I、O除外)顺位进行标注 (同广汽 & 广新) {serialNo}
//扩展位 4位 预留扩展位信息包含0~9和字母A~Z,不使用时补“0” 填充; {SPILTRULE}
@ -58,7 +73,7 @@ public class GqxnyNumberRuleStrategyService implements INumberRulePackAttributeS
}
private String stringFormat(String data, Integer length) {
return stringFormat(data, length, true, "*");
return stringFormat(data, length, true, MesPcnExtConstWords.ASTERISK);
}
private String stringFormat(String data, Integer length, boolean left, String symbol) {
@ -85,4 +100,11 @@ public class GqxnyNumberRuleStrategyService implements INumberRulePackAttributeS
return dataBuffer.toString();
}
private MesCustomerPart getMesCustomerPart(String orgaizeCode, String partNo) {
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(orgaizeCode);
DdlPreparedPack.getStringEqualPack(partNo, MesPcnExtConstWords.ERP_PART_NO, ddlPackBean);
MesCustomerPart customerPart = customerPartRepository.getByProperty(ddlPackBean);
return customerPart;
}
}

@ -6,9 +6,9 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesEquipVariableCollectContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
@ -35,7 +35,7 @@ public class MesEvcRuleMatchBackValueService implements IMesEquipVariableCfgRule
if (CollectionUtils.isEmpty(backList)) backList = new ArrayList<>();
backList.add(equipVariableCollectContext);
backList.add(filterSpecialChar(equipVariableCollectContext));
}
@ -45,4 +45,16 @@ public class MesEvcRuleMatchBackValueService implements IMesEquipVariableCfgRule
}
//不过滤":"tesla零件号带冒号
//不过滤[)>字符
private MesEquipVariableCollectContext filterSpecialChar(MesEquipVariableCollectContext equipVariableCollectContext) {
String realEquipVariableValue = equipVariableCollectContext.getEquipVariableValue();
String equipVariableValue = StringUtils.removePattern(equipVariableCollectContext.getEquipVariableValue(), "[^A-Z^a-z0-9_^\\s^\\-^/^\\.^\\[^\\)^\\>^\\:]");
return realEquipVariableValue.equals(equipVariableValue) ? equipVariableCollectContext : equipVariableCollectContext.replaceValue(realEquipVariableValue, equipVariableValue);
}
}

@ -450,6 +450,12 @@ public class MesProductionProcessContextStepService extends BaseStepService impl
return !StringUtils.isEmpty(scanMonitorContextJson) ? JSONObject.parseObject(scanMonitorContextJson, MesScanMonitorContext.class) : null;
}
@Override
public String getScanMonitorContextMouldRecordId(StationRequestBean reqBean) {
MesScanMonitorContext scanMonitorContext = getScanMonitorContext(reqBean);
return (null != scanMonitorContext && !StringUtils.isEmpty(scanMonitorContext.getMouldRecordId())) ? scanMonitorContext.getMouldRecordId().toString() : null;
}
private String getContextKey(String organizeCode, String workCenterCode, String workCellCode) {
return new StringJoiner(":").add(organizeCode).add(workCenterCode).add(workCellCode).add(MesPcnExtConstWords.PRODUCTION_PROCESS_CONTEXT).add(MesPcnExtConstWords.BASE_DATA_CONTEXT).toString();
}

@ -3,9 +3,11 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step.context;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionCustomContextStepService;
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.MesProductionPsOutContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.actor.shipping.dispatch.IFsmCommonService;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.process.BaseProcessMonitorService;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.swslog.ISwsWriteDbLogService;
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
@ -29,6 +31,9 @@ public class MesProductionProcessMonitorService extends BaseProcessMonitorServic
@Autowired
private IFsmCommonService fsmCommonService;
@Autowired
private ISwsWriteDbLogService writeDbLogService;
//工序开始
@Override
public Boolean doProcessStart(StationRequestBean requestBean) {
@ -42,6 +47,9 @@ public class MesProductionProcessMonitorService extends BaseProcessMonitorServic
//工序结束
@Override
public Boolean doProcessComplete(StationRequestBean requestBean) {
//补DB日志 [获取开模ID赋值scanInfo] [获取上下文产出条码数据信息集合赋值resultList]
writeDbLogService.doRestoreDbLog(requestBean, new StationResultBean().restoreDbLog().
scanInfo(productionProcessContextStepService.getScanMonitorContextMouldRecordId(requestBean)).resultList(productionDispatchContextStepService.getProductionPsOutContext(requestBean)));
//清除上下文中的所有业务数据
productionDispatchContextStepService.doFlushProductionDispatchContext(requestBean);
//发送工序完成音

@ -77,7 +77,10 @@ public class MesEquipVariableCollectContext implements Serializable {
@ApiParam("数据类型")
private String dataType;
@ApiParam("变量当前值")
@ApiParam("变量当前值[读到的equipVariableValue值如果存在特殊字符, 原始值赋给此字段后再过滤特殊字符]")
private String realEquipVariableValue;
@ApiParam("变量当前值[非匹配参考值的读取信息需要过滤特殊字符]")
private String equipVariableValue;
@ApiParam("变量状态")
@ -127,4 +130,10 @@ public class MesEquipVariableCollectContext implements Serializable {
return this;
}
public MesEquipVariableCollectContext replaceValue(String realEquipVariableValue, String equipVariableValue) {
this.realEquipVariableValue = realEquipVariableValue;
this.equipVariableValue = equipVariableValue;
return this;
}
}

@ -18,6 +18,8 @@ import java.util.List;
@Data
public class MesPartInspectionInputModel {
@ApiParam("NC-零件检测-单据id")
private Long id;
@ApiParam("物料")
private MesPartSap part;

@ -153,9 +153,14 @@ public class MesPcnExtConstWords {
public static final String PRODUCE_SEQ = "produceSeq";
// URL
public static final String URL = "url";
// 处理状态
public static final String DEAL_STATUS = "dealStatus";
// erp物料编码
public static final String ERP_PART_NO = "erpPartNo";
// 时间格式
public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
public static final String DATE_FORMAT_SHORT = "yyMMdd";
//设备数据变量读写访问配置
@ -264,6 +269,8 @@ public class MesPcnExtConstWords {
public static final String SQUARE_BRACKETS_L = "[";
// ]
public static final String SQUARE_BRACKETS_R = "]";
// *
public static final String ASTERISK = "*";

Loading…
Cancel
Save