eganwu před 2 roky
rodič
revize
ecac553027

+ 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));
                         }