forked from I3-YF/i3plus-mes-pcn-yfai
plc collect pd
parent
8849931f5a
commit
742e3c958f
33
modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/collect/SxThirdPartyPlcCollectMonitorCellTaktHandler.java → modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/collect/SxThirdPartyPlcCollectCellTaktHandler.java
33
modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/collect/SxThirdPartyPlcCollectMonitorCellTaktHandler.java → modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/collect/SxThirdPartyPlcCollectCellTaktHandler.java
@ -1,32 +0,0 @@
|
|||||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.collect;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 第三方PLC数据采集-监控处理器-生产数据
|
|
||||||
*/
|
|
||||||
public class SxThirdPartyPlcCollectMonitorProductDataHandler extends SxThirdPartyPlcCollectMonitorHandler {
|
|
||||||
|
|
||||||
private volatile String plcCode2Flag;
|
|
||||||
|
|
||||||
private volatile String plcCode2Data;
|
|
||||||
|
|
||||||
public SxThirdPartyPlcCollectMonitorProductDataHandler(String org, String key) {
|
|
||||||
super(org, key);
|
|
||||||
initStepResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initStepResult() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SxThirdPartyPlcCollectMonitorProductDataHandler doRetry(Object obj) {
|
|
||||||
return doRetry(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execMonitor() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,162 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.collect;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.SxThirdPartyPlcCollectDataModel;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
||||||
|
import cn.estsh.i3plus.mes.pcn.api.iservice.busi.IShippingDispatchService;
|
||||||
|
import cn.estsh.i3plus.platform.common.util.MesPcnConstWords;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
||||||
|
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第三方PLC数据采集-监控处理器-生产数据
|
||||||
|
*/
|
||||||
|
public class SxThirdPartyPlcCollectProductDataHandler extends SxThirdPartyPlcCollectMonitorHandler {
|
||||||
|
|
||||||
|
private Long startTime;
|
||||||
|
|
||||||
|
private Long endTime;
|
||||||
|
|
||||||
|
private StationRequestBean reqBean;
|
||||||
|
|
||||||
|
private volatile SxThirdPartyPlcCollectDataModel plcCollectData;
|
||||||
|
|
||||||
|
private IShippingDispatchService shippingDispatchService;
|
||||||
|
|
||||||
|
public SxThirdPartyPlcCollectProductDataHandler(String org, String key) {
|
||||||
|
super(org, key);
|
||||||
|
shippingDispatchService = (IShippingDispatchService) SpringContextsUtil.getBean("shippingDispatchService");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SxThirdPartyPlcCollectProductDataHandler doRetry(Object obj) {
|
||||||
|
|
||||||
|
super.doRetry(obj);
|
||||||
|
|
||||||
|
if (isOpen) super.cancel();
|
||||||
|
|
||||||
|
SxThirdPartyPlcCollectDataModel plcCollectData = (SxThirdPartyPlcCollectDataModel) obj;
|
||||||
|
|
||||||
|
if (null == this.plcCollectData) this.plcCollectData = plcCollectData;
|
||||||
|
else if (compareToRetry(plcCollectData)) isRetry = true;
|
||||||
|
|
||||||
|
if (isRetry || null == filterChain) instanceFilterChain();
|
||||||
|
|
||||||
|
restoreStepResultData();
|
||||||
|
|
||||||
|
super.doSubmit();
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execMonitor() {
|
||||||
|
|
||||||
|
startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
while (isOpen) {
|
||||||
|
|
||||||
|
endTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
if (checkTimeOut()) return;
|
||||||
|
|
||||||
|
if (null == filterChain) continue;
|
||||||
|
|
||||||
|
stepResult = filterChain.exec(stepResult);
|
||||||
|
|
||||||
|
if (!stepResult.isCompleted()) continue;
|
||||||
|
|
||||||
|
doSendScanQueueNextExec();
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Boolean compareToRetry(SxThirdPartyPlcCollectDataModel plcCollectData) {
|
||||||
|
if (this.plcCollectData.getPlcCode2PlcFlag().equals(plcCollectData.getPlcCode2PlcFlag())
|
||||||
|
&& this.plcCollectData.getPlcCode2PcnFlag().equals(plcCollectData.getPlcCode2PcnFlag())
|
||||||
|
&& this.plcCollectData.getPlcCode2DataList().containsAll(plcCollectData.getPlcCode2DataList())
|
||||||
|
&& plcCollectData.getPlcCode2DataList().containsAll(this.plcCollectData.getPlcCode2DataList())) return false;
|
||||||
|
this.plcCollectData = plcCollectData;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void instanceFilterChain() {
|
||||||
|
filterChain = new SxThirdPartyPlcCollectStepFilterChain(org, key, MesPcnExtConstWords.PRODUCT_DATA)
|
||||||
|
.clearField(getClearField()).sleepTime2UnComplete(500L)
|
||||||
|
.add(new SxThirdPartyPlcCollectReadPlcStepService(plcCollectData.getPlcCode2PlcFlag()).targetValue(
|
||||||
|
new StringJoiner(MesPcnExtConstWords.COMMA).add(CommonEnumUtil.TRUE_OR_FALSE.TRUE.name().toLowerCase()).add(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr()).toString()))
|
||||||
|
.add(new SxThirdPartyPlcCollectReadPlcStepService(plcCollectData.getPlcCode2PcnFlag()).targetValue(
|
||||||
|
new StringJoiner(MesPcnExtConstWords.COMMA).add(CommonEnumUtil.TRUE_OR_FALSE.FALSE.name().toLowerCase()).add(MesPcnExtConstWords.ZERO_STR).toString()));
|
||||||
|
plcCollectData.getPlcCode2DataList().forEach(o -> filterChain.add(new SxThirdPartyPlcCollectReadPlcStepService(o)));
|
||||||
|
filterChain.add(new SxThirdPartyPlcCollectWritePlcStepService(plcCollectData.getPlcCode2PcnFlag()).targetValue(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr()))
|
||||||
|
.add(new SxThirdPartyPlcCollectProductDataStepService().targetField(plcCollectData.getPlcCode2DataList()));
|
||||||
|
isRetry = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void restoreStepResultData() {
|
||||||
|
((Map<String, Object>) stepResult.getData()).remove(MesPcnExtConstWords.USER_INFO);
|
||||||
|
((Map<String, Object>) stepResult.getData()).remove(MesPcnExtConstWords.SERIAL_NUMBER);
|
||||||
|
((Map<String, Object>) stepResult.getData()).remove(MesPcnExtConstWords.PRODUCT_SN);
|
||||||
|
((Map<String, Object>) stepResult.getData()).remove(MesPcnExtConstWords.MANAGE_CODE);
|
||||||
|
((Map<String, Object>) stepResult.getData()).remove(MesPcnExtConstWords.WORK_ORDER_NO);
|
||||||
|
((Map<String, Object>) stepResult.getData()).remove(MesPcnExtConstWords.PART_NO);
|
||||||
|
((Map<String, Object>) stepResult.getData()).remove(MesPcnExtConstWords.PART_NAME_RDD);
|
||||||
|
((Map<String, Object>) stepResult.getData()).put(MesPcnExtConstWords.USER_INFO, plcCollectData.getUserInfo());
|
||||||
|
((Map<String, Object>) stepResult.getData()).put(MesPcnExtConstWords.SERIAL_NUMBER, plcCollectData.getSerialNumber());
|
||||||
|
((Map<String, Object>) stepResult.getData()).put(MesPcnExtConstWords.PRODUCT_SN, plcCollectData.getProductSn());
|
||||||
|
((Map<String, Object>) stepResult.getData()).put(MesPcnExtConstWords.MANAGE_CODE, plcCollectData.getManageCode());
|
||||||
|
((Map<String, Object>) stepResult.getData()).put(MesPcnExtConstWords.WORK_ORDER_NO, plcCollectData.getWorkOrderNo());
|
||||||
|
((Map<String, Object>) stepResult.getData()).put(MesPcnExtConstWords.PART_NO, plcCollectData.getPartNo());
|
||||||
|
((Map<String, Object>) stepResult.getData()).put(MesPcnExtConstWords.PART_NAME_RDD, plcCollectData.getPartNameRdd());
|
||||||
|
}
|
||||||
|
|
||||||
|
private String[] getClearField() {
|
||||||
|
List<String> clearFieldList = new ArrayList<>(plcCollectData.getPlcCode2DataList());
|
||||||
|
clearFieldList.add(0, plcCollectData.getPlcCode2PlcFlag());
|
||||||
|
clearFieldList.add(0, plcCollectData.getPlcCode2PcnFlag());
|
||||||
|
return clearFieldList.toArray(new String[clearFieldList.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Boolean checkTimeOut() {
|
||||||
|
|
||||||
|
if (endTime - startTime < this.plcCollectData.getTimeOut()) return false;
|
||||||
|
|
||||||
|
stepResult.msg(String.format("%s当前采集已超时!", StringUtils.isEmpty(stepResult.getMsg()) ? MesPcnExtConstWords.EMPTY : stepResult.getMsg()));
|
||||||
|
|
||||||
|
doSendScanQueueNextExec();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doSendScanQueueNextExec() {
|
||||||
|
initStationRequestBean();
|
||||||
|
reqBean.getDataMap().put(MesPcnExtConstWords.RESULT, stepResult.isCompleted());
|
||||||
|
if (!StringUtils.isEmpty(stepResult.getMsg())) reqBean.getDataMap().put(MesPcnExtConstWords.INFO, stepResult.getMsg());
|
||||||
|
shippingDispatchService.doSendScanQueueNextExec(reqBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initStationRequestBean() {
|
||||||
|
if (null == reqBean) {
|
||||||
|
reqBean = new StationRequestBean(plcCollectData.getOrganizeCode(), plcCollectData.getWorkCenterCode(), plcCollectData.getWorkCellCode());
|
||||||
|
reqBean.setClientInfo(shippingDispatchService.getActorClientInfo(reqBean));
|
||||||
|
reqBean.setTriggerAutoFsm(true);
|
||||||
|
reqBean.setInterfaceType(MesPcnConstWords.SHIPPING);
|
||||||
|
reqBean.setBusiType(MesPcnConstWords.WS_CMD_DO_SCAN);
|
||||||
|
} else {
|
||||||
|
reqBean.getDataMap().remove(MesPcnExtConstWords.RESULT);
|
||||||
|
reqBean.getDataMap().remove(MesPcnExtConstWords.INFO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.collect;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.ISxThirdPartyPlcCollectDataJobService;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第三方PLC数据采集-采集生产数据实现
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service(value = "SxThirdPartyPlcCollectProductDataService")
|
||||||
|
public class SxThirdPartyPlcCollectProductDataService implements ISxThirdPartyPlcCollectDataJobService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doThirdPartyPlcCollectData(Map<String, Object> paramMap) {
|
||||||
|
|
||||||
|
String[] keyArr = new ArrayList<>(paramMap.keySet()).get(0).split(MesPcnExtConstWords.COLON);
|
||||||
|
|
||||||
|
log.info("工厂{}第三方PLC数据采集 --- STRATEGY {} EXEC SERVICE START --- PARAM:{}", keyArr[1], keyArr[0], JSONObject.toJSONString(paramMap));
|
||||||
|
|
||||||
|
if (!SxThirdPartyPlcCollectDispatchSingleton.getIsInit()) SxThirdPartyPlcCollectDispatchSingleton.getInstance();
|
||||||
|
|
||||||
|
SxThirdPartyPlcCollectDispatchSingleton.execMonitor(keyArr[1], keyArr[0], paramMap, false);
|
||||||
|
|
||||||
|
log.info("工厂{}第三方PLC数据采集 --- STRATEGY {} EXEC SERVICE END ---", keyArr[1], keyArr[0]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,108 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.collect;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.ISxThirdPartyPlcCollectDataStepService;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.jx.IJxPlcExtService;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.jx.IJxProductDataService;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtEnumUtil;
|
||||||
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.bean.MesObjectCfg;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.bean.MesProductData;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.model.ProductDataModel;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.model.StepResult;
|
||||||
|
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第三方PLC数据采集定时任务---步骤执行---写节拍
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class SxThirdPartyPlcCollectProductDataStepService implements ISxThirdPartyPlcCollectDataStepService {
|
||||||
|
|
||||||
|
private IJxPlcExtService plcExtService;
|
||||||
|
|
||||||
|
private IJxProductDataService productDataService;
|
||||||
|
|
||||||
|
protected List<String> targetFieldList;
|
||||||
|
|
||||||
|
public SxThirdPartyPlcCollectProductDataStepService() {
|
||||||
|
this.plcExtService = (IJxPlcExtService) SpringContextsUtil.getBean("jxPlcExtService");
|
||||||
|
this.productDataService = (IJxProductDataService) SpringContextsUtil.getBean("jxProductDataService");
|
||||||
|
}
|
||||||
|
|
||||||
|
public SxThirdPartyPlcCollectProductDataStepService targetField(List<String> targetFieldList) {
|
||||||
|
this.targetFieldList = targetFieldList;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StepResult exec(StepResult stepResult) {
|
||||||
|
|
||||||
|
String organizeCode = (String) ((Map<String, Object>) stepResult.getData()).get(MesPcnExtConstWords.ORGANIZE_CODE);
|
||||||
|
String userInfo = (String) ((Map<String, Object>) stepResult.getData()).get(MesPcnExtConstWords.USER_INFO);
|
||||||
|
String workCenterCode = (String) ((Map<String, Object>) stepResult.getData()).get(MesPcnExtConstWords.WORK_CENTER_CODE);
|
||||||
|
String workCellCode = (String) ((Map<String, Object>) stepResult.getData()).get(MesPcnExtConstWords.WORK_CELL_CODE);
|
||||||
|
String serialNumber = (String) ((Map<String, Object>) stepResult.getData()).get(MesPcnExtConstWords.SERIAL_NUMBER);
|
||||||
|
String productSn = (String) ((Map<String, Object>) stepResult.getData()).get(MesPcnExtConstWords.PRODUCT_SN);
|
||||||
|
String manageCode = (String) ((Map<String, Object>) stepResult.getData()).get(MesPcnExtConstWords.MANAGE_CODE);
|
||||||
|
String workOrderNo = (String) ((Map<String, Object>) stepResult.getData()).get(MesPcnExtConstWords.WORK_ORDER_NO);
|
||||||
|
String partNo = (String) ((Map<String, Object>) stepResult.getData()).get(MesPcnExtConstWords.PART_NO);
|
||||||
|
String partNameRdd = (String) ((Map<String, Object>) stepResult.getData()).get(MesPcnExtConstWords.PART_NAME_RDD);
|
||||||
|
String key = (String) ((Map<String, Object>) stepResult.getData()).get(MesPcnExtConstWords.KEY);
|
||||||
|
|
||||||
|
String objectCfgStr = plcExtService.getCachedData(key, MesPcnExtConstWords.OBJECT_CODE_UC);
|
||||||
|
if (StringUtils.isEmpty(objectCfgStr)) return stepResult.isCompleted(false).msg(String.format("生产线[%s]工位[%s]缓存信息缺失对象结构信息!", workCenterCode, workCellCode));
|
||||||
|
List<MesObjectCfg> objectCfgList = JSONObject.parseArray(objectCfgStr, MesObjectCfg.class);
|
||||||
|
if (CollectionUtils.isEmpty(objectCfgList)) return stepResult.isCompleted(false).msg(String.format("生产线[%s]工位[%s]缓存信息缺失有效的对象结构信息!", workCenterCode, workCellCode));
|
||||||
|
|
||||||
|
Map<String, List<MesObjectCfg>> objectCodeMap = objectCfgList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesObjectCfg::getObjectCode));
|
||||||
|
|
||||||
|
List<MesProductData> productDataList = new ArrayList<>();
|
||||||
|
for (String objectCode : objectCodeMap.keySet()) {
|
||||||
|
if (StringUtils.isEmpty(objectCode)) continue;
|
||||||
|
|
||||||
|
MesProductData productData = new MesProductData();
|
||||||
|
productData.setOrganizeCode(organizeCode);
|
||||||
|
productData.setWorkCenterCode(workCenterCode);
|
||||||
|
productData.setWorkCellCode(workCellCode);
|
||||||
|
productData.setSerialNumber(serialNumber);
|
||||||
|
productData.setProductSn(productSn);
|
||||||
|
productData.setGroupNo(manageCode);
|
||||||
|
productData.setPartNo(partNo);
|
||||||
|
productData.setPartDesc(partNameRdd);
|
||||||
|
productData.setOrderNo(workOrderNo);
|
||||||
|
productData.setObjectCode(objectCode);
|
||||||
|
productData.setLineData(JSON.toJSONString(getLineDataList(stepResult, objectCodeMap.get(objectCode))));
|
||||||
|
productData.setSystemSyncStatus(MesPcnExtEnumUtil.IF_SYNC_STATUS.NO_SYNC.getValue());
|
||||||
|
ConvertBean.serviceModelInitialize(productData, userInfo);
|
||||||
|
productDataList.add(productData);
|
||||||
|
}
|
||||||
|
|
||||||
|
productDataService.insertProductDataNoRollback(productDataList);
|
||||||
|
|
||||||
|
return stepResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ProductDataModel> getLineDataList(StepResult stepResult, List<MesObjectCfg> objectCfgList) {
|
||||||
|
List<ProductDataModel> lineDataList = new ArrayList<>();
|
||||||
|
for (MesObjectCfg objectCfg : objectCfgList) {
|
||||||
|
if (null == objectCfg) continue;
|
||||||
|
ProductDataModel productDataModel = new ProductDataModel();
|
||||||
|
productDataModel.setFieldCode(objectCfg.getFieldCode());
|
||||||
|
productDataModel.setFieldName(objectCfg.getFieldName());
|
||||||
|
productDataModel.setFieldValue((String) ((Map<String, Object>) stepResult.getData()).get(objectCfg.getPlcCode()));
|
||||||
|
lineDataList.add(productDataModel);
|
||||||
|
}
|
||||||
|
return lineDataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.jx;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.jx.IJxProductDataService;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.bean.MesProductData;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.repository.MesProductDataRepository;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: wangjie
|
||||||
|
* @CreateDate: 2021/01/18 11:41 上午
|
||||||
|
* @Description:
|
||||||
|
**/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class JxProductDataService implements IJxProductDataService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MesProductDataRepository productDataRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertProductDataNoRollback(List<MesProductData> productDataList) {
|
||||||
|
productDataList.forEach(o -> productDataRepository.insert(o));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,102 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.pcn.pojo.model;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SxThirdPartyPlcCollectDataModel implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -1649994009292535386L;
|
||||||
|
|
||||||
|
@ApiParam("工厂代码")
|
||||||
|
public String organizeCode;
|
||||||
|
|
||||||
|
@ApiParam("操作人")
|
||||||
|
public String userInfo;
|
||||||
|
|
||||||
|
@ApiParam("生产线代码")
|
||||||
|
private String workCenterCode;
|
||||||
|
|
||||||
|
@ApiParam("工位代码")
|
||||||
|
private String workCellCode;
|
||||||
|
|
||||||
|
@ApiParam("过程条码")
|
||||||
|
private String serialNumber;
|
||||||
|
|
||||||
|
@ApiParam("产品条码")
|
||||||
|
private String productSn;
|
||||||
|
|
||||||
|
@ApiParam("管理码")
|
||||||
|
private String manageCode;
|
||||||
|
|
||||||
|
@ApiParam("生产工单")
|
||||||
|
private String workOrderNo;
|
||||||
|
|
||||||
|
@ApiParam("物料号")
|
||||||
|
private String partNo;
|
||||||
|
|
||||||
|
@ApiParam("物料名称")
|
||||||
|
private String partNameRdd;
|
||||||
|
|
||||||
|
@ApiParam("超时时间")
|
||||||
|
private Long timeOut = 60000L;
|
||||||
|
|
||||||
|
@ApiParam("PLC标志位代码")
|
||||||
|
private String plcCode2PlcFlag;
|
||||||
|
|
||||||
|
@ApiParam("PCN标志位代码")
|
||||||
|
private String plcCode2PcnFlag;
|
||||||
|
|
||||||
|
@ApiParam("数据位PLC代码集合")
|
||||||
|
private List<String> plcCode2DataList;
|
||||||
|
|
||||||
|
public SxThirdPartyPlcCollectDataModel location(String organizeCode, String workCenterCode, String workCellCode) {
|
||||||
|
this.organizeCode = organizeCode;
|
||||||
|
this.workCenterCode = workCenterCode;
|
||||||
|
this.workCellCode = workCellCode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SxThirdPartyPlcCollectDataModel userInfo(String userInfo) {
|
||||||
|
this.userInfo = userInfo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SxThirdPartyPlcCollectDataModel order(String workOrderNo, String partNo, String partNameRdd) {
|
||||||
|
this.workOrderNo = workOrderNo;
|
||||||
|
this.partNo = partNo;
|
||||||
|
this.partNameRdd = partNameRdd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SxThirdPartyPlcCollectDataModel sn(String serialNumber, String productSn) {
|
||||||
|
this.serialNumber = serialNumber;
|
||||||
|
this.productSn = productSn;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SxThirdPartyPlcCollectDataModel manageCode(String manageCode) {
|
||||||
|
this.manageCode = manageCode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SxThirdPartyPlcCollectDataModel timeOut(Object timeOut) {
|
||||||
|
if (!StringUtils.isEmpty(timeOut)) this.timeOut = Long.valueOf(timeOut.toString());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SxThirdPartyPlcCollectDataModel plcCode2Flag(String plcCode2PlcFlag, String plcCode2PcnFlag) {
|
||||||
|
this.plcCode2PlcFlag = plcCode2PlcFlag;
|
||||||
|
this.plcCode2PcnFlag = plcCode2PcnFlag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SxThirdPartyPlcCollectDataModel plcCode2DataList(List<String> plcCode2DataList) {
|
||||||
|
this.plcCode2DataList = plcCode2DataList;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue