Browse Source

代码优化

hu 2 years ago
parent
commit
14e03a0a70

+ 5 - 0
src/custom/restcontroller/R.java

@@ -4948,6 +4948,11 @@ public class R {
         public static class v1 {
         }
     }
+    public static class ID20230626104003 {
+        public static class v1 {
+        }
+    }
+
 }
 
 

+ 8 - 0
src/custom/restcontroller/saletool/notice/notice.java

@@ -40,6 +40,14 @@ public class notice extends Controller {
             if (whereObject.containsKey("sat_notice_classid") && !"".equals(whereObject.getString("sat_notice_classid"))) {
                 where = where + " and t1.sat_notice_classid = " + whereObject.getString("sat_notice_classid");
             }
+            if (whereObject.containsKey("isread") && !"".equals(whereObject.getString("isread"))) {
+                if(whereObject.getBooleanValue("isread")){
+                    where = where + " and (CASE WHEN  (SELECT COUNT(*) FROM sat_notice_read WHERE  siteid = t1.siteid AND sat_noticeid = t1.sat_noticeid)>0 THEN '已读' ELSE '未读' END)='已读'";
+                }else{
+                    where = where + " and (CASE WHEN  (SELECT COUNT(*) FROM sat_notice_read WHERE  siteid = t1.siteid AND sat_noticeid = t1.sat_noticeid)>0 THEN '已读' ELSE '未读' END)='未读'";
+                }
+
+            }
         }
         SQLFactory sqlFactory = new SQLFactory(this, "通告列表查询", pageSize, pageNumber, pageSorting);
         sqlFactory.addParameter_SQL("where", where);

+ 70 - 0
src/custom/restcontroller/webmanage/sale/dispatch/dispatchItems.java

@@ -200,6 +200,8 @@ public class dispatchItems extends Controller {
         return queryDispatchItemsList();
     }
 
+
+
     @API(title = "发货单商品明细列表", apiversion = R.ID20221115104703.v1.class)
     @CACHEING
     public String queryDispatchItemsList() throws YosException {
@@ -389,6 +391,74 @@ public class dispatchItems extends Controller {
         }
         return getSucReturnObject().setData(rows).toString();
     }
+    @API(title = "工厂发货/退货明细", apiversion = R.ID20230626104003.v1.class)
+    @CACHEING
+    public String queryDispatchAndAftersalesmagItemsList() throws YosException, IOException {
+        /*
+         * 过滤条件设置
+         */
+        StringBuffer where = new StringBuffer(" 1=1 ");
+
+
+        if (content.containsKey("where")) {
+            JSONObject whereObject = content.getJSONObject("where");
+            if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
+                where.append(" and(");
+                where.append("t.sonum like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t.itemno like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t.itemname like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append(")");
+            }
+            if (whereObject.containsKey("type") && !"".equals(whereObject.getString("type"))) {
+                where.append(" and(");
+                where.append("t.type ='").append(whereObject.getString("type")).append("' ");
+                where.append(")");
+            }
+            if (whereObject.containsKey("begindate") && !"".equals(whereObject.getString("begindate"))) {
+                where.append(" and DATE_FORMAT(t.date, '%Y-%m-%d') >='").append(whereObject.getString("begindate")).append("' ");
+            }
+            if (whereObject.containsKey("enddate") && !"".equals(whereObject.getString("enddate"))) {
+                where.append(" and DATE_FORMAT(t.date, '%Y-%m-%d') <='").append(whereObject.getString("enddate")).append("' ");
+            }
+            if (whereObject.containsKey("status") && !"".equals(whereObject.getString("status"))) {
+                where.append(" and t.status ='").append(whereObject.getString("status")).append("' ");
+            }
+        }
+        boolean isExport = content.getBooleanValue("isExport");
+        SQLFactory sqlFactory = new SQLFactory(this, "工厂发货及退货明细(经销商)", pageSize, pageNumber, pageSorting);
+        if (isExport) {
+            sqlFactory = new SQLFactory(this, "工厂发货及退货明细(经销商)");
+        }
+        sqlFactory.addParameter("sys_enterpriseid", sys_enterpriseid);
+        sqlFactory.addParameter_SQL("where", where);
+        sqlFactory.addParameter("siteid", siteid);
+        Rows rows = dbConnect.runSqlQuery(sqlFactory);
+
+
+        if (isExport) {
+//            //去除不需要导出项
+//            rows.getFieldList().remove("sa_dispatch_itemsid");
+//            rows.getFieldList().remove("sa_dispatchid");
+//            rows.getFieldList().remove("sa_orderitemsid");
+//            rows.getFieldList().remove("sa_orderid");
+//            rows.getFieldList().remove("sys_enterpriseid");
+//            rows.getFieldList().remove("isclose");
+//            rows.getFieldList().remove("rowno");
+//            rows.getFieldList().remove("itemid");
+//            rows.getFieldList().remove("batchno");
+//            Rows rowsrolename= dbConnect.runSqlQuery("select * from sys_userrole t1 inner join sys_role t2 on t1.roleid=t2.roleid and t1.siteid=t2.siteid where t2.rolename='经销商员工' and t1.userid="+userid);
+//            if(!rowsrolename.isEmpty()){
+//                rows.getFieldList().remove("price");
+//                rows.getFieldList().remove("amount");
+//            }
+//            rows.getFieldList().remove("undeliqty");
+//            rows.getFieldList().remove("deliedqty");
+//            rows.getFieldList().remove("outwarehousedate");
+//            Rows uploadRows = uploadExcelToObs("dispatch", "发货单明细列表", rows, getTitleMap());
+//            return getSucReturnObject().setData(uploadRows).toString();
+        }
+        return getSucReturnObject().setData(rows).toString();
+    }
 
     //返回导出的标题
     public HashMap<String, String> getTitleMap() throws YosException {