Browse Source

获取WMS批次号所在库位麻烦您那加上返回的数量及重量

k 2 years ago
parent
commit
52ee9731be

+ 44 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/api/HualanApiController.java

@@ -15,6 +15,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.ReferenceMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -119,18 +120,58 @@ public class HualanApiController {
     @ApiOperation("ERP获取WMS批次号所在库位")
     @GetMapping("getLocByCon")
     public AjaxResult getLocByCon(String batchNum, String boxNo) {
+        if (StringUtils.isEmpty(batchNum)) {
+            AjaxResult.error("批号不能为空!");
+        }
         InvLocIdSearchFrom invLotLocIdQuery = new InvLocIdSearchFrom();
         LotattDTO lotattDTO = new LotattDTO();
         lotattDTO.setLotatt01(batchNum);
         lotattDTO.setLotatt07(boxNo);
         invLotLocIdQuery.setLotattDTO(lotattDTO);
         List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = invLotLocIdService.selectInvLocIdLotattList(invLotLocIdQuery);
-        Map<String, Set<String>> locMap = new HashMap<>();
-        Set<String> locSet = invLotLocIdLotattVOList.stream().map(v -> v.getLocationNo()).collect(Collectors.toSet());
-        locMap.put(batchNum, locSet);
+        Map<String, List<ReturnErp>> locMap = new HashMap<>();
+        List<ReturnErp> returnErpList = new ArrayList<>();
+        ReturnErp returnErp = null;
+        for (InvLotLocIdLotattVO locIdLotattVO : invLotLocIdLotattVOList) {
+            returnErp.setLocationNo(locIdLotattVO.getLocationNo());
+            returnErp.setQty(locIdLotattVO.getQty().toString());
+            returnErp.setWeight(locIdLotattVO.getLotatt02() == null ? "" : locIdLotattVO.getLotatt02());
+        }
+
+        locMap.put(batchNum, returnErpList);
         return AjaxResult.success(locMap);
     }
 
+    public static class ReturnErp {
+        private String locationNo;
+        private String weight;
+        private String qty;
+
+        public String getLocationNo() {
+            return locationNo;
+        }
+
+        public void setLocationNo(String locationNo) {
+            this.locationNo = locationNo;
+        }
+
+        public String getWeight() {
+            return weight;
+        }
+
+        public void setWeight(String weight) {
+            this.weight = weight;
+        }
+
+        public String getQty() {
+            return qty;
+        }
+
+        public void setQty(String qty) {
+            this.qty = qty;
+        }
+    }
+
     /**
      * 半成品入库时,人工操作PDA扫描周转箱外箱二维码,二维码内容为生产批号,WMS通过批号获取华兰上游系统的生产数据
      *