From 6d7aa57dc2769a36a4f00241f7b0014be79bb54f Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期六, 11 二月 2023 13:57:29 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/controller/OpenController.java      |   75 ++++++++++++------------
 src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java |   18 ++++--
 src/main/java/com/zy/common/service/CommonService.java        |   82 +++++++++++++-------------
 3 files changed, 91 insertions(+), 84 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/OpenController.java b/src/main/java/com/zy/asrs/controller/OpenController.java
index d173e1a..150e00f 100644
--- a/src/main/java/com/zy/asrs/controller/OpenController.java
+++ b/src/main/java/com/zy/asrs/controller/OpenController.java
@@ -39,7 +39,7 @@
     @AppAuth(memo = "鍟嗗搧淇℃伅鍚屾鎺ュ彛")
     public synchronized R syncMatInfo(@RequestHeader(required = false) String appkey,
                                       @RequestBody(required = false) MatSyncParam param,
-                                      HttpServletRequest request){
+                                      HttpServletRequest request) {
         auth(appkey, param, request);
         if (Cools.isEmpty(param)) {
             return R.parse(BaseRes.PARAM);
@@ -199,7 +199,6 @@
             orderDetails.add(detlDto);
         }
         System.out.println(JSON.toJSONString(param));
-        // 2
         System.out.println("======================================");
         OpenOrderCompleteParam param1 = new OpenOrderCompleteParam();
         param1.setOrderNo("963001846497017856");
@@ -208,11 +207,11 @@
 
     /*...........................璧e窞鏂板..............浠ヤ笅.............璧e窞鏂板...........................*/
     @PostMapping("/rpc/watchDog/auth/v1")
-//    @AppAuth(memo = "蹇冭烦鎺ュ彛璋冪敤")
+    @AppAuth(memo = "蹇冭烦鎺ュ彛璋冪敤")
     public synchronized R hostName(@RequestHeader(required = false) String appkey,
                                    @RequestBody(required = false) HeartBeat param,
-                                   HttpServletRequest request){
-        appkey="ea1f0459efc02a79f046f982767939ae";
+                                   HttpServletRequest request) {
+        appkey = "ea1f0459efc02a79f046f982767939ae";
         auth(appkey, param, request);
         if (Cools.isEmpty(param)) {
             return R.parse(BaseRes.PARAM);
@@ -220,17 +219,17 @@
 
         //........
         System.out.println(String.format("id:%s,hostName:%s,requestTime:%s",
-                param.getId(),param.getHostName(),param.getRequestTime()));
+                param.getId(), param.getHostName(), param.getRequestTime()));
 
         return R.ok();
     }
 
     @PostMapping("/rpc/pakIn/auth/v1")
