hu 3 лет назад
Родитель
Сommit
08f0326428

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

@@ -4598,6 +4598,12 @@ public class R {
         public static class v1 {
         public static class v1 {
         }
         }
     }
     }
+
+    public static class ID20230320160203 {
+        public static class v1 {
+        }
+    }
+
 }
 }
 
 
 
 

+ 45 - 0
src/custom/restcontroller/sale/dispatch/SQL/发货单列表查询.sql

@@ -0,0 +1,45 @@
+SELECT t1.billno,
+       t1.sa_dispatchid,
+       t1.sa_orderid,
+       t3.sonum,
+       t1.sys_enterpriseid,
+       t2.enterprisename,
+       t2.abbreviation,
+       t2.phonenumber enterprisephonenumber,
+       t1.rec_contactsid,
+       t5.province,
+       t5.city,
+       t5.county,
+       t5.phonenumber contactsphonenumber,
+       t5.address,
+       t1.remarks,
+       t1.freightstatus,
+       t1.STATUS,
+       t1.createby,
+       t1.createdate,
+       t1.checkby,
+       t1.checkdate,
+       t1.recheckby,
+       t1.recheckdate,
+       t1.changeby,
+       t1.changedate,
+       t1.closeby,
+       t1.closedate,
+       t1.billdate,
+       t7.agentnum,
+       t8.erpbillno,
+       case when t3.type='项目订单' then t9.projectname else t3.projectnote end projectname
+FROM sa_dispatch t1
+         LEFT JOIN sys_enterprise t2 ON t1.sys_enterpriseid = t2.sys_enterpriseid
+    AND t1.siteid = t2.siteid
+         LEFT JOIN sa_order t3 ON t1.sa_orderid = t3.sa_orderid
+    AND t1.siteid = t3.siteid
+         LEFT JOIN sys_enterprise_contacts t5 ON t1.rec_contactsid = t5.contactsid
+    AND t1.siteid = t5.siteid
+         LEFT JOIN sa_agents t7 ON t7.sys_enterpriseid = t1.sys_enterpriseid
+    AND t1.siteid = t7.siteid
+         LEFT JOIN sys_dataextend t8 ON t8.ownertable = 'sa_dispatch' and t8.ownerid = t1.sa_dispatchid
+    AND t1.siteid = t8.siteid   
+         LEFT JOIN sa_project t9 ON t9.sa_projectid = t3.sa_projectid AND t9.siteid = t3.siteid 
+where t1.siteid = $siteid$ and t1.sys_enterpriseid=$sys_enterpriseid$
+  and $where$

+ 78 - 0
src/custom/restcontroller/sale/dispatch/dispatch.java

@@ -0,0 +1,78 @@
+package restcontroller.sale.dispatch;
+import beans.dispatch.Dispatch;
+import com.alibaba.fastjson.JSONObject;
+import common.Controller;
+import common.YosException;
+import common.annotation.API;
+import common.annotation.CACHEING;
+import common.data.Row;
+import common.data.Rows;
+import common.data.RowsMap;
+import common.data.SQLFactory;
+import restcontroller.R;
+
+import java.util.ArrayList;
+
+/**
+ * 发货单业务端
+ */
+@API(title = "发货单业务端")
+public class dispatch extends Controller {
+    /**
+     * 构造函数
+     *
+     * @param content
+     */
+    public dispatch(JSONObject content) throws YosException {
+        super(content);
+    }
+    @API(title = "查询发货单列表", apiversion = R.ID20230320160203.v1.class)
+    @CACHEING
+    public String queryDispatchList() throws YosException {
+        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("t1.billno like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t3.sonum like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t2.enterprisename like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t1.remarks like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append(")");
+            }
+            if (whereObject.containsKey("status") && !"".equals(whereObject.getString("status"))) {
+                where.append(" and t1.status ='").append(whereObject.getString("status")).append("' ");
+            }
+            if (whereObject.containsKey("begindate") && !"".equals(whereObject.getString("begindate"))) {
+                where.append(" and t1.billdate >='").append(whereObject.getString("begindate")).append("' ");
+            }
+            if (whereObject.containsKey("enddate") && !"".equals(whereObject.getString("enddate"))) {
+                where.append(" and t1.billdate <='").append(whereObject.getString("enddate")).append("' ");
+            }
+        }
+        SQLFactory sqlFactory = new SQLFactory(this, "发货单列表查询", pageSize, pageNumber, pageSorting);
+        sqlFactory.addParameter("siteid", siteid);
+        sqlFactory.addParameter("sys_enterpriseid", sys_enterpriseid);
+        sqlFactory.addParameter_SQL("where", where);
+        Rows rows = dbConnect.runSqlQuery(sqlFactory);
+
+        ArrayList<Long> ids = rows.toArrayList("sa_dispatchid", new ArrayList<>());
+        //查询数量金额
+        RowsMap dispatchAmountRowsMap = Dispatch.getDispatchAmountAndQty(this, ids);
+
+        for (Row row : rows) {
+            Long id = row.getLong("sa_dispatchid");
+            if (dispatchAmountRowsMap.get(id.toString()).isNotEmpty()) {
+                row.put("sumamount", dispatchAmountRowsMap.get(id.toString()).get(0).getBigDecimal("sumamount").toPlainString());
+                row.put("sumqty", dispatchAmountRowsMap.get(id.toString()).get(0).getBigDecimal("sumqty").toPlainString());
+            } else {
+                row.put("sumamount", 0);
+                row.put("sumqty", 0);
+            }
+
+        }
+
+        return getSucReturnObject().setData(rows).toString();
+    }
+
+}

