From c5e9c5922da7de2bf6df6dce42e7162dbe5cdd2d Mon Sep 17 00:00:00 2001 From: 懒羊羊 <15939171744@163.com> Date: 星期五, 12 四月 2024 13:21:26 +0800 Subject: [PATCH] - --- jcdm-main/src/main/java/com/jcdm/main/plcserver/conf/OPCElement.java | 2 jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java | 18 ++++++++- jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java | 24 ++++++------ jcdm-ui/src/views/main/kb/stationTerminal/index.vue | 11 ++++- jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java | 24 +++++++++--- 5 files changed, 56 insertions(+), 23 deletions(-) diff --git a/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java b/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java index 7f64c48..4f21d59 100644 --- a/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java +++ b/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java @@ -145,8 +145,10 @@ return bsFormulaChildInfoMapper.releaseCheck(bsFormulaChildInfo); } + //1-闈炴湰宸ヤ綅鐗╂枡 2-姝e父鎵弿鍙户缁笅娆� 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){ diff --git a/jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java b/jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java index cbff0e6..75f616f 100644 --- a/jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java +++ b/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; } diff --git a/jcdm-main/src/main/java/com/jcdm/main/plcserver/conf/OPCElement.java b/jcdm-main/src/main/java/com/jcdm/main/plcserver/conf/OPCElement.java index b0fe56f..170c33b 100644 --- a/jcdm-main/src/main/java/com/jcdm/main/plcserver/conf/OPCElement.java +++ b/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";//璇锋眰璁板綍鏁版嵁 diff --git a/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java b/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java index d73865a..25de3cd 100644 --- a/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java +++ b/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()); diff --git a/jcdm-ui/src/views/main/kb/stationTerminal/index.vue b/jcdm-ui/src/views/main/kb/stationTerminal/index.vue index 3d695cd..c29cfdc 100644 --- a/jcdm-ui/src/views/main/kb/stationTerminal/index.vue +++ b/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") { -- Gitblit v1.9.3