Browse Source

订单提交判断商品上下架

eganwu 1 year ago
parent
commit
b1a02a0cc6

+ 2 - 2
src/custom/restcontroller/webmanage/sale/order/Order.java

@@ -1408,11 +1408,11 @@ public class Order extends Controller {
         String type = row.getString("type");
         //标准订单:提交时商品必须是上架状态,否则不允许提交
         if (type.equals("标准订单")) {
-            orderItemsHelper.checkOffOrderItems(sa_orderid, "sa_orderitems");
+            orderItemsHelper.checkOffOrderItems(sa_orderid, "plm_item");
         }
         //促销订单:提交时商品必须是上架状态,并且活动方案中的商品必须也是上架状态,否则不允许提交
         if (type.equals("促销订单")) {
-            orderItemsHelper.checkOffOrderItems(sa_orderid, "sa_orderitems");
+            orderItemsHelper.checkOffOrderItems(sa_orderid, "plm_item");
             orderItemsHelper.checkOffOrderItems(sa_orderid, "sa_promotion_items");
         }
 

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

@@ -23,8 +23,8 @@ public class OrderItemsHelper extends BaseClass {
     }
 
 
-    public void checkOffOrderItems(Long sa_orderid, String tablename) throws YosException {
-        Rows iteminfos = dbConnect.runSqlQuery("select t2.itemno from " + tablename + " t1 inner join plm_item t2 on t1.siteid=t2.siteid and t1.itemid=t2.itemid where t1.sa_orderid="
+    public void checkOffOrderItems(Long sa_orderid,String tablename) throws YosException {
+        Rows iteminfos = dbConnect.runSqlQuery("select t2.itemno from sa_orderitems t1 inner join "+tablename+" t2 on t1.siteid=t2.siteid and t1.itemid=t2.itemid where t1.sa_orderid="
                 + sa_orderid + " and t1.siteid='" + controller.siteid + "' and t2.isonsale!=1");
         if (iteminfos.isNotEmpty()) {
             new YosException(false, "检测到品号" + iteminfos.get(0).getString("itemno") + "未上架,请删除后重试");