Browse Source

购物车列表促销商品取促销方案中起订量和增量

hu 1 year ago
parent
commit
cf9b892b47
1 changed files with 11 additions and 0 deletions
  1. 11 0
      src/custom/restcontroller/sale/shoppingcart/ShoppingCart.java

+ 11 - 0
src/custom/restcontroller/sale/shoppingcart/ShoppingCart.java

@@ -175,6 +175,9 @@ public class ShoppingCart extends Controller {
         RowsMap attRowsMap = getAttachmentUrl("plm_item", ids);
         //商品领域
         RowsMap tradefieldRowsMap = beans.Item.Item.getTradefieldRowsMap(this, ids);
+
+        Rows promotionItemsRows = dbConnect.runSqlQuery("select * from sa_promotion_items where siteid='"+siteid+"' and sa_promotionid="+content.getLongValue("sa_promotionid"));
+        RowsMap promotionItemsRowsMap =promotionItemsRows.toRowsMap("itemid");
         for (Row row : rows) {
             if ((attRowsMap.getOrDefault(row.getString("itemid"), new Rows())).isEmpty()) {
                 row.put("attinfos", defaultImageRows);
@@ -185,6 +188,14 @@ public class ShoppingCart extends Controller {
                 ItemPrice itemPrice = ItemPrice.getItemPrice(this, sys_enterpriseid, row.getLong("itemid"));
                 row.put("oldprice",  istool == 0 ?itemPrice.getContractprice():itemPrice.getMarketprice());
                 if(content.getLongValue("sa_promotionid")>0){
+
+                    if(promotionItemsRowsMap.containsKey(row.getString("itemid"))){
+                        if(promotionItemsRowsMap.get(row.getString("itemid")).isNotEmpty()){
+                            row.put("orderminqty",promotionItemsRowsMap.get(row.getString("itemid")).get(0).getBigDecimal("orderminqty"));
+                            row.put("orderaddqty",promotionItemsRowsMap.get(row.getString("itemid")).get(0).getBigDecimal("orderaddqty"));
+                        }
+
+                    }
                     if(row.getBoolean("iscustomsize") && row.getLong("pricingmetod")==1){
                         row.put("gradeprice", itemPrice.getPromotionPrice(content.getLongValue("sa_promotionid")).multiply(row.getBigDecimal("length").multiply(row.getBigDecimal("width")).divide(new BigDecimal("1000000"), 4, BigDecimal.ROUND_HALF_UP)));
                     }else{