Sfoglia il codice sorgente

商品组明细查询添加方案名称及商品组上架判断方案是否存在多个,存在多个则不能上架

hu 3 anni fa
parent
commit
d5eb8d80d6

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

@@ -844,7 +844,7 @@ public class itemgroup extends Controller {
         rows = dbConnect.runSqlQuery(factory.getSQL());
         rows = dbConnect.runSqlQuery(factory.getSQL());
         String itemno = "";
         String itemno = "";
         if(!rows.isEmpty()){
         if(!rows.isEmpty()){
-           // itemno=rows.get(0).getString("itemno");
+            itemno=rows.get(0).getString("itemno");
         }
         }
 
 
         /**
         /**

+ 4 - 1
src/custom/restcontroller/webmanage/sale/itemgroup/SQL/商品组商品明细查询.sql

@@ -4,13 +4,16 @@ SELECT t1.sa_itemgroupmxid,
        t6.unitname,
        t6.unitname,
        t3.erpitemname,
        t3.erpitemname,
        t3.erpitemno,
        t3.erpitemno,
-       t3.material
+       t3.material,
+			 t4.sa_customschemeid,
+       t4.schemename
 FROM sa_itemgroupmx t1
 FROM sa_itemgroupmx t1
          inner JOIN plm_item t2 ON t1.itemid = t2.itemid and ifnull(t2.isonsale, 0) = 1
          inner JOIN plm_item t2 ON t1.itemid = t2.itemid and ifnull(t2.isonsale, 0) = 1
     AND t1.siteid = t2.siteid
     AND t1.siteid = t2.siteid
          LEFT JOIN plm_unit t6 ON t6.unitid = t2.unitid
          LEFT JOIN plm_unit t6 ON t6.unitid = t2.unitid
     AND t6.siteid = t2.siteid
     AND t6.siteid = t2.siteid
          left join plm_itemextend t3 on t2.siteid = t3.siteid and t2.itemid = t3.itemid
          left join plm_itemextend t3 on t2.siteid = t3.siteid and t2.itemid = t3.itemid
+         left join sa_customscheme t4 on t2.sa_customschemeid=t4.sa_customschemeid and t2.siteid=t4.siteid
 where $where$
 where $where$
   and t1.sa_itemgroupid = $sa_itemgroupid$
   and t1.sa_itemgroupid = $sa_itemgroupid$
   and t1.siteid = $siteid$
   and t1.siteid = $siteid$

+ 7 - 1
src/custom/restcontroller/webmanage/sale/itemgroup/itemgroup.java

@@ -228,15 +228,21 @@ public class itemgroup extends Controller {
 //        SQLFactory sqlFactoryquery = new SQLFactory(this, "商品组状态查询");
 //        SQLFactory sqlFactoryquery = new SQLFactory(this, "商品组状态查询");
 //        sqlFactoryquery.addParameter("siteid", siteid);
 //        sqlFactoryquery.addParameter("siteid", siteid);
 //        sqlFactoryquery.addParameter_in("sa_itemgroupids", stringArray);
 //        sqlFactoryquery.addParameter_in("sa_itemgroupids", stringArray);
-        String whereSql = "select isonsale,groupname from sa_itemgroup where sa_itemgroupid in " + list + " and  siteid='" + siteid + "'";
+        String whereSql = "select isonsale,groupname,sa_itemgroupid from sa_itemgroup where sa_itemgroupid in " + list + " and  siteid='" + siteid + "'";
         whereSql = whereSql.replace("[", "(").replace("]", ")");
         whereSql = whereSql.replace("[", "(").replace("]", ")");
         Rows rows = dbConnect.runSqlQuery(whereSql);
         Rows rows = dbConnect.runSqlQuery(whereSql);
         for (Row row : rows) {
         for (Row row : rows) {
             if (row.getBoolean("isonsale")) {
             if (row.getBoolean("isonsale")) {
                 return getErrReturnObject().setErrMsg("【" + row.getString("groupname") + "】商品组已上架,无法再次上架").toString();
                 return getErrReturnObject().setErrMsg("【" + row.getString("groupname") + "】商品组已上架,无法再次上架").toString();
             }
             }
+            Rows rowscount = dbConnect.runSqlQuery("select distinct ifnull(t2.sa_customschemeid,0) sa_customschemeid from sa_itemgroupmx t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid  where t1.siteid='"+siteid+"' and t1.sa_itemgroupid="+row.getLong("sa_itemgroupid"));
+            if(rowscount.size()>1){
+                return getErrReturnObject().setErrMsg("【" + row.getString("groupname") + "】商品组存在两个以上方案的商品,无法上架").toString();
+            }
+
         }
         }
 
 
+
         SQLFactory sqlFactoryupdate = new SQLFactory(this, "商品组上架");
         SQLFactory sqlFactoryupdate = new SQLFactory(this, "商品组上架");
         sqlFactoryupdate.addParameter("siteid", siteid);
         sqlFactoryupdate.addParameter("siteid", siteid);
         sqlFactoryupdate.addParameter_in("sa_itemgroupids", stringArray);
         sqlFactoryupdate.addParameter_in("sa_itemgroupids", stringArray);