ソースを参照

服务申请单时间格式变更及新增订单查询接口(无重复订单)

hu 4 年 前
コミット
05b8059840

+ 1 - 1
src/rest/openapi/restcontroller/hyworkorder/web/afterserviceorder/SQL/售后服务单详情.sql

@@ -1,6 +1,6 @@
 select t.servicenum,convert(varchar,t.createdate,120)createdate,t.fsonum,t.fnotes,t.fstatus,t.fprovince,t.fcity,t.fcounty,t.faddress,
 select t.servicenum,convert(varchar,t.createdate,120)createdate,t.fsonum,t.fnotes,t.fstatus,t.fprovince,t.fcity,t.fcounty,t.faddress,
 t.Afterserviceordeid ownerid,scenefname,scenephone,error_msg,t.appsystem,t.errcategory,t.backreason,t.fsaler,t3.displayname fsalername,
 t.Afterserviceordeid ownerid,scenefname,scenephone,error_msg,t.appsystem,t.errcategory,t.backreason,t.fsaler,t3.displayname fsalername,
-t.servicetype,convert(varchar,t.servicebegindate,120)servicebegindate,convert(varchar,t.serviceenddate,120)serviceenddate,t1.displayname submitby,t2.fagentnum,t2.fagentname,t2.fagentshortname
+t.servicetype,convert(varchar(10),t.servicebegindate,120)servicebegindate,convert(varchar(10),t.serviceenddate,120)serviceenddate,t1.displayname submitby,t2.fagentnum,t2.fagentname,t2.fagentshortname
 from Afterserviceorder t
 from Afterserviceorder t
 left join pp_hr t1 on t.submitby=t1.hrid and t.siteid=t1.siteid
 left join pp_hr t1 on t.submitby=t1.hrid and t.siteid=t1.siteid
 left join tagents t2 on t.fagentnum=t2.fagentnum and t.siteid=t2.siteid
 left join tagents t2 on t.fagentnum=t2.fagentnum and t.siteid=t2.siteid

+ 39 - 0
src/rest/openapi/restcontroller/wechatapp/saorder/SQL/订单列表查询1.sql

@@ -0,0 +1,39 @@
+select t1.ftype,
+       t1.ftypemx,
+       t1.saorderid,
+       t1.fsonum,
+       convert(varchar(10), t1.fdate, 120)  fdate,
+       t1.fcontact,
+       t1.fprovince,t1.fcity,t1.fcounty,
+       t1.faddress,
+       t1.fnotes,
+       convert(varchar, t1.submitdate, 120) submitdate,
+       convert(varchar, t1.needdatereplydate, 120)  needdatereplydate,
+       convert(varchar, t1.needdateconfirmdate, 120)  needdateconfirmdate,
+       convert(varchar, t1.checkdate, 120)  checkdate,
+       convert(varchar, t1.closedate, 120)  closedate,
+       t1.fstatus,
+       t1.fagentnum,
+       t1.fagentshortname,
+       t1.fbrand,
+       t1.fieldname,
+       t1.fsaler,
+       t3.displayname                       fsalername,--ÇøÓò¾­ÀíÃû³Æ
+       t1.fiswuliao,
+       t1.fpayagentnum,
+       t4.fagentname      as                fpayagentname,
+       t4.fagentshortname as                fpayagentshortname,
+       t1.frecagentnum,
+       t5.fagentname      as                frecagentname,
+       t5.fagentshortname as                frecagentshortname,
+       t1.fprojectnum,
+       t6.fprojectname,
+       t7.fwriteofstatus,
+       t7.finvoicestatus
+from saorder t1
+         left join pp_hr t3 on t1.fsaler = t3.hrid
+         left join tagents t4 on t1.fpayagentnum = t4.fagentnum and t1.siteid = t4.siteid
+         left join tagents t5 on t1.frecagentnum = t5.fagentnum and t1.siteid = t5.siteid
+         left join tproject t6 on t1.fprojectnum = t6.fprojectnum and t1.siteid = t6.siteid
+         left join saorder_view1 t7 on t1.saorderid = t7.saorderid
+where t1.fstatus!='ɾ³ý'and t1.fagentnum =$fagentnum$ and $where$ and t1.siteid=$siteid$

+ 82 - 0
src/rest/openapi/restcontroller/wechatapp/saorder/Saorder.java

