From 653b17eac39c339774cd46291a9345493b253a1f Mon Sep 17 00:00:00 2001
From: admin <15939171744@163.com>
Date: 星期四, 11 七月 2024 10:35:18 +0800
Subject: [PATCH] 100-1工位 接收工单 人工操作页面优化

---
 jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/controller/OmProductionOrdeInfoController.java |   46 +++++-----------------------------------------
 1 files changed, 5 insertions(+), 41 deletions(-)

diff --git a/jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/controller/OmProductionOrdeInfoController.java b/jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/controller/OmProductionOrdeInfoController.java
index 9667adf..bcb937b 100644
--- a/jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/controller/OmProductionOrdeInfoController.java
+++ b/jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/controller/OmProductionOrdeInfoController.java
@@ -121,55 +121,18 @@
         util.exportExcel(response, list, "鐢熶骇宸ュ崟鏁版嵁");
     }
 
-    @GetMapping("/receivingWorkOrders")
-    public AjaxResult receivingWorkOrders() throws Exception {
+    @GetMapping("/mozuReceivingWorkOrders")
+    public AjaxResult mozuReceivingWorkOrders(OmProductionOrdeInfo paramOrder) throws Exception {
         String paramProductNum = "";
-        Object productTypeObjcet = miloService.readFromOpcUa("thoroughfare" + "." + "device" + ".ProductType").getValue();//浜у搧绫诲瀷
+        Object productTypeObjcet = miloService.readFromOpcUa("MOZU1." + paramOrder.getLineCode() + ".ProductType").getValue();//浜у搧绫诲瀷
         if (ObjectUtil.isNull(productTypeObjcet)) {
             return AjaxResult.error("鎺ュ崟澶辫触,PLC鏈紶杈撶敓浜х被鍨嬶紝璇疯仈绯荤鐞嗗憳");
         }
         String productType = productTypeObjcet.toString();//浜у搧绫诲瀷
         String materialCode = Constants.materialMap.get(productType);
-        // 鏌ヨ鏈�鏂扮殑宸ュ崟淇℃伅
+
         OmProductionOrdeInfo lastOrder = omProductionOrdeInfoService.getLastOrder();
         String orderJsonString = RestfulService.getProductionWorkOrderRequest(lastOrder.getProductNum(), "M1OP100",materialCode);
-        JSONObject jsonObject = new JSONObject(orderJsonString);
-        // 浠嶫SONObject涓幏鍙杁ata瀵硅薄
-        JSONObject dataObject = jsonObject.getJSONObject("data");
-        String code = jsonObject.getStr("code");
-        // 鍒ゆ柇鎺ュ崟鏄惁鎴愬姛
-        if(code.equals("success")){
-            logger.info("璇锋眰宸ュ巶MES宸ュ崟锛氬叆鍙俻ack{}鍑哄弬pack锛歿}",paramProductNum,dataObject.getStr("productNum"));
-            List<OmProductionOrdeInfo> check = omProductionOrdeInfoService.list(new LambdaQueryWrapper<OmProductionOrdeInfo>().eq(OmProductionOrdeInfo::getProductNum,dataObject.getStr("productNum")));
-            if(check.size() == 0){
-                OmProductionOrdeInfo omProductionOrdeInfo = new OmProductionOrdeInfo();
-                omProductionOrdeInfo.setWorkOrderNo(dataObject.getStr("productionOrderNum"));
-                omProductionOrdeInfo.setProductNum(dataObject.getStr("productNum"));
-                omProductionOrdeInfo.setStationCode(dataObject.getStr("stationCode"));
-                omProductionOrdeInfo.setMaterialCode(dataObject.getStr("materialCode"));
-                omProductionOrdeInfo.setOnlineCompletionMark("0");
-                omProductionOrdeInfo.setSfResult("0");
-                if(dataObject.getStr("model").equals("PE01A")){
-                    omProductionOrdeInfo.setProductCode("1P102S");
-                }else {
-                    omProductionOrdeInfo.setProductCode(dataObject.getStr("model"));
-                }
-                omProductionOrdeInfo.setCreateTime(new Date());
-                omProductionOrdeInfo.setCreateUser("宸ュ巶MES");
-                omProductionOrdeInfoService.save(omProductionOrdeInfo);
-            }
-        }else {
-            return AjaxResult.error("鎺ュ崟澶辫触,璇疯仈绯荤鐞嗗憳");
-        }
-        return AjaxResult.success(dataObject.getStr("productNum"));
-    }
-
-    @GetMapping("/mozuReceivingWorkOrders")
-    public AjaxResult mozuReceivingWorkOrders(OmProductionOrdeInfo paramOrder)
-    {
-        String paramProductNum = "";
-        OmProductionOrdeInfo lastOrder = omProductionOrdeInfoService.getLastOrder();
-        String orderJsonString = RestfulService.getProductionWorkOrderRequest(lastOrder.getProductNum(), "OP230");
         JSONObject jsonObject = new JSONObject(orderJsonString);
         // 浠嶫SONObject涓幏鍙杁ata瀵硅薄
         JSONObject dataObject = jsonObject.getJSONObject("data");
@@ -186,6 +149,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"));

--
Gitblit v1.9.3