From fae4bd828a6b81b95f53e285fcb4749fbd80c7bf Mon Sep 17 00:00:00 2001 From: CZT <czt18638530771@163.com> Date: 星期一, 04 九月 2023 17:31:46 +0800 Subject: [PATCH] 增加粮情层行转换配置 --- igds-protocol-zldz/src/main/java/com/ld/igds/protocol/zldz/analysis/AnalysisGrain.java | 114 ++++++++++++++------------------------------------------ 1 files changed, 29 insertions(+), 85 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..983803d 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 @@ -508,6 +508,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 +682,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 +759,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