|
@@ -35,8 +35,8 @@ public class DispatchAutoCloseService extends ServiceController {
|
|
|
//
|
|
|
Properties yosProperties = properties.getYosProperties();
|
|
|
if (yosProperties.getProperty("system.runmode.debug").equalsIgnoreCase("false")) {
|
|
|
- Rows rows = dbConnect.runSqlQuery("select * from sa_dispatch where status='复核' and siteid='CCYOSG'");
|
|
|
- Rows rowsdetail = dbConnect.runSqlQuery("select t1.* from sa_dispatch_items t1 inner join sa_dispatch t2 on t1.sa_dispatchid=t2.sa_dispatchid and t1.siteid=t2.siteid where t2.status='复核' and t1.siteid='CCYOSG'");
|
|
|
+ Rows rows = dbConnect.runSqlQuery("select * from sa_dispatch where status='复核' and siteid='dlb'");
|
|
|
+ Rows rowsdetail = dbConnect.runSqlQuery("select t1.* from sa_dispatch_items t1 inner join sa_dispatch t2 on t1.sa_dispatchid=t2.sa_dispatchid and t1.siteid=t2.siteid where t2.status='复核' and t1.siteid='dlb'");
|
|
|
RowsMap rowsMap = rowsdetail.toRowsMap("sa_dispatchid");
|
|
|
RowsMap rowsMap1 = rowsdetail.toRowsMap("billno");
|
|
|
ArrayList<String> sqlList = new ArrayList<>();
|
|
@@ -88,7 +88,7 @@ public class DispatchAutoCloseService extends ServiceController {
|
|
|
sqlFactory = new SQLFactory(new UploadDataToERP_HY(), "erp上传日志新增");
|
|
|
sqlFactory.addParameter("sys_erpupdatelogid", createTableID("sys_erpupdatelog"));
|
|
|
}
|
|
|
- sqlFactory.addParameter("siteid", "CCYOSG");
|
|
|
+ sqlFactory.addParameter("siteid", "dlb");
|
|
|
sqlFactory.addParameter("userid", 1);
|
|
|
sqlFactory.addParameter("username", "admin");
|
|
|
sqlFactory.addParameter("ownerid", sa_dispatchid);
|
|
@@ -111,7 +111,7 @@ public class DispatchAutoCloseService extends ServiceController {
|
|
|
}
|
|
|
|
|
|
if (resultobject.getString("errcode").equals("0")) {
|
|
|
- sqlList.add("update sa_dispatch set status='关闭',closedate=current_time,closeby='admin' where sa_dispatchid='" + sa_dispatchid + "' and siteid='CCYOSG'");
|
|
|
+ sqlList.add("update sa_dispatch set status='关闭',closedate=current_time,closeby='admin' where sa_dispatchid='" + sa_dispatchid + "' and siteid='dlb'");
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "数据操作日志新增");
|
|
|
sqlFactory.addParameter("sys_contrllogid", createTableID("sys_contrllog"));
|
|
|
sqlFactory.addParameter("ownertable", "sa_dispatch");
|
|
@@ -120,7 +120,7 @@ public class DispatchAutoCloseService extends ServiceController {
|
|
|
sqlFactory.addParameter("remarks", "发货单自动关闭成功");
|
|
|
sqlFactory.addParameter("actionuserid", "1");
|
|
|
sqlFactory.addParameter("actionby", "admin");
|
|
|
- sqlFactory.addParameter("siteid", "CCYOSG");
|
|
|
+ sqlFactory.addParameter("siteid", "dlb");
|
|
|
sqlList.add(sqlFactory.getSQL());
|
|
|
} else {
|
|
|
unclosedispatchids.add(sa_dispatchid);
|
|
@@ -129,7 +129,7 @@ public class DispatchAutoCloseService extends ServiceController {
|
|
|
if (!jsonArray.isEmpty()) {
|
|
|
for (Object object1 : jsonArray) {
|
|
|
JSONObject jsonObject = (JSONObject) object1;
|
|
|
- sqlList.add("update sa_dispatch_items set outwarehousedate=current_time,outwarehouseqty=" + jsonObject.getBigDecimalValue("fqty1") + " where rowno =" + jsonObject.getIntValue("frownum") + " and sa_dispatchid='" + sa_dispatchid + "' and siteid='CCYOSG'");
|
|
|
+ sqlList.add("update sa_dispatch_items set outwarehousedate=current_time,outwarehouseqty=" + jsonObject.getBigDecimalValue("fqty1") + " where rowno =" + jsonObject.getIntValue("frownum") + " and sa_dispatchid='" + sa_dispatchid + "' and siteid='dlb'");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -142,24 +142,24 @@ public class DispatchAutoCloseService extends ServiceController {
|
|
|
//判断当前单据是否已实际发完货,如果发完,则生把订单变为关闭状态
|
|
|
Rows orderRows = new Rows();
|
|
|
if (dispatchids.size() > 0) {
|
|
|
- String sql = "select distinct t1.sa_orderid from sa_orderitems t1 inner join sa_dispatch_items t2 on t1.siteid=t2.siteid and t1.sa_orderitemsid=t2.sa_orderitemsid where t1.siteid='CCYOSG' and t2.sa_dispatchid in" + dispatchids.toJSONString();
|
|
|
+ String sql = "select distinct t1.sa_orderid from sa_orderitems t1 inner join sa_dispatch_items t2 on t1.siteid=t2.siteid and t1.sa_orderitemsid=t2.sa_orderitemsid where t1.siteid='dlb' and t2.sa_dispatchid in" + dispatchids.toJSONString();
|
|
|
sql = sql.replace("[", "(").replace("]", ")");
|
|
|
logger.info("sql:" + sql);
|
|
|
orderRows = dbConnect.runSqlQuery(sql);
|
|
|
}
|
|
|
//总数量
|
|
|
- Rows totalRows = dbConnect.runSqlQuery("select count(1) count,sa_orderid from sa_orderitems where siteid='CCYOSG' group by sa_orderid");
|
|
|
+ Rows totalRows = dbConnect.runSqlQuery("select count(1) count,sa_orderid from sa_orderitems where siteid='dlb' group by sa_orderid");
|
|
|
RowsMap totalRowsMap = totalRows.toRowsMap("sa_orderid");
|
|
|
//已发完数量
|
|
|
- Rows deliRows = dbConnect.runSqlQuery("select count(1) count,sa_orderid from sa_orderitems t1 inner join (SELECT t1.sa_orderitemsid,t1.siteid,SUM(ifnull(t1.outwarehouseqty,0)) outwarehouseqty FROM sa_dispatch_items t1 WHERE t1.siteid='CCYOSG' group by t1.sa_orderitemsid,t1.siteid) t2 on t1.sa_orderitemsid=t2.sa_orderitemsid and t1.siteid=t2.siteid where t1.qty=t2.outwarehouseqty and t1.siteid='CCYOSG' group by sa_orderid");
|
|
|
+ Rows deliRows = dbConnect.runSqlQuery("select count(1) count,sa_orderid from sa_orderitems t1 inner join (SELECT t1.sa_orderitemsid,t1.siteid,SUM(ifnull(t1.outwarehouseqty,0)) outwarehouseqty FROM sa_dispatch_items t1 WHERE t1.siteid='dlb' group by t1.sa_orderitemsid,t1.siteid) t2 on t1.sa_orderitemsid=t2.sa_orderitemsid and t1.siteid=t2.siteid where t1.qty=t2.outwarehouseqty and t1.siteid='dlb' group by sa_orderid");
|
|
|
RowsMap deliRowsMap = deliRows.toRowsMap("sa_orderid");
|
|
|
if (orderRows.size() > 0) {
|
|
|
for (Row row : orderRows) {
|
|
|
logger.info("订单id:" + row.getString("sa_orderid"));
|
|
|
if (totalRowsMap.containsKey(row.getString("sa_orderid")) && deliRowsMap.containsKey(row.getString("sa_orderid"))) {
|
|
|
if (totalRowsMap.get(row.getString("sa_orderid")).get(0).getLong("count") == deliRowsMap.get(row.getString("sa_orderid")).get(0).getLong("count")) {
|
|
|
- logger.info("订单关闭:update sa_order set status='关闭',closedate=current_time,closeby='admin' where sa_orderid=" + row.getLong("sa_orderid") + " and siteid='CCYOSG'");
|
|
|
- dbConnect.runSqlUpdate("update sa_order set status='关闭',closedate=current_time,closeby='admin' where sa_orderid=" + row.getLong("sa_orderid") + " and siteid='CCYOSG'");
|
|
|
+ logger.info("订单关闭:update sa_order set status='关闭',closedate=current_time,closeby='admin' where sa_orderid=" + row.getLong("sa_orderid") + " and siteid='dlb'");
|
|
|
+ dbConnect.runSqlUpdate("update sa_order set status='关闭',closedate=current_time,closeby='admin' where sa_orderid=" + row.getLong("sa_orderid") + " and siteid='dlb'");
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "数据操作日志新增");
|
|
|
sqlFactory.addParameter("sys_contrllogid", createTableID("sys_contrllog"));
|
|
|
sqlFactory.addParameter("ownertable", "sa_order");
|
|
@@ -168,7 +168,7 @@ public class DispatchAutoCloseService extends ServiceController {
|
|
|
sqlFactory.addParameter("remarks", "订单数量发完自动关闭");
|
|
|
sqlFactory.addParameter("actionuserid", "1");
|
|
|
sqlFactory.addParameter("actionby", "admin");
|
|
|
- sqlFactory.addParameter("siteid", "CCYOSG");
|
|
|
+ sqlFactory.addParameter("siteid", "dlb");
|
|
|
dbConnect.runSqlUpdate(sqlFactory.getSQL());
|
|
|
}
|
|
|
}
|
|
@@ -181,7 +181,7 @@ public class DispatchAutoCloseService extends ServiceController {
|
|
|
for (Object object : unclosedispatchids) {
|
|
|
Long sa_dispatchid = Long.valueOf(object.toString());
|
|
|
String billno = "";
|
|
|
- Rows dispatchRows = dbConnect.runSqlQuery("select * from sa_dispatch where sa_dispatchid=" + sa_dispatchid + " and siteid='CCYOSG'");
|
|
|
+ Rows dispatchRows = dbConnect.runSqlQuery("select * from sa_dispatch where sa_dispatchid=" + sa_dispatchid + " and siteid='dlb'");
|
|
|
if (!dispatchRows.isEmpty()) {
|
|
|
billno = dispatchRows.get(0).getString("billno");
|
|
|
} else {
|
|
@@ -216,7 +216,7 @@ public class DispatchAutoCloseService extends ServiceController {
|
|
|
// for (Row row:orderRows) {
|
|
|
// sqlList.add("update sa_order set status='审核' where sa_orderid=" + row.getLong("sa_orderid") + " and siteid='" + siteid + "'");
|
|
|
// }
|
|
|
- uncloseSqlList.add("update sa_dispatch set status='关闭',closedate=current_time,closeby='admin' where sa_dispatchid='" + sa_dispatchid + "' and siteid='CCYOSG'");
|
|
|
+ uncloseSqlList.add("update sa_dispatch set status='关闭',closedate=current_time,closeby='admin' where sa_dispatchid='" + sa_dispatchid + "' and siteid='dlb'");
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "数据操作日志新增");
|
|
|
sqlFactory.addParameter("sys_contrllogid", createTableID("sys_contrllog"));
|
|
|
sqlFactory.addParameter("ownertable", "sa_dispatch");
|
|
@@ -225,7 +225,7 @@ public class DispatchAutoCloseService extends ServiceController {
|
|
|
sqlFactory.addParameter("remarks", "发货单自动关闭成功(未全部发完,未发完数量退回订单并自动关闭)");
|
|
|
sqlFactory.addParameter("actionuserid", "1");
|
|
|
sqlFactory.addParameter("actionby", "admin");
|
|
|
- sqlFactory.addParameter("siteid", "CCYOSG");
|
|
|
+ sqlFactory.addParameter("siteid", "dlb");
|
|
|
uncloseSqlList.add(sqlFactory.getSQL());
|
|
|
} else {
|
|
|
logger.info("发货单手工关闭错误:" + resultobject.getString("errmsg") + "发货单id:" + sa_dispatchid);
|
|
@@ -239,7 +239,7 @@ public class DispatchAutoCloseService extends ServiceController {
|
|
|
sqlFactory = new SQLFactory(new UploadDataToERP_HY(), "erp上传日志新增");
|
|
|
sqlFactory.addParameter("sys_erpupdatelogid", createTableID("sys_erpupdatelog"));
|
|
|
}
|
|
|
- sqlFactory.addParameter("siteid", "CCYOSG");
|
|
|
+ sqlFactory.addParameter("siteid", "dlb");
|
|
|
sqlFactory.addParameter("userid", 1);
|
|
|
sqlFactory.addParameter("username", "admin");
|
|
|
sqlFactory.addParameter("ownerid", sa_dispatchid);
|
|
@@ -261,7 +261,7 @@ public class DispatchAutoCloseService extends ServiceController {
|
|
|
Rows rows1 = dbConnect.runSqlQuery("select t2.userid from sa_dispatch t1 inner join sys_enterprise_hr t2 on t1.siteid=t2.siteid and t1.sys_enterpriseid=t2.sys_enterpriseid where sa_dispatchid=" + o);
|
|
|
HashMap<String, Object> dataextra = new HashMap<>();
|
|
|
dataextra.put("extraUseridList", rows1.toArrayList("userid"));
|
|
|
- Executor.sendEml(this, "dispatch_close", (Long) o, "CCYOSG", dataextra);
|
|
|
+ Executor.sendEml(this, "dispatch_close", (Long) o, "dlb", dataextra);
|
|
|
}
|
|
|
|
|
|
}
|