Ver código fonte

删除订单行时判断有无选择行

shenjingwei 2 meses atrás
pai
commit
5347ebb142

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

@@ -84,10 +84,10 @@ public class OrderItems extends Controller {
 
 
             Row itemRow = getItemRow(itemid);
             Row itemRow = getItemRow(itemid);
             if (type.equals("标准订单") && itemRow.getString("ismodule").equals("1")) {
             if (type.equals("标准订单") && itemRow.getString("ismodule").equals("1")) {
-                return getErrReturnObject().setErrMsg("商品编号【"+itemRow.getString("itemno")+"】是配件,无法添加").toString();
+                return getErrReturnObject().setErrMsg("商品编号【" + itemRow.getString("itemno") + "】是配件,无法添加").toString();
             }
             }
             if (type.equals("配件订单") && itemRow.getString("ismodule").equals("0")) {
             if (type.equals("配件订单") && itemRow.getString("ismodule").equals("0")) {
-                return getErrReturnObject().setErrMsg("商品编号【"+itemRow.getString("itemno")+"】不是配件,无法添加").toString();
+                return getErrReturnObject().setErrMsg("商品编号【" + itemRow.getString("itemno") + "】不是配件,无法添加").toString();
             }
             }
 
 
             Boolean isInsert = true;
             Boolean isInsert = true;
@@ -273,10 +273,10 @@ public class OrderItems extends Controller {
             //商品信息
             //商品信息
             Row itemRow = getItemRow(itemid);
             Row itemRow = getItemRow(itemid);
             if (type.equals("标准订单") && itemRow.getString("ismodule").equals("1")) {
             if (type.equals("标准订单") && itemRow.getString("ismodule").equals("1")) {
-                return getErrReturnObject().setErrMsg("商品编号【"+itemRow.getString("itemno")+"】是配件,无法添加").toString();
+                return getErrReturnObject().setErrMsg("商品编号【" + itemRow.getString("itemno") + "】是配件,无法添加").toString();
             }
             }
             if (type.equals("配件订单") && itemRow.getString("ismodule").equals("0")) {
             if (type.equals("配件订单") && itemRow.getString("ismodule").equals("0")) {
-                return getErrReturnObject().setErrMsg("商品编号【"+itemRow.getString("itemno")+"】不是配件,无法添加").toString();
+                return getErrReturnObject().setErrMsg("商品编号【" + itemRow.getString("itemno") + "】不是配件,无法添加").toString();
             }
             }
 
 
             long width = itemRow.getLong("width");
             long width = itemRow.getLong("width");
@@ -719,6 +719,10 @@ public class OrderItems extends Controller {
 
 
 
 
         JSONArray sa_orderitemsids = content.getJSONArray("sa_orderitemsids");
         JSONArray sa_orderitemsids = content.getJSONArray("sa_orderitemsids");
+        if(sa_orderitemsids.isEmpty()){
+            return getErrReturnObject().setErrMsg("请选择要删除的订单商品").toString();
+        }
+
         String packagetypemxsql = "select t1.sa_orderitemsid from sa_orderitems t1 inner join sa_promotion_items t2 on t1.sa_promotion_itemsid=t2.sa_promotion_itemsid and t1.siteid=t2.siteid where t1.siteid='" + siteid + "' and  t1.sa_orderid in(select sa_orderid from sa_orderitems where sa_orderitemsid in" + sa_orderitemsids.toJSONString() + ") and t2.packagetypemx in(select distinct t2.packagetypemx from sa_orderitems t1 inner join sa_promotion_items t2 on t1.sa_promotion_itemsid=t2.sa_promotion_itemsid and t1.siteid=t2.siteid where t1.siteid='" + siteid + "' and t1.sa_orderitemsid in" + sa_orderitemsids.toJSONString() + " and ifnull(t2.packagetypemx,'')!='')";
         String packagetypemxsql = "select t1.sa_orderitemsid from sa_orderitems t1 inner join sa_promotion_items t2 on t1.sa_promotion_itemsid=t2.sa_promotion_itemsid and t1.siteid=t2.siteid where t1.siteid='" + siteid + "' and  t1.sa_orderid in(select sa_orderid from sa_orderitems where sa_orderitemsid in" + sa_orderitemsids.toJSONString() + ") and t2.packagetypemx in(select distinct t2.packagetypemx from sa_orderitems t1 inner join sa_promotion_items t2 on t1.sa_promotion_itemsid=t2.sa_promotion_itemsid and t1.siteid=t2.siteid where t1.siteid='" + siteid + "' and t1.sa_orderitemsid in" + sa_orderitemsids.toJSONString() + " and ifnull(t2.packagetypemx,'')!='')";
         packagetypemxsql = packagetypemxsql.replace("[", "(").replace("]", ")");
         packagetypemxsql = packagetypemxsql.replace("[", "(").replace("]", ")");
         Rows packagetypemxrows = dbConnect.runSqlQuery(packagetypemxsql);
         Rows packagetypemxrows = dbConnect.runSqlQuery(packagetypemxsql);