From 69cd9f59a0fabf12f8c9147fcba7f69817a870b3 Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期一, 06 十一月 2023 23:40:59 +0800
Subject: [PATCH] 更新仓内抓拍2

---
 igds-protocol-zldz/src/main/java/com/ld/igds/protocol/zldz/analysis/AnalysisGrain.java |  117 +++++++++++++++-------------------------------------------
 1 files changed, 30 insertions(+), 87 deletions(-)

diff --git a/igds-protocol-zldz/src/main/java/com/ld/igds/protocol/zldz/analysis/AnalysisGrain.java b/igds-protocol-zldz/src/main/java/com/ld/igds/protocol/zldz/analysis/AnalysisGrain.java
index 5d1339d..8720573 100644
--- a/igds-protocol-zldz/src/main/java/com/ld/igds/protocol/zldz/analysis/AnalysisGrain.java
+++ b/igds-protocol-zldz/src/main/java/com/ld/igds/protocol/zldz/analysis/AnalysisGrain.java
@@ -163,8 +163,7 @@
      * @param msg
      * @throws Exception
      */
-    private void analysisStep(DepotConf depotConf, ReMessage msg,
-                              DeviceSer ser, ExeRequest exeRequest, DicSysConf sysConf) {
+    private void analysisStep(DepotConf depotConf, ReMessage msg, DeviceSer ser, ExeRequest exeRequest, DicSysConf sysConf) {
         // 绮儏鐨勬壒娆″彿閲嶆柊鏍规嵁棰戠巼璋冩暣
         msg.setBatchId(ContextUtil.getBatchIdByFireq(depotConf.getGrainFreq()));
 
@@ -508,6 +507,17 @@
             temps = grainUtil.reversalUpAndDown(temps, depotConf.getCableRule());
         }
 
+        //鑻ラ厤缃眰琛岃浆鎹紝鍒欏皢绮儏鏁版嵁杩涜灞傝杞崲
+        if (StringUtils.isNotEmpty(depotConf.getStartConvert())) {
+            temps = convertGrainPoint(temps, depotConf);
+            String[] cableRule = depotConf.getCableRule().split("-");
+            //杞崲灞傝鍒楅厤缃�
+            if(Constant.GRAIN_CONVERT_CLOCKWISE.equals(depotConf.getStartConvert())
+                    || Constant.GRAIN_CONVERT_ANTICLOCKWISE.equals(depotConf.getStartConvert())){
+                depotConf.setCableRule(Integer.valueOf(cableRule[1]) + "-" + Integer.valueOf(cableRule[0]) + "-" + Integer.valueOf(cableRule[2]));
+            }
+        }
+
         String[] attCable = depotConf.getCableRule().split("-");
         int cableZ = Integer.valueOf(attCable[0]);
         int cableY = Integer.valueOf(attCable[1]);
@@ -671,6 +681,24 @@
                 sysConf, notifyWeb, exeRequest);
     }
 
+    private List<Double> convertGrainPoint(List<Double> temps, DepotConf conf) {
+        if (Constant.GRAIN_CONVERT_DEFAULT.equals(conf.getStartConvert())) {
+            //鑻ュ眰琛岃浆鎹负榛樿锛屽垯鐩存帴杩斿洖
+            return temps;
+        }
+
+        //椤烘椂閽堣浆鎹�
+        if(Constant.GRAIN_CONVERT_CLOCKWISE.equals(conf.getStartConvert())){
+            return grainUtil.convertRight(temps, conf.getCableRule());
+        }
+        //閫嗘椂閽堣浆鎹�
+        if(Constant.GRAIN_CONVERT_ANTICLOCKWISE.equals(conf.getStartConvert())){
+            return grainUtil.convertLeft(temps, conf.getCableRule());
+        }
+
+        return temps;
+    }
+
     private List<Double> reversalGrainPoint(List<Double> temps, DepotConf conf) {
         if (StringUtils.isEmpty(conf.getStartOrientation())) {
             //鑻ヨ捣濮嬫柟浣嶄负绌猴紝鍒欓粯璁よ捣濮嬫柟浣嶅拰鏂瑰悜锛岀洿鎺ヨ繑鍥�
@@ -730,90 +758,5 @@
         }
 
         return temps;
-    }
-
-    /**
-     * 鍙嶈浆鍒� 鐜板疄涓粠宸﹁竟寮�濮嬶紝寮鸿灏嗗彸杈硅В鏋愪负绗竴鍒�
-     *
-     * @return
-     */
-    private List<Double> reversalCable(List<Double> temps, String cable) {
-        String[] attCable = cable.split("-");
-        int cableZ = Integer.valueOf(attCable[0]);
-        int cableY = Integer.valueOf(attCable[1]);
-        int cableX = Integer.valueOf(attCable[2]);
-        List<Double> t = new ArrayList<>();
-        for (int i = 1; i <= temps.size(); i++) {
-            t.add(temps.get((cableX - 1) * cableY * cableZ + ((i - 1) % (cableY * cableZ))));
-            if (i % (cableY * cableZ) == 0) {
-                cableX = cableX - 1;
-            }
-        }
-        return t;
-    }
-
-    /**
-     * 鐢电紗浠庝笅闈㈠紑濮嬫椂锛屽皢绮儏鐢电紗涓婁笅缈昏浆
-     *
-     * @param pointsData 绮儏鏁版嵁
-     * @param cable      灞傝鍒楅厤缃紝濡傦細4-7-11
-     * @return
-     */
-    private String reversalUpAndDown(String pointsData, String cable) {
-        String str = "";
-        if (StringUtils.isEmpty(cable)) {
-            str = pointsData;
-        }
-        String[] attCable = cable.split("-");
-        int cableZ = Integer.valueOf(attCable[0]); //灞�
-
-        String[] points = pointsData.split(",");
-        for (int i = 0; i <= points.length - cableZ; i += cableZ) {
-            for (int j = cableZ - 1; j >= 0; j--) {
-                str += points[i + j];
-                str += ",";
-            }
-        }
-        return str;
-    }
-
-    /**
-     * 鍙嶈浆鍒楀彿楠岃瘉
-     * 2022骞�5鏈�30鏃� 12:11:18
-     * vince
-     *
-     * @param args
-     */
-    public static void main(String[] args) {
-        List<Double> temps = new ArrayList<>();
-        int cableZ = 3;
-        int cableY = 4;
-        int cableX = 6;
-        for (int i = 1; i < (cableX * cableY * cableZ + 1); i++) {
-            temps.add(i + 0.0);
-        }
-
-        List<Double> t = new ArrayList<>();
-        for (int i = 1; i <= temps.size(); i++) {
-            t.add(temps.get((cableX - 1) * cableY * cableZ + ((i - 1) % (cableY * cableZ))));
-            if (i % (cableY * cableZ) == 0) {
-                cableX = cableX - 1;
-            }
-        }
-        for (Double x : t) {
-            System.out.print(x);
-            System.out.print(",");
-        }
-
-
-        System.out.println("--------------------------");
-        int i = 15;
-        int layMax = 10;
-
-        System.out.println(i % layMax);
-
-
-        System.out.println(i / layMax);
-
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3