From aa5f09da9849ea4465b2e9e50a4c9df7b85f7948 Mon Sep 17 00:00:00 2001
From: cl <418351270@qq.com>
Date: 星期一, 15 七月 2024 10:30:41 +0800
Subject: [PATCH] 修改参数采集

---
 jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java |   43 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 39 insertions(+), 4 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 12dc6e2..6a0efe1 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
@@ -289,11 +289,11 @@
                 omProductionOrdeInfo.setWorkOrderNo(dataObject.getStr("productionOrderNum"));
                 omProductionOrdeInfo.setProductNum(dataObject.getStr("productNum"));
                 omProductionOrdeInfo.setStationCode(dataObject.getStr("stationCode"));
-                omProductionOrdeInfo.setMaterialCode(dataObject.getStr("materialCode"));
+                omProductionOrdeInfo.setProductCode(dataObject.getStr("materialCode"));
                 omProductionOrdeInfo.setPlanQty(Long.valueOf(dataObject.getStr("plannedQuantity")));
                 omProductionOrdeInfo.setOnlineCompletionMark("0");
                 omProductionOrdeInfo.setSfResult("0");
-                omProductionOrdeInfo.setProductCode(dataObject.getStr("model"));
+                omProductionOrdeInfo.setProductModel(dataObject.getStr("model"));
                 omProductionOrdeInfo.setCreateTime(new Date());
                 omProductionOrdeInfo.setCreateUser("宸ュ巶MES");
                 omProductionOrdeInfoService.save(omProductionOrdeInfo);
@@ -483,6 +483,8 @@
                         paramValue = readWriteEntityList.get(i).getValue().toString();//鍙傛暟鍊�
                         if("DATE".equals(list.get(i).getCollectParameterType()) && !paramValue.isEmpty()){
                             paramValue = format.parse(TimeUtil.test(TimeUtil.stringProcessing(paramValue))).toString();
+                        }else if("MODEL".equals(list.get(i).getCollectParameterType()) && !paramValue.isEmpty()){
+                            paramValue = Constants.materialMap.get(paramValue);
                         }
                     }
                     daParamCollection.setParamValue(paramValue);//鍙傛暟鍊�
@@ -921,12 +923,45 @@
             HttpRequest httpRequest = HttpRequest.get(url);
             result =  response.body();
         }catch (Exception e){
-            e.printStackTrace();
+            throw new RuntimeException(e);
         }finally {
             return result;
         }
-
     }
 
 
+    /**
+     * 鑾峰彇閲囬泦鍙傛暟鍩虹鏁版嵁
+     * @param productCode
+     * @param stationCode
+     * @return list
+     */
+    public List<ChildVO> getCollectParamBasicData(String productCode , String stationCode) {
+        List<ChildVO> basicList = new ArrayList<>();
+        try {
+            //鏌ヨ鍙傛暟閰嶇疆琛�
+            List<DaCollectionParamConf> list = collectionParamConfService.list(new LambdaQueryWrapper<DaCollectionParamConf>()
+                    .eq(DaCollectionParamConf::getProcessesCode, stationCode)//宸ヤ綅
+                    .eq(DaCollectionParamConf::getCollectParameterType, "BASIC")//閲囬泦鍙傛暟绫诲瀷
+            );
+            if (CollUtil.isNotEmpty(list)){
+                for(DaCollectionParamConf conf:list){
+                    ChildVO childVO = new ChildVO();
+                    childVO.setItemCode(conf.getCollectParameterId());//鍙傛暟
+                    childVO.setItemType(conf.getItemType());
+                    childVO.setItemValue(conf.getParamCentral());//鍙傛暟鍊�
+                    childVO.setItemText(conf.getCollectParameterName());
+                    childVO.setCheckResult("1");
+                    childVO.setCheckTime(format.format(new Date()));
+                    basicList.add(childVO);
+                }
+            }
+            return basicList;
+        }catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+
+
 }

--
Gitblit v1.9.3