From 971788bf15d4bd58fe5bb6dbb76f16317a25ef7b Mon Sep 17 00:00:00 2001 From: admin <15939171744@163.com> Date: 星期五, 12 七月 2024 09:02:14 +0800 Subject: [PATCH] 工厂MES接口地址优化 --- jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java | 27 ++++++++++++++------------- 1 files changed, 14 insertions(+), 13 deletions(-) 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 ec95828..85eec3c 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 @@ -160,9 +160,10 @@ Object productTypeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".ProductType").getValue();//浜у搧绫诲瀷 if (ObjectUtil.isNotNull(productTypeObjcet)){ String productType = productTypeObjcet.toString();//浜у搧绫诲瀷 + String materialCode = Constants.materialMap.get(productType); CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { //璋冪敤宸ュ巶MES锛屼繚瀛樺埌鏁版嵁搴�,骞朵笖灏嗗伐鍗曚紶缁橮LC (鐩墠涓存椂鐢ㄨ鏂规硶锛� - receivingWorkOrders(thoroughfare, device); + receivingWorkOrders(thoroughfare, device,materialCode); }); miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(11).build()); @@ -207,7 +208,7 @@ WebSocketUsers.sendMessageToUserByText(map.get(device), "END"); } else { Integer result = 21; - Object productTypeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".ProductType").getValue();//浜у搧绫诲瀷 + //Object productTypeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".ProductType").getValue();//浜у搧绫诲瀷 Object modulCodeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".ModuleCode").getValue(); if (ObjectUtil.isNull(modulCodeObjcet)){ result = 23; @@ -227,8 +228,7 @@ log.error(e.getMessage()); } } - public void receivingWorkOrders(String thoroughfare ,String device) - { +/* public void receivingWorkOrders(String thoroughfare ,String device) { String paramProductNum = ""; try { @@ -241,7 +241,7 @@ String orderNum = orderList.get(0).getWorkOrderNo(); //涓嬪彂浜у搧妯$粍鐮� miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".ModuleCode").value(productNum).build()); - miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".WorkOrderNumber").value(productNum).build()); + miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".WorkOrderNumber").value(orderNum).build()); //miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(1).build()); //鏇存柊宸ュ崟鐘舵�佷负鎵ц涓� @@ -253,21 +253,21 @@ //灏嗕骇鍝丼N鍙戦�佸埌鍓嶅彴 productNum = "productNum,"+ productNum; WebSocketUsers.sendMessageToUserByText(map.get(device), productNum); - }/*else{ + }*//*else{ miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(2).build());//娌℃湁瑕佺敓浜х殑宸ュ崟 - }*/ + }*//* } catch (Exception e) { throw new RuntimeException(e); } - } + }*/ - /* public void receivingWorkOrders(String thoroughfare ,String device) + public void receivingWorkOrders(String thoroughfare ,String device ,String materialCode) { String paramProductNum = ""; try { // 鏌ヨ鏈�鏂扮殑宸ュ崟淇℃伅 OmProductionOrdeInfo lastOrder = omProductionOrdeInfoService.getLastOrder(); - String orderJsonString = RestfulService.getProductionWorkOrderRequest(lastOrder.getProductNum(), "M1OP100"); + String orderJsonString = RestfulService.getProductionWorkOrderRequest(lastOrder.getProductNum(), "M1OP100",materialCode); JSONObject jsonObject = new JSONObject(orderJsonString); // 浠嶫SONObject涓幏鍙杁ata瀵硅薄 JSONObject dataObject = jsonObject.getJSONObject("data"); @@ -280,6 +280,7 @@ omProductionOrdeInfo.setProductNum(dataObject.getStr("productNum")); omProductionOrdeInfo.setStationCode(dataObject.getStr("stationCode")); omProductionOrdeInfo.setMaterialCode(dataObject.getStr("materialCode")); + omProductionOrdeInfo.setPlanQty(Long.valueOf(dataObject.getStr("plannedQuantity"))); omProductionOrdeInfo.setOnlineCompletionMark("0"); omProductionOrdeInfo.setSfResult("0"); omProductionOrdeInfo.setProductCode(dataObject.getStr("model")); @@ -298,7 +299,7 @@ } catch (Exception e) { throw new RuntimeException(e); } - }*/ + } /** * 璇诲彇鐢佃姱鐮� @@ -517,7 +518,7 @@ parentVO.setCheckList(mesList); log.info("鎵ц宸ュ巶MES鏂规硶start锛屽伐浣嶅彿{} 浼犲叆鏁版嵁锛歿}",device ,parentVO); - HttpResponse execute = HttpRequest.post(Constants.FACTORY_EMS_UAT_RUL+"deviceResultFeedback").body(JSONUtil.toJsonStr(parentVO)).execute(); + HttpResponse execute = HttpRequest.post(Constants.FACTORY_EMS_UAT_GET_RUL+"deviceResultFeedback").body(JSONUtil.toJsonStr(parentVO)).execute(); log.info("鎵ц宸ュ巶MES鏂规硶end锛屽伐浣嶅彿{} 杩斿洖鏁版嵁锛歿}",device,execute.body()); }); @@ -757,7 +758,7 @@ parentVO.setCheckList(mesChildList);//鍙傛暟 //CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { log.info("鎵ц宸ュ巶MES鏂规硶start锛屼紶鍏ユ暟鎹細{}",parentVO); - HttpResponse execute = HttpRequest.post(Constants.FACTORY_EMS_UAT_RUL+"deviceResultFeedback").body(JSONUtil.toJsonStr(parentVO)).execute(); + HttpResponse execute = HttpRequest.post(Constants.FACTORY_EMS_UAT_GET_RUL+"deviceResultFeedback").body(JSONUtil.toJsonStr(parentVO)).execute(); log.info("鎵ц宸ュ巶MES鏂规硶end锛岃繑鍥炴暟鎹細{}",execute.body()); } } -- Gitblit v1.9.3