فهرست منبع

Merge remote-tracking branch 'origin/develop' into develop

沈静伟 2 سال پیش
والد
کامیت
b5fa43f107

+ 4 - 0
src/custom/restcontroller/R.java

@@ -5245,6 +5245,10 @@ public class R {
         public static class v1 {
         }
     }
+    public static class ID20230913154803 {
+        public static class v1 {
+        }
+    }
 
 
 }

+ 34 - 2
src/custom/restcontroller/webmanage/sale/item/Item.java

@@ -328,8 +328,9 @@ public class Item extends Controller {
         object.put("content", content);
 
          WebRequest request = new WebRequest();
-        String result = request.doPost(object.toString(),
-                "http://60.190.151.198:8089/BYESB/jaxrs/webclientrest");
+         String result ="";
+//        String result = request.doPost(object.toString(),
+//                "http://60.190.151.198:8089/BYESB/jaxrs/webclientrest");
         for (Row row : rows) {
             JSONArray jsonArrayResult = new JSONArray();
             if(isJSONArray(result)){
@@ -353,6 +354,37 @@ public class Item extends Controller {
         return getSucReturnObject().setData(rows.isNotEmpty() ? rows.get(0) : new Row()).toString();
     }
 
+    @API(title = "货品档案库存查询", apiversion = R.ID20230913154803.v1.class)
+    public String queryInvbalQty() throws YosException {
+
+        Long itemid = content.getLong("itemid");
+        Rows rows = dbConnect.runSqlQuery("select itemno from plm_item where siteid='"+siteid+"' and itemid="+itemid);
+
+        JSONObject object = new JSONObject();
+        object.put("classname", "getIcinvbal");
+        object.put("method", "getMsg");
+
+        JSONObject content = new JSONObject();
+        content.put("fitemnos",  rows.toJsonArray("itemno"));
+        object.put("content", content);
+
+        WebRequest request = new WebRequest();
+        String result = request.doPost(object.toString(),
+                "http://60.190.151.198:8089/BYESB/jaxrs/webclientrest");
+        for (Row row : rows) {
+            JSONArray jsonArrayResult = new JSONArray();
+            if(isJSONArray(result)){
+                jsonArrayResult = JSONArray.parseArray(result);
+            }
+            if(!jsonArrayResult.isEmpty()){
+                row.put("invbal_qty",((JSONObject)jsonArrayResult.get(0)).getBigDecimal("FQty"));
+            }else{
+                row.put("invbal_qty",0);
+            }
+        }
+        return getSucReturnObject().setData(rows.isNotEmpty() ? rows.get(0) : new Row()).toString();
+    }
+
     @API(title = "货品档案列表", apiversion = R.ID20220923140602.v1.class)
     @CACHEING
     public String queryList() throws YosException, IOException {

+ 12 - 8
src/custom/restcontroller/webmanage/sale/order/OrderItemsHelper.java

@@ -40,8 +40,10 @@ public class OrderItemsHelper extends BaseClass {
                 if (itemRowsMap.get(itemid).isNotEmpty()) {
                     BigDecimal orderaddqty = itemRowsMap.get(itemid).get(0).getBigDecimal("orderaddqty");
                     BigDecimal orderminqty = itemRowsMap.get(itemid).get(0).getBigDecimal("orderminqty");
-                    if (((qty.subtract(orderminqty)).remainder(orderaddqty)).compareTo(BigDecimal.ZERO) != 0 || qty.compareTo(orderminqty)<0) {
-                        throw new YosException(false,"品号为" + itemRowsMap.get(itemid).get(0).getString("itemno") + "的商品数量不符合该商品的起订量和增量");
+                    if (orderaddqty.compareTo(BigDecimal.ZERO) != 0) {
+                        if (((qty.subtract(orderminqty)).remainder(orderaddqty)).compareTo(BigDecimal.ZERO) != 0 || qty.compareTo(orderminqty) < 0) {
+                            throw new YosException(false, "品号为" + itemRowsMap.get(itemid).get(0).getString("itemno") + "的商品数量不符合该商品的起订量和增量");
+                        }
                     }
                 }
             }
@@ -55,12 +57,14 @@ public class OrderItemsHelper extends BaseClass {
                     BigDecimal orderaddqty = pRowsMap.get(itemid).get(0).getBigDecimal("orderaddqty");
                     BigDecimal orderminqty = pRowsMap.get(itemid).get(0).getBigDecimal("orderminqty");
                     boolean islimit = pRowsMap.get(itemid).get(0).getBoolean("islimit");
-                    if (((qty.subtract(orderminqty)).remainder(orderaddqty)).compareTo(BigDecimal.ZERO) != 0 || qty.compareTo(orderminqty)<0) {
-                        throw new YosException(false,"品号为" + itemRowsMap.get(itemid).get(0).getString("itemno") + "的商品数量不符合该商品的起订量和增量");
+                    if (orderaddqty.compareTo(BigDecimal.ZERO) != 0) {
+                        if (((qty.subtract(orderminqty)).remainder(orderaddqty)).compareTo(BigDecimal.ZERO) != 0 || qty.compareTo(orderminqty) < 0) {
+                            throw new YosException(false, "品号为" + itemRowsMap.get(itemid).get(0).getString("itemno") + "的商品数量不符合该商品的起订量和增量");
+                        }
                     }
                     if (islimit) {
                         if (groupqty.compareTo(saledqty.add(qty)) < 0) {
-                            throw new YosException(false,"品号:"+itemRow.getString("itemno") +"已超过限购数量:"+groupqty.subtract(saledqty));
+                            throw new YosException(false, "品号:" + itemRow.getString("itemno") + "已超过限购数量:" + groupqty.subtract(saledqty));
                         }
                     }
                 }
@@ -148,7 +152,7 @@ public class OrderItemsHelper extends BaseClass {
         if (controller.content.containsKey("sa_order_v")) {
             updateSQL.setDataVersion(content.getIntValue("sa_order_v"));
         }
-        updateSQL.setValue("changeby",controller.username);
+        updateSQL.setValue("changeby", controller.username);
         updateSQL.setWhere("sa_orderid", content.getLongValue("sa_orderid"));
         updateSQL.setWhere("siteid", controller.siteid);
 
@@ -323,7 +327,7 @@ public class OrderItemsHelper extends BaseClass {
                 price = itemPrice.getPromotionPrice(sa_promotionid);
                 if (itemRowsMap.containsKey(item.getString("itemid"))) {
                     if (itemRowsMap.get(item.getString("itemid")).isNotEmpty()) {
-                        if (itemRowsMap.get(item.getString("itemid")).get(0).getBoolean("iscustomsize") && itemRowsMap.get(item.getString("itemid")).get(0).getLong("pricingmetod")==1) {
+                        if (itemRowsMap.get(item.getString("itemid")).get(0).getBoolean("iscustomsize") && itemRowsMap.get(item.getString("itemid")).get(0).getLong("pricingmetod") == 1) {
                             price = price.multiply(item.getBigDecimalValue("length").multiply(item.getBigDecimalValue("width")).divide(new BigDecimal("1000000"), 4, BigDecimal.ROUND_HALF_UP));
                         }
 
@@ -334,7 +338,7 @@ public class OrderItemsHelper extends BaseClass {
                 price = itemPrice.getGraderateprice();
                 if (itemRowsMap.containsKey(item.getString("itemid"))) {
                     if (itemRowsMap.get(item.getString("itemid")).isNotEmpty()) {
-                        if (itemRowsMap.get(item.getString("itemid")).get(0).getBoolean("iscustomsize")  && itemRowsMap.get(item.getString("itemid")).get(0).getLong("pricingmetod")==1) {
+                        if (itemRowsMap.get(item.getString("itemid")).get(0).getBoolean("iscustomsize") && itemRowsMap.get(item.getString("itemid")).get(0).getLong("pricingmetod") == 1) {
                             price = price.multiply(item.getBigDecimalValue("length").multiply(item.getBigDecimalValue("width")).divide(new BigDecimal("1000000"), 4, BigDecimal.ROUND_HALF_UP));
                         }