Browse Source

数值类型修改

xmy 1 month ago
parent
commit
1dc2ce82f2
1 changed files with 21 additions and 15 deletions
  1. 21 15
      mjava-mc/src/main/java/com/malk/mc/service/impl/McYdServiceImpl.java

+ 21 - 15
mjava-mc/src/main/java/com/malk/mc/service/impl/McYdServiceImpl.java

@@ -245,7 +245,12 @@ public class McYdServiceImpl implements McYdService {
             String LBJId = map1.get("textField_ma1usp6o").toString();//零部件的实例id
             entries.add(LBJId);
             System.out.println("物料名称:"+map1.get("textField_m99kztjo").toString());
-            Integer numberFieldM9qdwvu1 = (Integer) map1.get("numberField_m9qdwvu1") - (Integer) map1.get("numberField_m8mo8508");//存库数量 - 出库数量
+            BigDecimal InventoryCount = BigDecimal.valueOf(0);//库存数量
+            BigDecimal OutboundQuantity = BigDecimal.valueOf(0);//
+            if(!map1.get("numberField_m9qdwvu1_value").toString().isEmpty()){
+                 InventoryCount = new BigDecimal( map1.get("numberField_m9qdwvu1").toString());
+            }
+            BigDecimal numberFieldM9qdwvu1 = InventoryCount.subtract( new BigDecimal( map1.get("numberField_m8mo8508").toString()));//存库数量 - 出库数量
             System.out.println("出库后数量:"+numberFieldM9qdwvu1);
 
             Map d1 = ydClient.queryData(YDParam.builder().formInstId(LBJId)
@@ -274,18 +279,18 @@ public class McYdServiceImpl implements McYdService {
                     .systemToken("XH866P81QDOTQ0218TGZM9WCNXOF24WIP488M7A5")
                     .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("tableField_m96gje14",maps_YD)))
                     .userId("332051151139376769").build(),YDConf.FORM_OPERATION.update);
-            Integer InventoryQuantity = (Integer) d1.get("numberField_m8obn6wk");//库存数量
-            Integer FreezeQuantity = null;
+            BigDecimal InventoryQuantity = new BigDecimal( d1.get("numberField_m8obn6wk").toString());//库存数量
+            BigDecimal FreezeQuantity = null;
             if(!d1.get("numberField_m8obn6wl_value").toString().isEmpty()){
-                FreezeQuantity = (Integer) d1.get("numberField_m8obn6wl");//冻结数量
+                FreezeQuantity = new BigDecimal( d1.get("numberField_m8obn6wl").toString());//冻结数量
             }else {
-                FreezeQuantity = 0;
+                FreezeQuantity = BigDecimal.valueOf(0);
             }
 
             System.out.println("--------------------零部件子表数据修改完毕!---------------------");
 
-            Integer FreezeQuantity_AAA = FreezeQuantity + (Integer) map1.get("numberField_m8mo8508");//冻结数量(新)
-            Integer AvailableQuantity_AAA = InventoryQuantity - FreezeQuantity_AAA;//可用存库数量(新)
+            BigDecimal FreezeQuantity_AAA = FreezeQuantity.add( new BigDecimal( map1.get("numberField_m8mo8508").toString()));//冻结数量(新)
+            BigDecimal AvailableQuantity_AAA = numberFieldM9qdwvu1;//可用存库数量(新)
             ydClient.operateData(YDParam.builder().formInstId(LBJId)
                     .formUuid("FORM-2353BE632D97434DAD55AEBD0866C44DVAT5")
                     .appType("APP_GNQ1RGK68X4JNZUEU8RQ")
@@ -301,7 +306,7 @@ public class McYdServiceImpl implements McYdService {
 
     @Override
     public McR WarehouseStorage(Map map) {
-        String formInstId = UtilMap.getString(map,"formInstId");//实例id(库单)
+        String formInstId = UtilMap.getString(map,"formInstId");//实例id(库单)
         Map d = ydClient.queryData(YDParam.builder().formInstId(formInstId)
                 .formUuid("FORM-6DED8EB4CF0446DB8841C7798E106F2886OH")
                 .appType("APP_GNQ1RGK68X4JNZUEU8RQ")
@@ -315,7 +320,8 @@ public class McYdServiceImpl implements McYdService {
             String LBJId = map1.get("textField_ma3jhnpr").toString();//零部件的实例id
             entries.add(LBJId);
             System.out.println("物料名称:"+map1.get("textField_m9b1vd2w").toString());
-            Integer numberFieldM9qdwvu1 = (Integer) map1.get("numberField_ma3jwnr3") + (Integer) map1.get("numberField_m8mseubm");//存库数量 + 入库数量
+
+            BigDecimal numberFieldM9qdwvu1 = new BigDecimal( map1.get("numberField_ma3jwnr3").toString() ).add(new BigDecimal( map1.get("numberField_m8mseubm").toString()));//存库数量 + 入库数量
             System.out.println("入库后数量:"+numberFieldM9qdwvu1);
 
             Map d1 = ydClient.queryData(YDParam.builder().formInstId(LBJId)
@@ -344,18 +350,18 @@ public class McYdServiceImpl implements McYdService {
                     .systemToken("XH866P81QDOTQ0218TGZM9WCNXOF24WIP488M7A5")
                     .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("tableField_m96gje14",maps_YD)))
                     .userId("332051151139376769").build(),YDConf.FORM_OPERATION.update);
-            Integer InventoryQuantity = (Integer) d1.get("numberField_m8obn6wk");//库存数量
-            Integer VirtualQuantity = null;
+            BigDecimal InventoryQuantity = new BigDecimal( d1.get("numberField_m8obn6wk").toString());//库存数量
+            BigDecimal VirtualQuantity = null;
             if(!d1.get("numberField_m8obn6wq_value").toString().isEmpty()){
-                VirtualQuantity = (Integer) d1.get("numberField_m8obn6wq");//虚拟数量
+                VirtualQuantity = new BigDecimal( d1.get("numberField_m8obn6wq").toString());//虚拟数量
             }else {
-                VirtualQuantity = 0;
+                VirtualQuantity = BigDecimal.valueOf(0);
             }
 
             System.out.println("--------------------零部件子表数据修改完毕!---------------------");
 
-            Integer VirtualQuantity_AAA = VirtualQuantity + (Integer) map1.get("numberField_m8mseubm");//虚拟数量(新)
-            Integer AvailableQuantity_AAA = InventoryQuantity + VirtualQuantity_AAA;//可用存库数量(新)
+            BigDecimal VirtualQuantity_AAA = VirtualQuantity.add( new BigDecimal( map1.get("numberField_m8mseubm").toString()));//虚拟数量(新)
+            BigDecimal AvailableQuantity_AAA = InventoryQuantity .add (new BigDecimal( map1.get("numberField_m8mseubm").toString()));//可用存库数量(新)
             ydClient.operateData(YDParam.builder().formInstId(LBJId)
                     .formUuid("FORM-2353BE632D97434DAD55AEBD0866C44DVAT5")
                     .appType("APP_GNQ1RGK68X4JNZUEU8RQ")