From 35e4b399293504212c4389cbc433c400a37fdd31 Mon Sep 17 00:00:00 2001
From: pang.jiabao <pang_jiabao@163.com>
Date: 星期日, 18 八月 2024 14:52:06 +0800
Subject: [PATCH] 空托盘回流到一楼出库口完成任务

---
 src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java |   69 +++++++++++++++++++++++++++++++++-
 1 files changed, 66 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
index f02d5c1..439d277 100644
--- a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -42,6 +42,12 @@
 @Service
 public class OpenServiceImpl implements OpenService {
 
+    // 浜屾ゼ鍫嗗灈鏈哄搴斿叆搴撶珯鐐�
+    private static final int[] secondFloorIn = new int[]{0,2061,2064,2067,2070,2073,2076};
+    // 鍫嗗灈鏈哄搴斾竴妤煎嚭搴撶珯鐐�
+    private static final int[] secondFloorOut = new int[]{0,3002,3003,3006,3008,3009,3012};
+
+
     @Autowired
     private OrderService orderService;
     @Autowired
@@ -1043,7 +1049,10 @@
         StartupDto dto = commonService.getLocNo(1, param.getPalletizingNo(), locTypeDto, 0);
 
         // 杩斿洖GWCS鐩爣淇℃伅
-        pushStaNoToGwcs(param.getPalletizingNo(), dto.getStaNo(), dto.getWorkNo());
+        boolean result = pushStaNoToGwcs(param.getPalletizingNo(), dto.getStaNo(), dto.getWorkNo(), param.getBarcode());
+//        if (!result) {
+//            throw new CoolException("鍏ュ簱鍥炴帹鍏ュ簱鐮佸ご缁橤WCS澶辫触");
+//        }
 
         int workNo = dto.getWorkNo();
         Date now = new Date();
@@ -1114,6 +1123,58 @@
 
     @Override
     @Transactional
+    public R kthl(KthlParam param) {
+
+        // 鑾峰彇妯″紡涓虹數鑴戞ā寮忥紝鏃犱换鍔$殑鍫嗗灈鏈哄垪琛�:闃叉鍒嗛厤鍒板爢鍨涙満涓嶅彲鐢�
+        List<BasCrnp> basCrnps = basCrnpService.selectList(new EntityWrapper<BasCrnp>().eq("crn_sts",3)
+                .eq("wrk_no",0).eq("in_enable","Y").eq("out_enable","Y"));
+        if (basCrnps.isEmpty()) {
+            // 閮芥湁浠诲姟鍒欒幏鍙栫數鑴戞ā寮忕殑鍫嗗灈鏈哄垪琛�
+            basCrnps = basCrnpService.selectList(new EntityWrapper<BasCrnp>().eq("crn_sts",3).eq("in_enable","Y")
+                    .eq("out_enable","Y"));
+        }
+        if (basCrnps.isEmpty()) {
+            throw new CoolException("娌℃湁鍙敤鍫嗗灈鏈�,鍫嗗灈鏈哄仠姝㈡垨寮傚父鎴栫鐢�");
+        }
+        // 鍙敤鍫嗗灈鏈哄垪琛�
+        List<Integer> crnNoList = basCrnps.stream().map(BasCrnp::getCrnNo).collect(Collectors.toList());
+        Integer crnNo = crnNoList.get(0);
+
+        int workNo = commonService.getWorkNo(5);
+        Date now = new Date();
+        // 鐢熸垚宸ヤ綔妗�
+        WrkMast wrkMast = new WrkMast();
+        wrkMast.setWrkNo(workNo);
+        wrkMast.setIoTime(new Date());
+        wrkMast.setWrkSts(1L); //
+        wrkMast.setIoType(3); // 绔欏埌绔�
+        wrkMast.setIoPri(14D); // 浼樺厛绾�
+        wrkMast.setCrnNo(crnNo);
+        wrkMast.setSourceStaNo(secondFloorIn[crnNo]);
+        wrkMast.setStaNo(secondFloorOut[crnNo]);
+        wrkMast.setLocNo("");
+        wrkMast.setBarcode(param.getBarcode()); // 鎵樼洏鐮�
+        wrkMast.setFullPlt("N"); // 婊℃澘锛歒
+        wrkMast.setPicking("N"); // 鎷f枡
+        wrkMast.setExitMk("N"); // 閫�鍑�
+        wrkMast.setEmptyMk("Y"); // 绌烘澘
+        wrkMast.setLinkMis("Y");
+        wrkMast.setCtnType(1); // 瀹瑰櫒绫诲瀷
+        // 鎿嶄綔浜哄憳鏁版嵁
+        wrkMast.setAppeTime(now);
+        wrkMast.setModiTime(now);
+        boolean res = wrkMastService.insert(wrkMast);
+        if (!res) {
+            throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
+        }
+        // 杩斿洖GWCS鐩爣淇℃伅
+        pushStaNoToGwcs(param.getPalletizingNo(),wrkMast.getSourceStaNo(),workNo,param.getBarcode());
+
+        return R.ok("绌烘墭鍥炴祦璇锋眰鎴愬姛");
+    }
+
+    @Override
+    @Transactional
     public R gwmsGenerateInventory(GwmsGenerateInventoryDto param) {
 
         if (Cools.isEmpty(param)) {
@@ -1141,7 +1202,7 @@
         StartupDto dto = commonService.getLocNo(iotype, param.getPalletizingNo(), locTypeDto,0);
 
         // 杩斿洖GWCS鐩爣淇℃伅
-        pushStaNoToGwcs(param.getPalletizingNo(),dto.getStaNo(),dto.getWorkNo());
+        pushStaNoToGwcs(param.getPalletizingNo(),dto.getStaNo(),dto.getWorkNo(),param.getBarcode());
 
 
         int workNo = dto.getWorkNo();
@@ -1593,7 +1654,7 @@
         return wrkDetls.size() > 1 ? 0 : 1; // 涓�鏉¤褰曞氨鏄竴鍗�
     }
 
-    public void pushStaNoToGwcs(Integer palletizingNo, Integer staNo, Integer workNo) {
+    public boolean pushStaNoToGwcs(Integer palletizingNo, Integer staNo, Integer workNo,String barcode) {
         boolean success = false;
         // 鑾峰彇璇锋眰澶�
         Map<String, Object> headers = getHeaders();
@@ -1603,6 +1664,7 @@
         jsonObject.put("workNo", workNo);
         jsonObject.put("staNo", staNo);
         jsonObject.put("sourceStaNo", palletizingNo);
+        jsonObject.put("barcode", barcode);
         String body = jsonObject.toJSONString();
         String response = "";
         try {
@@ -1643,6 +1705,7 @@
                 log.error("", e);
             }
         }
+        return success;
     }
 
     Map<String, Object> getHeaders(){

--
Gitblit v1.9.1