瀏覽代碼

促销方案生成订单价格错误修复

hu 11 月之前
父節點
當前提交
cc636b3b35

+ 2 - 2
src/custom/beans/itemprice/ItemPrice.java

@@ -177,11 +177,11 @@ public class ItemPrice extends BaseClass {
         return contractprice;
     }
 
-    public BigDecimal getPromotionPrice(long sa_promotionid) throws YosException {
+    public BigDecimal getPromotionPrice(long sa_promotionid,long sa_promotion_itemsid) throws YosException {
 
 
 
-        Rows rows = dbConnect.runSqlQuery("SELECT price FROM sa_promotion_itemprice t1 INNER JOIN sys_enterprise t2 ON t1.pricegrade=t2.grade AND t1.siteid=t2.siteid WHERE t1.sa_promotionid = " + sa_promotionid + " and t1.siteid='" + controller.siteid + "' and t1.itemid='" + itemid + "' and t2.sys_enterpriseid="+sys_enterpriseid);
+        Rows rows = dbConnect.runSqlQuery("SELECT price FROM sa_promotion_itemprice t1 INNER JOIN sys_enterprise t2 ON t1.pricegrade=t2.grade AND t1.siteid=t2.siteid WHERE t1.sa_promotionid = " + sa_promotionid + " and t1.siteid='" + controller.siteid + "' and t1.sa_promotion_itemsid='" + sa_promotion_itemsid + "' and t2.sys_enterpriseid="+sys_enterpriseid);
         if (rows.isNotEmpty()) {
             return rows.get(0).getBigDecimal("price");
         }

+ 2 - 2
src/custom/restcontroller/sale/shoppingcart/ShoppingCart.java

@@ -317,9 +317,9 @@ public class ShoppingCart extends Controller {
 
                     }
                     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)));
+                        row.put("gradeprice", itemPrice.getPromotionPrice(content.getLongValue("sa_promotionid"),row.getLong("sa_promotion_itemsid")).multiply(row.getBigDecimal("length").multiply(row.getBigDecimal("width")).divide(new BigDecimal("1000000"), 4, BigDecimal.ROUND_HALF_UP)));
                     } else {
-                        row.put("gradeprice", itemPrice.getPromotionPrice(content.getLongValue("sa_promotionid")));
+                        row.put("gradeprice", itemPrice.getPromotionPrice(content.getLongValue("sa_promotionid"),row.getLong("sa_promotion_itemsid")));
                     }
                 } else {
                     if (row.getBoolean("iscustomsize") && row.getLong("pricingmetod") == 1) {

+ 1 - 1
src/custom/restcontroller/webmanage/sale/order/OrderItems.java

@@ -97,7 +97,7 @@ public class OrderItems extends Controller {
             }
 
 
-            if (sa_promotionid > 0 && dbConnect.runSqlQuery("SELECT 1 from sa_promotion_items WHERE  islimit=1 and groupqty <= saledqty  and  itemid=" + itemid + " and siteid='" + siteid + "' and sa_promotionid='" + sa_promotionid + "'").isNotEmpty()) {
+            if (sa_promotionid > 0 && dbConnect.runSqlQuery("SELECT 1 from sa_promotion_items WHERE  islimit=1 and groupqty <= saledqty  and  sa_promotion_items=" + item.getLong("sa_promotion_itemsid") + " and siteid='" + siteid + "' and sa_promotionid='" + sa_promotionid + "'").isNotEmpty()) {
                 return getErrReturnObject().setErrMsg("商品【" + itemRow.getString("itemno") + "】已售罄,不能添加。").toString();
             }
 

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

@@ -751,7 +751,7 @@ public class OrderItemsHelper extends BaseClass {
         BigDecimal price;
         switch (type) {
             case "促销订单":
-                price = itemPrice.getPromotionPrice(sa_promotionid);
+                price = itemPrice.getPromotionPrice(sa_promotionid,item.getLong("sa_promotion_itemsid"));
                 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) {

+ 1 - 1
src/custom/restcontroller/webmanage/sale/promotion/promotion.java

@@ -552,7 +552,7 @@ public class promotion extends Controller {
             Rows rowsdetailshuizong = dbConnect.runSqlQuery("select * from (select t2.itemno,count(1) count from sa_promotion_items t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.sa_promotionid ='"
                             + sa_promotionid + "' and  t1.siteid='" + siteid + "' group by t1.itemid,t2.itemno,t1.orderminqty,t1.orderaddqty,t1.groupqty) t where t.count>1");
             if(rowsdetailshuizong.isNotEmpty()){
-                return getErrReturnObject().setErrMsg("商品编码:"+rowsdetailshuizong.get(0).getString("itemno")+"重复添加,禁止审核!").toString();
+                return getErrReturnObject().setErrMsg("商品编码:"+rowsdetailshuizong.get(0).getString("itemno")+"活动条件设置重复,禁止审核!").toString();
             }
 
         }