-//    @AppAuth(memo = "鍏ュ簱閫氱煡鍗曟帴鍙h皟鐢�")
+    @AppAuth(memo = "鍏ュ簱閫氱煡鍗曟帴鍙h皟鐢�")
     public synchronized R combPack(@RequestHeader(required = false) String appkey,
                                    @RequestBody(required = false) CombParam param,
-                                   HttpServletRequest request){
-        appkey="ea1f0459efc02a79f046f982767939ae";
+                                   HttpServletRequest request) {
+        appkey = "ea1f0459efc02a79f046f982767939ae";
         auth(appkey, param, request);
         if (Cools.isEmpty(param)) {
             return R.parse(BaseRes.PARAM);
@@ -238,27 +237,28 @@
         //鐢熸垚鍏ュ簱閫氱煡妗�
         openService.combPACK(param);
 
-        Map<String,Boolean> map=new HashMap<>();
+        Map<String, Boolean> map = new HashMap<>();
         apiLogService.save(
                 "mes鐢宠鍏ュ簱",
                 "172.28.15.251",
                 null,
                 "127.0.0.1",
-                JSON.toJSONString("PackNo:"+param.getPackNo()
-                        +" PackName:"+param.getPackName()
-                        +" RequestTime:"+param.getRequestTime()
-                        +" SettingTimes:"+param.getSettingTimes()),
+                JSON.toJSONString("PackNo:" + param.getPackNo()
+                        + " PackName:" + param.getPackName()
+                        + " RequestTime:" + param.getRequestTime()
+                        + " SettingTimes:" + param.getSettingTimes()),
                 "172.28.15.251",
                 true
         );
-        map.put("isComplete",true);
+        map.put("isComplete", true);
         return R.ok(map);
     }
+
     @PostMapping("/rpc/pakOut/auth/v1")
-//    @AppAuth(memo = "鍑哄簱閫氱煡鍗曟帴鍙h皟鐢�")
+    @AppAuth(memo = "鍑哄簱閫氱煡鍗曟帴鍙h皟鐢�")
     public synchronized R combpakOut(@RequestHeader(required = false) String appkey,
-                                   @RequestBody(required = false) CombParam param,
-                                   HttpServletRequest request){
+                                     @RequestBody(required = false) CombParam param,
+                                     HttpServletRequest request) {
 
         auth(appkey, param, request);
         if (Cools.isEmpty(param)) {
@@ -267,48 +267,49 @@
         //鍑哄簱寮�濮�
         openService.combPackOut(param);
 
-        Map<String,Boolean> map=new HashMap<>();
-        map.put("isComplete",true);
+        Map<String, Boolean> map = new HashMap<>();
+        map.put("isComplete", true);
         return R.ok(map);
     }
 
     @PostMapping("/rpv/infoReview/auth/v1")
-//    @AppAuth(memo = "娴嬭瘯鏉$爜淇℃伅澶嶆牳璇锋眰")
+    @AppAuth(memo = "娴嬭瘯鏉$爜淇℃伅澶嶆牳璇锋眰")
     public synchronized R infoReview(@RequestHeader(required = false) String appkey,
-                                   @RequestBody(required = false) Review param,
-                                   HttpServletRequest request){
-        appkey="ea1f0459efc02a79f046f982767939ae";
+                                     @RequestBody(required = false) Review param,
+                                     HttpServletRequest request) {
+        appkey = "ea1f0459efc02a79f046f982767939ae";
         auth(appkey, param, request);
         if (Cools.isEmpty(param)) {
             return R.parse(BaseRes.PARAM);
         }
         TestMast testMast = openService.infoReview(param);
-        if (testMast.getStatus()==3){
+        if (testMast.getStatus() == 3) {
             return R.ok();
-        }else if (testMast.getStatus()==2){
+        } else if (testMast.getStatus() == 2) {
             return R.error("绛夊緟鍛樺伐鎿嶄綔");
         }
         return R.error();
     }
+
     @PostMapping("/rpv/testFinish/auth/v1")
-//    @AppAuth(memo = "娴嬭瘯瀹屾垚")
+    @AppAuth(memo = "娴嬭瘯瀹屾垚")
     public synchronized R testFinish(@RequestHeader(required = false) String appkey,
-                                @RequestBody(required = false) Review param,
-                                HttpServletRequest request){
-        appkey="ea1f0459efc02a79f046f982767939ae";
+                                     @RequestBody(required = false) Review param,
+                                     HttpServletRequest request) {
+        appkey = "ea1f0459efc02a79f046f982767939ae";
         auth(appkey, param, request);
-        Map<String,Boolean> map=new HashMap<>();
+        Map<String, Boolean> map = new HashMap<>();
 
         if (Cools.isEmpty(param)) {
             return R.parse(BaseRes.PARAM);
         }
-        if (param.getTestResult().equals("OK")){
-            map.put("isComplete",openService.testFinish(param));
-        }else if(param.getTestResult().equals("NG")){
+        if (param.getTestResult().equals("OK")) {
+            map.put("isComplete", openService.testFinish(param));
+        } else if (param.getTestResult().equals("NG")) {
             openService.testNG(param);
-            map.put("isComplete",false);
-        }else{
-            map.put("isComplete",false);
+            map.put("isComplete", false);
+        } else {
+            map.put("isComplete", false);
         }
         return R.ok(map);
     }
diff --git a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
index 2fdcb6d..0d4f9e4 100644
--- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -715,17 +715,19 @@
             review.setBarcode(testMast.getBarcode());
             review.setChannel(testMast.getChannel().toString());
             review.setRequestTime(DateUtils.convert(new Date()));
-            if (testMast.getChannel()>=1 && testMast.getChannel()<=8){
+            if (testMast.getChannel()<1 || testMast.getChannel()>48){
+                log.error("閫氶亾鏈夎锛岃鏌ョ湅锛�");
+            } else if (testMast.getChannel()<=8){
                 renUrl=renUrl1;
-            }else if (testMast.getChannel()>=9 && testMast.getChannel()<=16){
+            }else if (testMast.getChannel()<=16){
                 renUrl=renUrl2;
-            }else if (testMast.getChannel()>=17 && testMast.getChannel()<=24){
+            }else if (testMast.getChannel()<=24){
                 renUrl=renUrl3;
-            }else if (testMast.getChannel()>=25 && testMast.getChannel()<=32){
+            }else if (testMast.getChannel()<=32){
                 renUrl=renUrl4;
-            }else if (testMast.getChannel()>=33 && testMast.getChannel()<=40){
+            }else if (testMast.getChannel()<=40){
                 renUrl=renUrl5;
-            }else if (testMast.getChannel()>=41 && testMast.getChannel()<=48){
+            }else if (testMast.getChannel()<=48){
                 renUrl=renUrl6;
             }
             return postMesData(renUrl,startUpTestPACK,review);
@@ -805,6 +807,8 @@
                 case "48":
                     renUrl=renUrl6;
                     break;
+                default:
+                    log.error("閫氶亾鏈夎锛岃鏌ョ湅锛�");
             }
             return postMesData(renUrl,suspendTestPACK,review);
         }catch (Exception e) {
@@ -831,6 +835,8 @@
             name="娴嬭瘯绯荤粺";
         }else if (URL.equals(renUrl6)){
             name="娴嬭瘯绯荤粺";
+        }else {
+            log.error("鏌ヨ杩炴帴澶辫触锛岃鏌ョ湅锛�");
         }
         if(combParam != null){
             String response = "";
diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index 3ec9bd1..45880cc 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -52,6 +52,7 @@
 
     /**
      * 鐢熸垚宸ヤ綔鍙�
+     *
      * @param wrkMk 0:鍏ュ簱 1 - 3000 ; 1:鎷f枡/骞舵澘/鐩樼偣 3001 - 6000 ; 2: 鍑哄簱 6001 -9000 ; 3:鍏朵粬 9001 -9999
      * @return workNo(宸ヤ綔鍙�)
      */
@@ -64,17 +65,17 @@
         int workNo = wrkLastno.getWrkNo();
         int sNo = wrkLastno.getSNo();
         int eNo = wrkLastno.getENo();
-        workNo = workNo>=eNo ? sNo : workNo+1;
+        workNo = workNo >= eNo ? sNo : workNo + 1;
         while (true) {
             WrkMast wrkMast = wrkMastService.selectById(workNo);
             if (null != wrkMast) {
-                workNo = workNo>=eNo ? sNo : workNo+1;
+                workNo = workNo >= eNo ? sNo : workNo + 1;
             } else {
                 break;
             }
         }
         // 淇敼搴忓彿璁板綍
-        if (workNo > 0){
+        if (workNo > 0) {
             wrkLastno.setWrkNo(workNo);
             wrkLastnoService.updateById(wrkLastno);
         }
@@ -82,7 +83,7 @@
         if (workNo == 0) {
             throw new CoolException("鐢熸垚宸ヤ綔鍙峰け璐ワ紝璇疯仈绯荤鐞嗗憳");
         } else {
-            if (wrkMastService.selectById(workNo)!=null) {
+            if (wrkMastService.selectById(workNo) != null) {
                 throw new CoolException("鐢熸垚宸ヤ綔鍙�" + workNo + "鍦ㄥ伐浣滄。涓凡瀛樺湪");
             }
         }
@@ -91,19 +92,22 @@
 
     /**
      * 妫�绱㈠簱浣嶅彿
-     * @param whsType 绫诲瀷 1:鍙屾繁寮忚揣鏋�
-     * @param staDescId 璺緞宸ヤ綔绫诲瀷
+     *
+     * @param whsType     绫诲瀷 1:鍙屾繁寮忚揣鏋�
+     * @param staDescId   璺緞宸ヤ綔绫诲瀷
      * @param sourceStaNo 婧愮珯
-     * @param matNos 鍟嗗搧缂栧彿闆嗗悎
+     * @param matNos      鍟嗗搧缂栧彿闆嗗悎
      * @return locNo 妫�绱㈠埌鐨勫簱浣嶅彿
      */
     @Transactional
     public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto, int times) {
 
-        if (sourceStaNo.equals(100)){
-            whsType=1;
-        }else if (sourceStaNo.equals(200)){
-            whsType=2;
+        if (sourceStaNo.equals(100)) {
+            whsType = 1;
+            locTypeDto.setLocType1((short) 1);
+        } else if (sourceStaNo.equals(200)) {
+            whsType = 2;
+            locTypeDto.setLocType1((short) 2);
         }
 
         StartupDto startupDto = new StartupDto();
@@ -123,12 +127,12 @@
         // 鐩爣搴撲綅
         LocMast locMast = null;
 
-        if (curRow==3){
-            curRow=4;
-        }else if (curRow==4){
-            curRow=3;
-        }else {
-            rowCount=0;
+        if (curRow == 3) {
+            curRow = 4;
+        } else if (curRow == 4) {
+            curRow = 3;
+        } else {
+            rowCount = 0;
         }
 
         if (crnNo == 0) {
@@ -146,26 +150,24 @@
         }
         BasDevp staNo = basDevpService.selectById(staDesc.getCrnStn());
         if (!staNo.getAutoing().equals("Y")) {
-            throw new CoolException("鐩爣绔�"+staDesc.getCrnStn()+"涓嶅彲鐢�");
+            throw new CoolException("鐩爣绔�" + staDesc.getCrnStn() + "涓嶅彲鐢�");
         }
 
         // 鏇存柊搴撲綅鎺掑彿
         rowLastno.setCurrentRow(curRow);
         rowLastnoService.updateById(rowLastno);
 
-        // 寮�濮嬫煡鎵惧簱浣� ==============================>>
-        if (Cools.isEmpty(locMast)) {
-            Integer ruleId = Integer.parseInt(Parameter.get().getFindLocRule());
-            if (whsType!=1){
-                locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1());
-            } else if (ruleId == 1){  //鎸夋祴璇曡澶囨帓搴忥紝浼樺厛鎺掓弧鍗曞彴璁惧
-                locMast = locMastService.queryFreeLocMast1(curRow, locTypeDto.getLocType1() ,channelMax+1);
-            } else if (ruleId == 2){  //鎸夐�氶亾鎺掑簭锛屽潎鍖�鍒嗛厤姣忓彴璁惧
-                Short locType2 = getLocType2Small(curRow, locTypeDto.getLocType1());
-                locMast = locMastService.queryFreeLocMast2(curRow, locTypeDto.getLocType1() ,locType2);
-            } else { //榛樿瑙勫垯
-                locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1());
-            }
+        // 寮�濮嬫煡鎵惧簱浣� ==============================>
+        int ruleId = Integer.parseInt(Parameter.get().getFindLocRule());
+        if (whsType != 1) {
+            locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1());
+        } else if (ruleId == 1) {  //鎸夋祴璇曡澶囨帓搴忥紝浼樺厛鎺掓弧鍗曞彴璁惧
+            locMast = locMastService.queryFreeLocMast1(curRow, locTypeDto.getLocType1(), channelMax + 1);
+        } else if (ruleId == 2) {  //鎸夐�氶亾鎺掑簭锛屽潎鍖�鍒嗛厤姣忓彴璁惧
+            Short locType2 = getLocType2Small(curRow, locTypeDto.getLocType1());
+            locMast = locMastService.queryFreeLocMast2(curRow, locTypeDto.getLocType1(), locType2);
+        } else { //榛樿瑙勫垯
+            locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1());
         }
 
         // 2.搴撲綅褰撳墠鎵�灞炲昂瀵告棤绌哄簱浣嶆椂锛岃皟鏁村昂瀵稿弬鏁帮紝鍚戜笂鍏煎妫�绱㈠簱浣�
@@ -175,7 +177,6 @@
                 times = times + 1;
                 return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, times);
             }
-
             log.error("绯荤粺娌℃湁绌哄簱浣嶏紒锛侊紒 灏哄瑙勬牸锛� {}锛� 杞娆℃暟锛歿}", JSON.toJSONString(locTypeDto), times);
             throw new CoolException("娌℃湁绌哄簱浣�");
         }
@@ -192,17 +193,16 @@
         return startupDto;
     }
 
-    public Short getLocType2Small(Integer curRow,short locType1){
-        Integer OCount = locMastService.queryFreeLocMastCount(curRow, locType1, (short)1);
-        short locType2=1;
-        for (int i=2;i<equipmentCount+1;i++){
-            Integer integer =locMastService.queryFreeLocMastCount(curRow, locType1, (short)i);
-            if (OCount<integer){
-                OCount=integer;
-                locType2=(short)i;
+    public Short getLocType2Small(Integer curRow, short locType1) {
+        Integer OCount = locMastService.queryFreeLocMastCount(curRow, locType1, (short) 1);
+        short locType2 = 1;
+        for (int i = 2; i < equipmentCount + 1; i++) {
+            Integer integer = locMastService.queryFreeLocMastCount(curRow, locType1, (short) i);
+            if (OCount < integer) {
+                OCount = integer;
+                locType2 = (short) i;
             }
         }
-
         return locType2;
     }
 

--
Gitblit v1.9.1