Jelajahi Sumber

订单添加商品时对添加行是否符合标准做判断(仅在添加时判断)

wu 6 hari lalu
induk
melakukan
829da05383

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

@@ -62,6 +62,7 @@ public class OrderItems extends Controller {
             }
         }
 
+
         //通过版本更新订单表头数据
         beans.order.Order.updateOrderWithVersion(this);
 
@@ -82,6 +83,12 @@ public class OrderItems extends Controller {
             sumqty = sumqty.add(qty);
 
             Row itemRow = getItemRow(itemid);
+            if (type.equals("标准订单") && itemRow.getString("ismodule").equals("1")) {
+                return getErrReturnObject().setErrMsg("商品编号【"+itemRow.getString("itemno")+"】是配件,无法添加").toString();
+            }
+            if (type.equals("配件订单") && itemRow.getString("ismodule").equals("0")) {
+                return getErrReturnObject().setErrMsg("商品编号【"+itemRow.getString("itemno")+"】不是配件,无法添加").toString();
+            }
 
             Boolean isInsert = true;
             JSONArray customproperties = new JSONArray();
@@ -263,10 +270,15 @@ public class OrderItems extends Controller {
             Long sa_orderitemsid = item.getLong("sa_orderitemsid");
             BigDecimal qty = item.getBigDecimal("qty");
             sumqty = sumqty.add(qty);
-
-
             //商品信息
             Row itemRow = getItemRow(itemid);
+            if (type.equals("标准订单") && itemRow.getString("ismodule").equals("1")) {
+                return getErrReturnObject().setErrMsg("商品编号【"+itemRow.getString("itemno")+"】是配件,无法添加").toString();
+            }
+            if (type.equals("配件订单") && itemRow.getString("ismodule").equals("0")) {
+                return getErrReturnObject().setErrMsg("商品编号【"+itemRow.getString("itemno")+"】不是配件,无法添加").toString();
+            }
+
             long width = itemRow.getLong("width");
             long length = itemRow.getLong("length");
             if (item.containsKey("width")) {

+ 1 - 0
src/custom/restcontroller/webmanage/sale/order/SQL/查询商品信息.sql

@@ -13,6 +13,7 @@ SELECT t1.itemid,
        t1.pricingmetod,
        t1.width,
        t1.length,
+       t1.ismodule,
        ifnull(t1.delivery,0) delivery,
        (SELECT unitname FROM plm_unit WHERE unitid = t1.unitid and siteid = t1.siteid)    unit,
        (SELECT unitname FROM plm_unit WHERE unitid = t2.auxunitid and siteid = t1.siteid) auxunit,