jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java
@@ -145,8 +145,10 @@ return bsFormulaChildInfoMapper.releaseCheck(bsFormulaChildInfo); } //1-非本工位物料 2-正常扫描可继续下次 3-扫描结束已经是最后一位工步 @Override public AjaxResult updateResults(BsFormulaChildInfo bsFormulaChildInfo) { String result = ""; BsFormulaChildInfo checkInfo = new BsFormulaChildInfo(); checkInfo.setProcessesCode(bsFormulaChildInfo.getLocationCode()); checkInfo.setProductCode(bsFormulaChildInfo.getProductCode()); @@ -154,6 +156,7 @@ // bsFormulaChildInfo.setMaterialCode(bsFormulaChildInfo.getScanBarcode().substring(1,2)); List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(checkInfo); if(bsFormulaChildInfos.size()>0){ String spareField4 = bsFormulaChildInfos.get(0).getSpareField4(); bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getScanBarcode()); bsFormulaChildInfos.get(0).setResults("OK"); bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0)); @@ -161,10 +164,21 @@ bsFormulaChildInfo.setParamCode(bsFormulaChildInfos.get(0).getParamCode()); bsFormulaChildInfo.setSfcBarcode(bsFormulaChildInfo.getSfcBarcode()); addParameterCollection(bsFormulaChildInfo); if (spareField4 != null && !spareField4.isEmpty()) { // 执行操作 if(bsFormulaChildInfos.get(0).getSpareField4().equals("1")){ try { result = "3"; miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+bsFormulaChildInfo.getLocationCode()+".RecordDataDone").value(21).build()); } catch (Exception e) { throw new RuntimeException(e); } } } }else { return AjaxResult.error("非本工位物料,请重新扫描"); result = "1"; } return AjaxResult.success("成功"); return AjaxResult.success(result); } public void addParameterCollection(BsFormulaChildInfo bsFormulaChildInfo){ jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java
@@ -52,19 +52,19 @@ */ public List<String> getSubList(){ List<String> lists = new ArrayList<>(); lists.add(OPCElement.PACK_OP010_RecordSN);//请求下发SN号 // lists.add(OPCElement.PACK_OP010_RecordSN);//请求下发SN号 lists.add(OPCElement.PACK_OP230_RecordData);//请求记录数据 lists.add(OPCElement.PACK_OP240_RecordData);//请求记录数据 lists.add(OPCElement.PACK_OP240_AngleResult);//请求记录数据 lists.add(OPCElement.PACK_OP250_RecordData);//请求记录数据 lists.add(OPCElement.PACK_OP250_AngleResult);//请求记录数据 lists.add(OPCElement.PACK_OP380_RecordData);//请求记录数据 lists.add(OPCElement.PACK_OP380_AngleResult);//请求记录数据 lists.add(OPCElement.PACK_OP300_RecordData);//请求记录数据 lists.add(OPCElement.PACK_OP300_AngleResult);//请求记录数据 lists.add(OPCElement.PACK_OP270_RecordData);//请求记录数据 lists.add(OPCElement.PACK_OP270_AngleResult);//请求记录数据 lists.add(OPCElement.PACK_OP370_Grade);//请求记录数据 // lists.add(OPCElement.PACK_OP240_RecordData);//请求记录数据 // lists.add(OPCElement.PACK_OP240_AngleResult);//请求记录数据 // lists.add(OPCElement.PACK_OP250_RecordData);//请求记录数据 // lists.add(OPCElement.PACK_OP250_AngleResult);//请求记录数据 // lists.add(OPCElement.PACK_OP380_RecordData);//请求记录数据 // lists.add(OPCElement.PACK_OP380_AngleResult);//请求记录数据 // lists.add(OPCElement.PACK_OP300_RecordData);//请求记录数据 // lists.add(OPCElement.PACK_OP300_AngleResult);//请求记录数据 // lists.add(OPCElement.PACK_OP270_RecordData);//请求记录数据 // lists.add(OPCElement.PACK_OP270_AngleResult);//请求记录数据 // lists.add(OPCElement.PACK_OP370_RecordData);//请求记录数据 return lists; } jcdm-main/src/main/java/com/jcdm/main/plcserver/conf/OPCElement.java
@@ -49,7 +49,7 @@ /** * OP270 */ public static final String PACK_OP370_Grade = "PACK.OP370.Grade";//请求记录数据 public static final String PACK_OP370_RecordData = "PACK.OP370.RecordData";//请求记录数据 jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
@@ -12,6 +12,7 @@ import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService; import com.jcdm.main.plcserver.conf.OPCElement; import com.jcdm.main.plcserver.util.TimeUtil; import com.kangaroohy.milo.model.ReadWriteEntity; import com.kangaroohy.milo.runner.subscription.SubscriptionCallback; import com.kangaroohy.milo.service.MiloService; @@ -19,6 +20,7 @@ import org.springframework.stereotype.Component; import javax.websocket.Session; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -80,7 +82,7 @@ miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(recordSNDoneAddress).value(1).build()); } //请求记录数据 else if (("Grade").equals(tab)) { else if (("RecordData").equals(tab)) { String recordDataDoneValue = ""; if("1".equals(tabVlaue)){ @@ -226,9 +228,11 @@ * 保存过站采集 */ public void saveStationInfo(String packCode,String thoroughfare,String device,String workOrderNo,String productCode) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); sdf.setTimeZone(TimeZone.getTimeZone("GMT+8")); // CST通常表示中国标准时间,即东八区 String prefix = thoroughfare+"."+device+"."; // String startTime = miloService.readFromOpcUa(prefix + "StartTime").getValue().toString(); // String stopTime = miloService.readFromOpcUa(prefix + "StopTime").getValue().toString(); String startTime = miloService.readFromOpcUa(prefix + "StartTime").getValue().toString(); String stopTime = miloService.readFromOpcUa(prefix + "StopTime").getValue().toString(); String stationStatus = miloService.readFromOpcUa(prefix + "StationStatus").getValue().toString(); DaPassingStationCollection daPassingStationCollection = new DaPassingStationCollection(); @@ -236,8 +240,10 @@ daPassingStationCollection.setWorkOrderNo(workOrderNo); daPassingStationCollection.setProductCode(productCode); daPassingStationCollection.setLocationCode(device); // daPassingStationCollection.setInboundTime(startTime);//入站时间 // daPassingStationCollection.setOutboundTime(stopTime);//出站时间 String strt = TimeUtil.stringProcessing(startTime); String end = TimeUtil.stringProcessing(stopTime); daPassingStationCollection.setInboundTime(sdf.parse(strt));//入站时间 daPassingStationCollection.setOutboundTime(sdf.parse(end));//出站时间 daPassingStationCollection.setOutRsSign(stationStatus);//出站是否合格 daPassingStationCollectionService.insertDaPassingStationCollection(daPassingStationCollection); } @@ -258,10 +264,16 @@ List<DaParamCollection> daParamCollectionlist = new ArrayList<>(); for(int i=0;i<nodeIdList.size();i++){ if(!readWriteEntityList.get(i).getValue().toString().equals("0.0")){ String tt = readWriteEntityList.get(i).getValue().toString(); DaParamCollection ParamCollection = new DaParamCollection(); ParamCollection.setParamCode(list.get(i).getCollectParameterId()); ParamCollection.setLocationCode(device); ParamCollection.setParamValue(readWriteEntityList.get(i).getValue().toString()); if(tt.contains("Time")){ String str = TimeUtil.getTimestamp(TimeUtil.stringProcessing(tt)); ParamCollection.setParamValue(str); }else { ParamCollection.setParamValue(readWriteEntityList.get(i).getValue().toString()); } ParamCollection.setSfcCode(packCode); ParamCollection.setParamName(list.get(i).getCollectParameterName()); ParamCollection.setParamUpper(list.get(i).getParamUpper()); jcdm-ui/src/views/main/kb/stationTerminal/index.vue
@@ -361,7 +361,7 @@ }, content: '', activeName: 'first', url: "ws://192.168.1.102:8080/websocket/message/", url: "ws://192.168.1.100:8080/websocket/message/", message: "", text_content: "", ws: null, @@ -479,6 +479,10 @@ collectionTime: new Date() } updateResults(formulaChildParams).then(response => { console.log(response) if(response.msg === "3"){ this.cakeLamp.release= 1 //允许放行 } this.getListFormulaChild() }); }, @@ -508,6 +512,10 @@ this.formulaChildList = [] this.headContent.sfcCode = null this.workpieceInformation.productCode = null; this.workpieceInformation.workOrderNo = null; this.workpieceInformation.productModel = null; this.workpieceInformation.productName = null; }, changeMenu(tab, event) { console.log(tab, event); @@ -597,7 +605,6 @@ this.$message('websocket连接成功!'); }; this.ws.onmessage = function (event) { const DELAY_TIME = 2000; if (event.data === "IN") { self.cakeLamp.InPlace = 1; } else if (event.data === "IN0") {