|
|
@@ -961,15 +961,6 @@ public class Order extends Controller {
|
|
|
StringBuffer where = new StringBuffer(" 1=1 and t1.status !='新建' ");
|
|
|
if (content.containsKey("where")) {
|
|
|
JSONObject whereObject = content.getJSONObject("where");
|
|
|
- if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
|
|
|
- where.append(" and(");
|
|
|
- where.append("t1.sonum like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
- where.append("or t2.enterprisename like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
- where.append("or t2.abbreviation like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
-// where.append("or t5.erpbillno 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(");
|
|
|
@@ -978,7 +969,7 @@ public class Order extends Controller {
|
|
|
}
|
|
|
if (whereObject.containsKey("type") && !"".equals(whereObject.getString("type"))) {
|
|
|
where.append(" and(");
|
|
|
- where.append("t1.type like'%").append(whereObject.getString("type")).append("%' ");
|
|
|
+ where.append("t1.type ='").append(whereObject.getString("type")).append("' ");
|
|
|
where.append(")");
|
|
|
}
|
|
|
//品牌
|
|
|
@@ -1045,7 +1036,6 @@ public class Order extends Controller {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
SQLFactory areasqlFactory = new SQLFactory(new promotion(content), "区域经理查询下属营销区域");
|
|
|
areasqlFactory.addParameter("siteid", siteid);
|
|
|
areasqlFactory.addParameter("hrid", hrid);
|
|
|
@@ -1060,18 +1050,14 @@ public class Order extends Controller {
|
|
|
|
|
|
QuerySQL querySQL = queryListManage(where.toString());
|
|
|
querySQL.setOrderBy(pageSorting);
|
|
|
- Rows rows;
|
|
|
querySQL.setPage(pageSize, pageNumber);
|
|
|
- rows = querySQL.query();
|
|
|
+ querySQL.setCondition("t1.sonum", "t2.enterprisename", "t2.abbreviation", "t1.remarks");
|
|
|
+ Rows rows = querySQL.query();
|
|
|
|
|
|
ArrayList<Long> ids = rows.toArrayList("sa_orderid", new ArrayList<>());
|
|
|
//查询数量金额
|
|
|
RowsMap OrderAmountRowsMap = beans.order.Order.getSumOrderAmount(this, ids);
|
|
|
|
|
|
-// SQLFactory ischangeSQl = new SQLFactory("sql:SELECT distinct sa_orderid from sa_orderitems_change WHERE siteid='" + siteid + "' and sa_orderid in $sa_orderids$ ");
|
|
|
-// ischangeSQl.addParameter_in("sa_orderids", rows.toArrayList("sa_orderid"));
|
|
|
- ArrayList<Long> ischangesa_orderidList = dbConnect.runSqlQuery("SELECT distinct sa_orderid from sa_orderitems_change WHERE siteid='" + siteid + "' and sa_orderid in " + rows.toArrayList("sa_orderid").toString().replace("[", "(").replace("]", ")")).toArrayList("sa_orderid", new ArrayList<>());
|
|
|
-
|
|
|
for (Row row : rows) {
|
|
|
Long id = row.getLong("sa_orderid");
|
|
|
if (OrderAmountRowsMap.get(id.toString()).isNotEmpty()) {
|
|
|
@@ -1097,7 +1083,6 @@ public class Order extends Controller {
|
|
|
BigDecimal writeoffamount = row.getBigDecimal("writeoffamount");
|
|
|
BigDecimal invoiceamount = row.getBigDecimal("invoiceamount");
|
|
|
BigDecimal amount = row.getBigDecimal("amount");
|
|
|
- row.put("ischange", ischangesa_orderidList.contains(row.getLong("sa_orderid")) ? "1" : "0");
|
|
|
|
|
|
if (writeoffamount.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
row.put("writeoffstatus", "未核销");
|
|
|
@@ -1113,10 +1098,7 @@ public class Order extends Controller {
|
|
|
} else {
|
|
|
row.put("invoicestatus", "部分开票");
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
return getSucReturnObject().setData(rows).toString();
|
|
|
}
|
|
|
|
|
|
@@ -1124,14 +1106,11 @@ public class Order extends Controller {
|
|
|
public QuerySQL queryListManage(String where) throws YosException {
|
|
|
QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_order",
|
|
|
"sa_orderid", "sonum", "type", "status", "submitdate", "checkdate", "remarks", "createby", "checkby", "billdate", "tradefield", "rec_contactsid", "delivery", "tracknumber", "mailno");
|
|
|
-
|
|
|
querySQL.setTableAlias("t1");
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t2", "t2.sys_enterpriseid = t1.sys_enterpriseid and t2.siteid = t1.siteid",
|
|
|
"enterprisename");
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "sa_agents", "t6", "t6.sys_enterpriseid=t1.sys_enterpriseid and t6.siteid = t1.siteid",
|
|
|
"agentnum");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "sa_promotion", "t7", "t7.sa_promotionid=t1.sa_promotionid and t7.siteid = t1.siteid",
|
|
|
- "promnum", "promname");
|
|
|
querySQL.addQueryFields("amount", "CAST(0 AS CHAR(20))");
|
|
|
querySQL.addQueryFields("qty", "CAST(0 AS CHAR(20))");
|
|
|
querySQL.setWhere("t1.siteid", siteid);
|