+ 6 - 6
src/custom/restcontroller/webmanage/sale/dispatch/dispatch.java

@@ -41,7 +41,7 @@ public class dispatch extends Controller {
 
 
 
 
     @API(title = "发货单新增更新", apiversion = R.ID20221114135203.v1.class)
     @API(title = "发货单新增更新", apiversion = R.ID20221114135203.v1.class)
-    @CACHEING_CLEAN(apiversions = {R.ID20221114135303.v1.class, R.ID20221114135403.v1.class})
+    @CACHEING_CLEAN(apiversions = {R.ID20221114135303.v1.class, R.ID20221114135403.v1.class, R.ID20230320160203.v1.class})
     public String insertormodify_dispatch() throws YosException {
     public String insertormodify_dispatch() throws YosException {
         ArrayList<String> sqlList = new ArrayList<>();
         ArrayList<String> sqlList = new ArrayList<>();
         // 表名
         // 表名
@@ -234,7 +234,7 @@ public class dispatch extends Controller {
     }
     }
 
 
     @API(title = "删除", apiversion = R.ID20221114135503.v1.class)
     @API(title = "删除", apiversion = R.ID20221114135503.v1.class)
-    @CACHEING_CLEAN(apiversions = {R.ID20221114135303.v1.class, R.ID20221114135403.v1.class})
+    @CACHEING_CLEAN(apiversions = {R.ID20221114135303.v1.class, R.ID20221114135403.v1.class, R.ID20230320160203.v1.class})
     public String delete() throws YosException {
     public String delete() throws YosException {
 
 
         JSONArray sa_dispatchids = content.getJSONArray("sa_dispatchids");
         JSONArray sa_dispatchids = content.getJSONArray("sa_dispatchids");
@@ -267,7 +267,7 @@ public class dispatch extends Controller {
     }
     }
 
 
     @API(title = "审核", apiversion = R.ID20221114135603.v1.class)
     @API(title = "审核", apiversion = R.ID20221114135603.v1.class)
-    @CACHEING_CLEAN(apiClass = {Order.class, OrderItems.class, restcontroller.sale.order.Order.class, dispatch.class, dispatchItems.class})
+    @CACHEING_CLEAN(apiClass = {Order.class, OrderItems.class, restcontroller.sale.order.Order.class, dispatch.class, dispatchItems.class, R.ID20230320160203.v1.class})
     public String check() throws YosException {
     public String check() throws YosException {
         Long sa_dispatchid = content.getLong("sa_dispatchid");
         Long sa_dispatchid = content.getLong("sa_dispatchid");
         Long sa_orderid = 0L;
         Long sa_orderid = 0L;
@@ -325,7 +325,7 @@ public class dispatch extends Controller {
 
 
 
 
     @API(title = "反审核", apiversion = R.ID20221114135703.v1.class)
     @API(title = "反审核", apiversion = R.ID20221114135703.v1.class)
-    @CACHEING_CLEAN(apiClass = {Order.class, OrderItems.class, restcontroller.sale.order.Order.class, dispatch.class, dispatchItems.class})
+    @CACHEING_CLEAN(apiClass = {Order.class, OrderItems.class, restcontroller.sale.order.Order.class, dispatch.class, dispatchItems.class, R.ID20230320160203.v1.class})
     public String uncheck() throws YosException {
     public String uncheck() throws YosException {
         Long sa_dispatchid = content.getLong("sa_dispatchid");
         Long sa_dispatchid = content.getLong("sa_dispatchid");
         Long sa_orderid = 0L;
         Long sa_orderid = 0L;
@@ -372,7 +372,7 @@ public class dispatch extends Controller {
     }
     }
 
 
     @API(title = "复核反复核", apiversion = R.ID20221114135803.v1.class)
     @API(title = "复核反复核", apiversion = R.ID20221114135803.v1.class)
-    @CACHEING_CLEAN(apiversions = {R.ID20221114135303.v1.class, R.ID20221114135403.v1.class})
+    @CACHEING_CLEAN(apiversions = {R.ID20221114135303.v1.class, R.ID20221114135403.v1.class, R.ID20230320160203.v1.class})
     public String recheck() throws YosException {
     public String recheck() throws YosException {
         Long sa_dispatchid = content.getLong("sa_dispatchid");
         Long sa_dispatchid = content.getLong("sa_dispatchid");
         boolean isrecheck = content.getBooleanValue("isrecheck");
         boolean isrecheck = content.getBooleanValue("isrecheck");
@@ -423,7 +423,7 @@ public class dispatch extends Controller {
 
 
 
 
     @API(title = "一键生成发货单", apiversion = R.ID20230220100604.v1.class)
     @API(title = "一键生成发货单", apiversion = R.ID20230220100604.v1.class)
-    @CACHEING_CLEAN(apiversions = {R.ID20221114135303.v1.class, R.ID20221114135403.v1.class})
+    @CACHEING_CLEAN(apiversions = {R.ID20221114135303.v1.class, R.ID20221114135403.v1.class, R.ID20230320160203.v1.class})
     public String generatedispatch() throws YosException {
     public String generatedispatch() throws YosException {
         Long sa_orderid = content.getLong("sa_orderid");
         Long sa_orderid = content.getLong("sa_orderid");
         JSONArray sa_orderitemsids = content.getJSONArray("sa_orderitemsids");
         JSONArray sa_orderitemsids = content.getJSONArray("sa_orderitemsids");