Parcourir la source

库位重置test优化

ChenYang il y a 1 an
Parent
commit
e6c35fa33f

+ 2 - 2
ruoyi-admin/src/main/resources/application-dev.yml

@@ -6,7 +6,7 @@ spring:
         druid:
             # 主库数据源
             master:
-                url: jdbc:mysql://47.100.220.92:3306/warewms_xuankuang_liwei?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
+                url: jdbc:mysql://47.100.220.92:3306/warewms_xuankuang_cy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
                 username: warewms
                 password: warewms123
                 driverClassName: com.mysql.cj.jdbc.Driver
@@ -58,7 +58,7 @@ spring:
                         multi-statement-allow: true
     redis:
         # 地址
-        host: 192.168.157.130
+        host: 154.12.20.200
         # 端口,默认为6379
         port: 6379
         # 数据库索引

+ 26 - 37
ruoyi-admin/src/test/java/com/ruoyi/admin/test/base/ProcessLocationTest.java

@@ -97,17 +97,11 @@ public class ProcessLocationTest {
             }catch (RuntimeException ex){
                 log.warn("ex is {}", ex);
                 errorLocLotList.add(locLotModel);
-                continue;
             }
         }
         System.err.println(JSONObject.toJSONString(errorLocLotList));
     }
 
-
-    @Test
-    public void name() {
-    }
-
     /**
      * 重置一个库的库位库存信息
      * @param locationNo 库位号
@@ -122,9 +116,8 @@ public class ProcessLocationTest {
         if (ObjectUtil.isNull(baseLocationInfo)) return;
         if(StringUtils.isBlank(bindSku) && ObjectUtil.isNotNull(quantity)) return;
 
-
         //2.1 如果当前库位是空的,或者库位数量是空的,则删除inv_lot_loc_id中的库存数据并重置库位数据
-        if((ObjectUtil.isNull(quantity) || CompareUtil.compare(quantity, BigDecimal.ZERO)<=0)){
+        if(ObjectUtil.isNull(quantity) || CompareUtil.compare(quantity, BigDecimal.ZERO)<=0){
             //生成新的批次记录
             invLotAttService.insertInvLotAtt(bindSku, palletNo);
             invLotLocIdService.deleteInvLotLocList(baseLocationInfo.getId());
@@ -132,35 +125,31 @@ public class ProcessLocationTest {
             return;
         }
 
-        if(StringUtils.isNotBlank(bindSku)
-                && ObjectUtil.isNotNull(quantity)
-                && CompareUtil.compare(quantity, BigDecimal.ZERO) > 0){
-            //查出原先的库存情况,如果当前库存SKU不符合,则生成新的批次记录
-            List<InvLotLocId> invLotLocList = invLotLocIdService.getInvLotLocList(baseLocationInfo.getId());
-            if(CollectionUtil.isNotEmpty(invLotLocList)){
-                //此时数据是错的都要重新生成库存
-                List<String> skuList = invLotLocList.stream().map(item -> item.getSku()).collect(Collectors.toList());
-                if(CollectionUtil.isEmpty(skuList) || skuList.size() > 1 || !StringUtils.equals(skuList.get(0), bindSku)){
-                    //生成新的批次记录
-                    String lotnum = invLotAttService.insertInvLotAtt(bindSku, palletNo);
-                    //删除原先的库存记录`,生成新的库存记录
-                    invLotLocIdService.deleteInvLotLocList(baseLocationInfo.getId());
-                    invLotLocIdService.insertInvLotLocId(baseLocationInfo.getId(), lotnum, bindSku, quantity);
-                    //重置库位数据
-                    reSetLocationInfo(baseLocationInfo, bindSku, Constants.NO, skuTypeMapping);
-                    return;
-                } else {
-                    //此时只有数量是错的,那么update一下数量就好
-                    InvLotLocId invLotLocId = invLotLocList.get(0);
-                    invLotLocId.setQty(quantity);
-                    //TODO  其他关于数量的字段要改嘛
-                    invLotLocId.setQtyEach(quantity);
-                    invLotLocIdService.updateInvLotLocId(invLotLocId);
-                    //重置库存数据
-                    reSetLocationInfo(baseLocationInfo, bindSku, Constants.NO, skuTypeMapping);
-                    return;
-                }
-            }
+        //查出原先的库存情况,如果当前库存SKU不符合,则生成新的批次记录
+        List<InvLotLocId> invLotLocList = invLotLocIdService.getInvLotLocList(baseLocationInfo.getId());
+        if(CollectionUtil.isEmpty(invLotLocList)) return;
+        //此时数据是错的都要重新生成库存
+        List<String> skuList = invLotLocList.stream().map(item -> item.getSku()).collect(Collectors.toList());
+        if(CollectionUtil.isEmpty(skuList) || skuList.size() > 1 || !StringUtils.equals(skuList.get(0), bindSku)){
+            //生成新的批次记录
+            String lotnum = invLotAttService.insertInvLotAtt(bindSku, palletNo);
+            //删除原先的库存记录`,生成新的库存记录
+            invLotLocIdService.deleteInvLotLocList(baseLocationInfo.getId());
+            invLotLocIdService.insertInvLotLocId(baseLocationInfo.getId(), lotnum, bindSku, quantity);
+            //重置库位数据
+            reSetLocationInfo(baseLocationInfo, bindSku, Constants.NO, skuTypeMapping);
+            return;
+        }
+        if(CompareUtil.compare(invLotLocList.get(0).getQty(), quantity) != 0){
+            //此时只有数量是错的,那么update一下数量就好
+            InvLotLocId invLotLocId = invLotLocList.get(0);
+            invLotLocId.setQty(quantity);
+            //TODO  其他关于数量的字段要改嘛
+            invLotLocId.setQtyEach(quantity);
+            invLotLocIdService.updateInvLotLocId(invLotLocId);
+            //重置库存数据
+            reSetLocationInfo(baseLocationInfo, bindSku, Constants.NO, skuTypeMapping);
+            return;
         }
     }