Parcourir la source

促销方案审核判断起订量增量是否为0

hu il y a 1 an
Parent
commit
e131d5c32e

+ 10 - 0
src/custom/restcontroller/webmanage/sale/promotion/promotion.java

@@ -400,6 +400,9 @@ public class promotion extends Controller {
         Rows rows = dbConnect
                 .runSqlQuery("select sa_promotionid,status,promnum,promname,type,associationaccountclassid,associationamount from sa_promotion where sa_promotionid ='"
                         + sa_promotionid + "' and  siteid='" + siteid + "'");
+        Rows rowsdetails = dbConnect
+                .runSqlQuery("select t2.itemno,t2.itemname,ifnull(t1.orderminqty,0) orderminqty, ifnull(t1.orderaddqty,0) orderaddqty 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 + "'");
         if (rows.isEmpty()) {
             return getErrReturnObject().setErrMsg("该促销方案不存在").toString();
         } else {
@@ -418,6 +421,13 @@ public class promotion extends Controller {
                     return getErrReturnObject().setErrMsg("返利促销授权的经销商必须都为限购").toString();
                 }
             }
+            for (Row row:rowsdetails) {
+                if(row.getBigDecimal("orderminqty").compareTo(BigDecimal.ZERO)==0 || row.getBigDecimal("orderaddqty").compareTo(BigDecimal.ZERO)==0){
+                    return getErrReturnObject().setErrMsg("该促销方案【"+row.getString("itemno")+"】商品起订量或增量为0,无法审核").toString();
+                }
+            }
+
+
 
 
         }