Parcourir la source

Merge branch 'develop' into develop-green

hu il y a 2 semaines
Parent
commit
b8352c9be6

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

@@ -119,6 +119,11 @@ public class itemgroup extends Controller {
                         + "%' or s2.byname like '%" + whereObject.getString("condition")
                         + "%' or s2.model like '%" + whereObject.getString("condition")
                         + "%') and s1.sa_itemgroupid=t1.sa_itemgroupid) ) ";
+
+                pageSorting="t1.groupname like'%" + whereObject.getString("condition")+"%' desc,exists(select 1 from sa_itemgroupmx s1 " +
+                        " LEFT JOIN plm_item s2 ON s1.itemid = s2.itemid AND s1.siteid = s2.siteid  where s2.itemname like'%"+whereObject.getString("condition")+"%') desc,exists(select 1 from sa_itemgroupmx s1 " +
+                        " LEFT JOIN plm_item s2 ON s1.itemid = s2.itemid AND s1.siteid = s2.siteid  where s2.itemno like'%"+whereObject.getString("condition")+"%') desc,t1.groupnum like'%" + whereObject.getString("condition")+"%' desc";
+
             }
             if (whereObject.containsKey("tradefield") && !"".equals(whereObject.getString("tradefield"))) {
                 where = where + " and (t1.tradefield like'%" + whereObject.getString("tradefield") + "%') ";

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

@@ -22,4 +22,4 @@ where $where$
   and t1.siteid = $siteid$
   and ifnull(t1.isonsale, 0) = 1
   and ifnull(t1.sa_customschemeid,0)!=0 and $tablefilter$
-  and not exists(select 1 from sa_itemgroupmx t inner join sa_itemgroup t2 on t.sa_itemgroupid=t2.sa_itemgroupid and t.siteid=t2.siteid where t.siteid = $siteid$ and t.itemid = t1.itemid)
+  and if($itemgrouprepeat$,1=1,not exists(select 1 from sa_itemgroupmx t inner join sa_itemgroup t2 on t.sa_itemgroupid=t2.sa_itemgroupid and t.siteid=t2.siteid where t.siteid = $siteid$ and t.itemid = t1.itemid))

+ 6 - 0
src/custom/restcontroller/webmanage/sale/itemgroup/itemgroup.java

@@ -490,9 +490,15 @@ public class itemgroup extends Controller {
             where = where + " and  t1.sa_customschemeid ='" + sa_customschemeid + "'";
         }
 //		String hrid = content.getString("hrid");
+        boolean itemgrouprepeat =false;
+        Rows siteParameterRows =dbConnect.runSqlQuery("select itemgrouprepeat from sys_site_parameter where siteid='"+siteid+"'");
+        if(siteParameterRows.isNotEmpty()){
+            itemgrouprepeat=siteParameterRows.get(0).getBoolean("itemgrouprepeat");
+        }
         SQLFactory sqlFactory = new SQLFactory(this, "商品查询", pageSize, pageNumber, pageSorting);
         sqlFactory.addParameter_SQL("where", where);
         sqlFactory.addParameter("sa_itemgroupid", sa_itemgroupid);
+        sqlFactory.addParameter("itemgrouprepeat", itemgrouprepeat);
         sqlFactory.addParameter("siteid", siteid);
         Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL(false));
 

+ 2 - 2
src/custom/restcontroller/webmanage/sale/salestarget/SQL/人员目标统计-收款.sql

@@ -50,7 +50,7 @@ from (
          select '区域' as type,
                 t1.areaname,
 								t1.sa_saleareaid,
-								t2.parentid,
+                                t2.parentid,
                 t2.areafullname,
                 1       level,
                 ROUND(y1a,$num$)  y1a,
@@ -98,7 +98,7 @@ from (
                 ROUND(sum(m12a),$num$)  m12a
          from hrtarget t1
                 left join sa_salearea t5 on t1.sa_saleareaid = t5.sa_saleareaid
-			    left join sa_salearea t6 on t5.parentid = t6.sa_saleareaid and t5.siteid = t6.siteid
+			    left join sa_salearea t6 on ifnull(t5.parentid,$sa_saleareaid$) = t6.sa_saleareaid and t5.siteid = t6.siteid
                 where ifnull(t6.sa_saleareaid,0)!=0
          group by  t6.sa_saleareaid,  t6.areafullname, t6.areaname) t
 where $where$

+ 13 - 1
src/custom/restcontroller/webmanage/sale/salestarget/personnelstatistics.java

@@ -366,7 +366,7 @@ public class personnelstatistics extends Controller {
 
         if(!saleareas.isEmpty() && saleareas.size()==1){
             for (Row row :actualRows) {
-                if(row.getLong("parentid")==0){
+                if(row.getLong("parentid")==0 && row.getString("type").equals("区域汇总")){
                     row.put("y1a",actualRows.toRowsMap("parentid").get(sa_saleareaidtop.toString()).sum("y1a"));
                     row.put("s1a",actualRows.toRowsMap("parentid").get(sa_saleareaidtop.toString()).sum("s1a"));
                     row.put("s2a",actualRows.toRowsMap("parentid").get(sa_saleareaidtop.toString()).sum("s2a"));
@@ -405,6 +405,7 @@ public class personnelstatistics extends Controller {
 
         }
 
+
         for (Row row : rowsResult) {
             //初始化
             row = addActualRow(row);
@@ -421,6 +422,17 @@ public class personnelstatistics extends Controller {
             row.putAll(calculate(row, actualRow));
         }
 
+        Long sa_saleareaid1 =sa_saleareaidtop;
+        Row actualRow = new Row();
+        for (Row tempActualRow : actualRows) {
+            if (tempActualRow.getLong("sa_saleareaid") == sa_saleareaid1) {
+                actualRow.putAll(tempActualRow);
+            }
+        }
+        Row row =new Row();
+        row.putAll(actualRow);
+        row.putAll(calculate(row, actualRow));
+        rowsResult.add(row);
 
         Row rowResult = new Row();
         rowResult.put("y1l",sum1("y1l",rowsResult));