|
@@ -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
|