@@ -115,6 +115,88 @@ public class Saorder extends Controller {
         return getReturnObject_suc_page(rows, false, 1, sortmsg).toString();
         return getReturnObject_suc_page(rows, false, 1, sortmsg).toString();
     }
     }
 
 
+    /**
+     * 订货单查询列表获取
+     * @return
+     */
+    public String query_orderList1() throws Exception {
+        /**
+         * 创建数据库连接
+         */
+        DBConnect connect = new DBConnect();
+
+        /**
+         *排序条件设置
+         */
+        String[] sortmsg = {"t1.fsonum", "t1.fdate"};
+        String sort = "case when t1.fstatus='新建'then 1 when t1.fstatus='提交'then 2 when t1.fstatus='交期待确认' then 3 when t1.fstatus='交期确认' then 4 when t1.fstatus='确认'then 5 when t1.fstatus='审核'then 6 when t1.fstatus='关闭'then 7 end,t1.CREATEDATE DESC";
+        if (content.containsKey("sort") && Arrays.asList(sortmsg).contains(content.getString("sort"))) {
+            sort = content.getString("sort");
+        }
+
+        /**
+         * 过滤条件设置
+         */
+        String where = " 1=1 ";
+        if (content.containsKey("where")) {
+            JSONObject whereObject = content.getJSONObject("where");
+            if (whereObject.containsKey("fbegdate") && !"".equals(whereObject.getString("fbegdate"))) {
+                where = where + " and t1.fdate >='" + whereObject.getString("fbegdate") + "'";
+            }
+            if (whereObject.containsKey("fenddate") && !"".equals(whereObject.getString("fenddate"))) {
+                where = where + " and t1.fdate <='" + whereObject.getString("fenddate") + "'";
+            }
+            if (whereObject.containsKey("fstatus") && !"".equals(whereObject.getString("fstatus"))) {
+                String[] fstatuses = whereObject.getString("fstatus").split(",");
+                String inwhere = "";
+                for (String fstatus : fstatuses) {
+                    if ("".equals(inwhere)) {
+                        inwhere = "'" + fstatus + "'";
+                    } else {
+                        inwhere = inwhere + ",'" + fstatus + "'";
+                    }
+                }
+                where = where + " and t1.fstatus in (" + inwhere + ")";
+            }
+            if (whereObject.containsKey("ftype") && !"".equals(whereObject.getString("ftype"))) {
+                String[] ftypes = whereObject.getString("ftype").split(",");
+                String inwhere = "";
+                for (String ftype : ftypes) {
+                    if ("".equals(inwhere)) {
+                        inwhere = "'" + ftype + "'";
+                    } else {
+                        inwhere = inwhere + ",'" + ftype + "'";
+                    }
+                }
+                where = where + " and t1.ftype in (" + inwhere + ")";
+            }
+            if (whereObject.containsKey("fitemname") && !"".equals(whereObject.getString("fitemname"))) {
+                where = where + " and exists(select *from saorderdetail where fparentid=t1.saorderid and (fitemname like'%" + whereObject.getString("fitemname") + "%' or fitemno like'%" + whereObject.getString("fitemname") + "%'))";
+            }
+            if (whereObject.containsKey("fsonum") && !"".equals(whereObject.getString("fsonum"))) {
+                where = where + " and t1.fsonum like '%"+ whereObject.getString("fsonum") + "%'";
+            }
+            if (whereObject.containsKey("fodertype") && !"".equals(whereObject.getString("fodertype"))) {
+                String fodertype = whereObject.getString("fodertype");
+                if ("needsubmit".equals(fodertype)) {
+                    where = where + " and t1.fstatus in ('新建','确认')";
+                } else if ("needsendout".equals(fodertype)) {
+                    where = where + " and t1.fstatus='审核'";
+                }
+            }
+        }
+        /**
+         * SQL订单列表查询参数设置并查询
+         */
+        SQLFactory factory = new SQLFactory(this, "订单列表查询1", pageSize, pageNumber, sort);
+        factory.addParameter("fagentnum", fagentnum);
+        factory.addParameter("siteid", siteid);
+        factory.addParameter_SQL("where", where);
+        Rows rows = connect.runSqlQuery(factory.getSQL());
+
+        return getReturnObject_suc_page(rows, false, 1, sortmsg).toString();
+    }
+
     /**
     /**
      * 业务员订货单查询列表获取
      * 业务员订货单查询列表获取
      * @return
      * @return