Parcourir la source

经销商授权商品查询逻辑优化

hu il y a 7 mois
Parent
commit
cef3788081

+ 1 - 2
src/custom/beans/itemgroup/Itemgroup.java

@@ -28,7 +28,6 @@ public class Itemgroup extends BaseClass {
     public static ArrayList<String> createItemGroupSql(Controller controller, long itemid, String itemname, String itemno, JSONArray tradefields, long sa_brandid) throws YosException {
 
         ArrayList<String> sqlList = new ArrayList<>();
-        String billcode = controller.createBillCode("itemgroup");
         long sa_itemgroupid = controller.createTableID("sa_itemgroup");
         String tradefield="";
         if(tradefields!=null && !tradefields.isEmpty()){
@@ -46,7 +45,7 @@ public class Itemgroup extends BaseClass {
         sqlAddFactory.addParameter("groupname", itemname);
         sqlAddFactory.addParameter("itemno", itemno);
         sqlAddFactory.addParameter("username", controller.username);
-        sqlAddFactory.addParameter("groupnum", billcode);
+        sqlAddFactory.addParameter("groupnum", itemno);
         sqlAddFactory.addParameter("tradefield", tradefield);
         sqlAddFactory.addParameter("sa_brandid", sa_brandid);
         sqlAddFactory.addParameter("sequence", 1);

+ 1 - 0
src/custom/restcontroller/sale/itemgroup/itemgroup.java

@@ -170,6 +170,7 @@ public class itemgroup extends Controller {
         itemGroupQuery.addJoinTable(JOINTYPE.left, "sa_brand", "t3", "t3.sa_brandid = t1.sa_brandid AND t3.siteid = t1.siteid", "brandname");
         itemGroupQuery.addJoinTable(JOINTYPE.left, "plm_unit", "t6", "t6.unitid = t2.unitid AND t6.siteid = t2.siteid", "unitname");
         itemGroupQuery.setSiteid(siteid);
+        itemGroupQuery.setWhere("t1.isonsale=1");
         itemGroupQuery.setWhere("t2.ismodule", content.getLongValue("ismodule"));
         itemGroupQuery.setWhere("t1.sa_brandid", brandids.toArray());
         itemGroupQuery.setWhere(where);

+ 2 - 0
src/custom/restcontroller/webmanage/sale/item/Item.java

@@ -1028,6 +1028,8 @@ public class Item extends Controller {
                             sqlList.add("delete from sa_itemgroup where sa_itemgroupid in(select sa_itemgroupid from sa_itemgroupmx where itemid=" + id + " and siteid='" + siteid + "')");
                             sqlList.add("delete from sa_itemgroupmx where itemid=" + id + " and siteid='" + siteid + "'");
                         } else {
+                            sqlList.add("delete from sa_itemgroup where sa_itemgroupid in(select sa_itemgroupid from sa_itemgroupmx where itemid=" + id + " and siteid='" + siteid + "')");
+                            sqlList.add("delete from sa_itemgroupmx where itemid=" + id + " and siteid='" + siteid + "'");
                             sqlList.addAll(Itemgroup.createItemGroupSql(this, id, itemRowsMap.get(String.valueOf(obj)).get(0).getString("itemname"), itemRowsMap.get(String.valueOf(obj)).get(0).getString("itemno"), tradefieldRowsMap.get(String.valueOf(obj)).toJsonArray("tradefield"), sa_brandid));
                         }
                     }