浏览代码

对接改为dlb站点

hu 1 年之前
父节点
当前提交
a91ea096e9

+ 4 - 4
src/custom/service/AftersalesmagAutoRecheckService.java

@@ -33,7 +33,7 @@ public class AftersalesmagAutoRecheckService extends ServiceController {
         //
         Properties yosProperties = properties.getYosProperties();
         if (yosProperties.getProperty("system.runmode.debug").equalsIgnoreCase("false")) {
-            Rows rows = dbConnect.runSqlQuery("select * from sa_aftersalesmag where status='审核' and type='换货单' and siteid='CCYOSG'");
+            Rows rows = dbConnect.runSqlQuery("select * from sa_aftersalesmag where status='审核' and type='换货单' and siteid='dlb'");
             RowsMap rowsMap1 = rows.toRowsMap("billno");
             ArrayList<String> sqlList = new ArrayList<>();
             ERPDocking erpDocking = new ERPDocking();
@@ -79,7 +79,7 @@ public class AftersalesmagAutoRecheckService 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_aftersalesmagid);
@@ -101,7 +101,7 @@ public class AftersalesmagAutoRecheckService extends ServiceController {
                         e.printStackTrace();
                     }
                     if (resultobject.getString("errcode").equals("0")) {
-                        sqlList.add("update sa_aftersalesmag set status='复核' where sa_aftersalesmagid='" + sa_aftersalesmagid + "' and siteid='CCYOSG'");
+                        sqlList.add("update sa_aftersalesmag set status='复核' where sa_aftersalesmagid='" + sa_aftersalesmagid + "' and siteid='dlb'");
                         SQLFactory sqlFactory = new SQLFactory(this, "数据操作日志新增");
                         sqlFactory.addParameter("sys_contrllogid", createTableID("sys_contrllog"));
                         sqlFactory.addParameter("ownertable", "sa_aftersalesmag");
@@ -110,7 +110,7 @@ public class AftersalesmagAutoRecheckService 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 {
                         logger.info("换货单自动复核错误:" + resultobject.getString("errmsg"));

+ 1 - 1
src/custom/service/AutoDockItemService.java

@@ -25,7 +25,7 @@ public class AutoDockItemService extends ServiceController {
     @Override
     public void serviceRun() throws YosException {
         ArrayList<String> sqlList = new ArrayList<>();
-        String siteid ="CCYOSG";
+        String siteid ="dlb";
         Rows rows = new DBConnect().runSqlQuery("select * from sys_parameter where paramname='AutoDockItemServiceTime'");
         Date date =new Date();
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

+ 17 - 17
src/custom/service/DispatchAutoCloseService.java

@@ -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);
             }
 
         }

+ 16 - 16
src/custom/service/StockAutoDockAftersalesmagService.java

@@ -34,15 +34,15 @@ public class StockAutoDockAftersalesmagService extends ServiceController {
             ERPDocking erpDocking = new ERPDocking();
             JSONArray ErpSainvoices = erpDocking.queryErpStockBill(500, 1,"销售退货");
             JSONArray flags=new JSONArray();
-            String siteid = "ccyosg";
+            String siteid = "dlb";
             if (!ErpSainvoices.isEmpty()) {
                 for (Object ErpSainvoice : ErpSainvoices) {
                     JSONObject erpSainvoice = (JSONObject) ErpSainvoice;
                     // 经销商编号
                     String fagentnum = erpSainvoice.getString("fagentnum");
                     long sys_enterpriseid = 0;
-                    if (dbConnect.runSqlQuery("select sys_enterpriseid from sa_agents where siteid='ccyosg' and  agentnum='" + fagentnum + "'").isNotEmpty()) {
-                        sys_enterpriseid = dbConnect.runSqlQuery("select sys_enterpriseid from sa_agents where siteid='ccyosg' and  agentnum='" + fagentnum + "'").get(0).getLong("sys_enterpriseid");
+                    if (dbConnect.runSqlQuery("select sys_enterpriseid from sa_agents where siteid='dlb' and  agentnum='" + fagentnum + "'").isNotEmpty()) {
+                        sys_enterpriseid = dbConnect.runSqlQuery("select sys_enterpriseid from sa_agents where siteid='dlb' and  agentnum='" + fagentnum + "'").get(0).getLong("sys_enterpriseid");
                     } else {
                         JSONObject flag =new JSONObject();
                         flag.put("syncyosid",erpSainvoice.getStringValue("syncyosid"));
@@ -78,8 +78,8 @@ public class StockAutoDockAftersalesmagService extends ServiceController {
                     String fsourcebillno = erpSainvoice.getString("fsourcebillno");
                     long sa_aftersalesmagid=0;
                     if(StringUtils.isNotBlank(fsourcebillno)){
-                        if (dbConnect.runSqlQuery("select sa_aftersalesmagid from sa_aftersalesmag where siteid='ccyosg' and  billno='" + fsourcebillno + "'").isNotEmpty()) {
-                            sa_aftersalesmagid = dbConnect.runSqlQuery("select sa_aftersalesmagid from sa_aftersalesmag where siteid='ccyosg' and  billno='" + fsourcebillno + "'").get(0).getLong("sa_aftersalesmagid");
+                        if (dbConnect.runSqlQuery("select sa_aftersalesmagid from sa_aftersalesmag where siteid='dlb' and  billno='" + fsourcebillno + "'").isNotEmpty()) {
+                            sa_aftersalesmagid = dbConnect.runSqlQuery("select sa_aftersalesmagid from sa_aftersalesmag where siteid='dlb' and  billno='" + fsourcebillno + "'").get(0).getLong("sa_aftersalesmagid");
                         } else {
                             JSONObject flag =new JSONObject();
                             flag.put("syncyosid",erpSainvoice.getStringValue("syncyosid"));
@@ -100,7 +100,7 @@ public class StockAutoDockAftersalesmagService extends ServiceController {
 
                     Long sa_cashbillid = 0L;
 
-                    Rows stockbillRows = dbConnect.runSqlQuery("select * from st_stockbill where siteid='ccyosg' and status='审核' and billno='" + fbillnum + "'");
+                    Rows stockbillRows = dbConnect.runSqlQuery("select * from st_stockbill where siteid='dlb' and status='审核' and billno='" + fbillnum + "'");
                     Long st_stockbillid = 0L;
                     if (stockbillRows.isEmpty() && "审核".equals(fstatus)) {
                         /**
@@ -108,7 +108,7 @@ public class StockAutoDockAftersalesmagService extends ServiceController {
                          */
                         SQLFactory sqlFactory = new SQLFactory(this, "销售出库单新增");
                         st_stockbillid = createTableID("st_stockbill");
-                        sqlFactory.addParameter("siteid", "ccyosg");
+                        sqlFactory.addParameter("siteid", "dlb");
                         sqlFactory.addParameter("st_stockbillid", st_stockbillid);
                         sqlFactory.addParameter("sys_enterpriseid", sys_enterpriseid);
                         sqlFactory.addParameter("billno", fbillnum);
@@ -137,15 +137,15 @@ public class StockAutoDockAftersalesmagService extends ServiceController {
                         }
                         Rows rows;
                         if (!str.toString().equals("")) {
-                            rows = dbConnect.runSqlQuery("select * from plm_item  where siteid='ccyosg' and itemno in " + "(" + str.toString() + ")");
+                            rows = dbConnect.runSqlQuery("select * from plm_item  where siteid='dlb' and itemno in " + "(" + str.toString() + ")");
                         } else {
-                            rows = dbConnect.runSqlQuery("select * from plm_item  where siteid='ccyosg' and itemno in('')");
+                            rows = dbConnect.runSqlQuery("select * from plm_item  where siteid='dlb' and itemno in('')");
                         }
                         RowsMap itemRowsMap = rows.toRowsMap("itemno");
-//                        Rows distiptchRows = dbConnect.runSqlQuery("select t2.price,t1.sa_dispatch_itemsid,t1.rowno,t1.sa_orderitemsid,t2.sa_orderid,t3.sys_enterpriseid,t4.sonum,t5.itemno,t5.itemname from sa_dispatch_items t1 inner join sa_orderitems t2 on t1.sa_orderitemsid=t2.sa_orderitemsid and t1.siteid=t2.siteid inner join sa_dispatch t3 on t1.sa_dispatchid=t3.sa_dispatchid and t1.siteid=t3.siteid left join sa_order t4 on t2.sa_orderid=t4.sa_orderid and t2.siteid=t4.siteid left join plm_item t5 on t1.itemid=t5.itemid and t1.siteid=t5.siteid where t3.status in('审核','复核','关闭') and  t1.siteid='ccyosg' and  t1.sa_dispatchid = " + sa_dispatchid);
+//                        Rows distiptchRows = dbConnect.runSqlQuery("select t2.price,t1.sa_dispatch_itemsid,t1.rowno,t1.sa_orderitemsid,t2.sa_orderid,t3.sys_enterpriseid,t4.sonum,t5.itemno,t5.itemname from sa_dispatch_items t1 inner join sa_orderitems t2 on t1.sa_orderitemsid=t2.sa_orderitemsid and t1.siteid=t2.siteid inner join sa_dispatch t3 on t1.sa_dispatchid=t3.sa_dispatchid and t1.siteid=t3.siteid left join sa_order t4 on t2.sa_orderid=t4.sa_orderid and t2.siteid=t4.siteid left join plm_item t5 on t1.itemid=t5.itemid and t1.siteid=t5.siteid where t3.status in('审核','复核','关闭') and  t1.siteid='dlb' and  t1.sa_dispatchid = " + sa_dispatchid);
 //                        RowsMap distiptchRowsMap = distiptchRows.toRowsMap("rowno");
 
-                        Rows aftersalesmagRows = dbConnect.runSqlQuery("select t1.price,t1.sa_aftersalesmag_itemsid,t3.itemno,t1.sa_orderitemsid,t2.sa_orderid from sa_aftersalesmag_items t1 inner join sa_orderitems t2 on t1.sa_orderitemsid=t2.sa_orderitemsid and t1.siteid=t2.siteid inner join plm_item t3  on t1.itemid=t3.itemid and t1.siteid=t3.siteid  where  t1.siteid='ccyosg' and  t1.sa_aftersalesmagid = " +sa_aftersalesmagid);
+                        Rows aftersalesmagRows = dbConnect.runSqlQuery("select t1.price,t1.sa_aftersalesmag_itemsid,t3.itemno,t1.sa_orderitemsid,t2.sa_orderid from sa_aftersalesmag_items t1 inner join sa_orderitems t2 on t1.sa_orderitemsid=t2.sa_orderitemsid and t1.siteid=t2.siteid inner join plm_item t3  on t1.itemid=t3.itemid and t1.siteid=t3.siteid  where  t1.siteid='dlb' and  t1.sa_aftersalesmagid = " +sa_aftersalesmagid);
                         RowsMap aftersalesmagRowsMap = aftersalesmagRows.toRowsMap("itemno");
                         BigDecimal amountTotal = BigDecimal.ZERO;
                         for (Object object : detailarray) {
@@ -161,7 +161,7 @@ public class StockAutoDockAftersalesmagService extends ServiceController {
                             //String fbatchno = jsonObject.getString("fbatchno");
                             String fdetailnotes = jsonObject.getString("fnote");
                             SQLFactory sqlFactorydetail = new SQLFactory(this, "销售出库单明细新增");
-                            sqlFactorydetail.addParameter("siteid", "ccyosg");
+                            sqlFactorydetail.addParameter("siteid", "dlb");
                             sqlFactorydetail.addParameter("st_stockbill_itemsid", createTableID("st_stockbill_items"));
                             sqlFactorydetail.addParameter("st_stockbillid", st_stockbillid);
                             sqlFactorydetail.addParameter("rowno", frownum);
@@ -214,7 +214,7 @@ public class StockAutoDockAftersalesmagService extends ServiceController {
 
                             sqlList.add(sqlFactorydetail.getSQL());
                         }
-                        sqlList.add("update st_stockbill set status='审核',checkby='" + createby + "',checkdate=CURRENT_TIMESTAMP where st_stockbillid = " + st_stockbillid + " and siteid='ccyosg'");  JSONObject flag =new JSONObject();
+                        sqlList.add("update st_stockbill set status='审核',checkby='" + createby + "',checkdate=CURRENT_TIMESTAMP where st_stockbillid = " + st_stockbillid + " and siteid='dlb'");  JSONObject flag =new JSONObject();
                         flag.put("syncyosid",erpSainvoice.getStringValue("syncyosid"));
                         flag.put("fupdateflag", "1");
                         flag.put("fupdatewarnlog", "");
@@ -224,7 +224,7 @@ public class StockAutoDockAftersalesmagService extends ServiceController {
                         /**
                          * DRP存在销售出库单,且中间表状态为审核且不在删除状态时,DRP中需将当前销售出库单先反审核,修改内容后再进行审核
                          */
-                        sqlList.add("update st_stockbill set status='新建',checkby='',checkdate=null where st_stockbillid = " + stockbillRows.get(0).getLong("st_stockbillid") + " and siteid='ccyosg'");
+                        sqlList.add("update st_stockbill set status='新建',checkby='',checkdate=null where st_stockbillid = " + stockbillRows.get(0).getLong("st_stockbillid") + " and siteid='dlb'");
                         JSONObject flag =new JSONObject();
                         flag.put("syncyosid",erpSainvoice.getStringValue("syncyosid"));
                         flag.put("fupdateflag", "99");
@@ -235,7 +235,7 @@ public class StockAutoDockAftersalesmagService extends ServiceController {
                         /**
                          * DRP存在收入凭证,且中间表状态为新建或在删除状态时,DRP中需将当前收入销售出库单先反审核
                          */
-                        sqlList.add("update st_stockbill set status='新建',checkby='',checkdate=null where st_stockbillid = " + stockbillRows.get(0).getLong("st_stockbillid") + " and siteid='ccyosg'");
+                        sqlList.add("update st_stockbill set status='新建',checkby='',checkdate=null where st_stockbillid = " + stockbillRows.get(0).getLong("st_stockbillid") + " and siteid='dlb'");
                         JSONObject flag =new JSONObject();
                         flag.put("syncyosid",erpSainvoice.getStringValue("syncyosid"));
                         flag.put("fupdateflag", "1");
@@ -267,7 +267,7 @@ public class StockAutoDockAftersalesmagService extends ServiceController {
     }
     public void sendMsg(String content, Long st_stockbillid, Long sys_enterpriseid) throws YosException {
 
-        ArrayList<Long> userList = getEnterpriseHrs(sys_enterpriseid,"ccyosg").toArrayList("userid", new ArrayList<>());
+        ArrayList<Long> userList = getEnterpriseHrs(sys_enterpriseid,"dlb").toArrayList("userid", new ArrayList<>());
         Remind remind = new Remind(new Controller(new JSONObject()));
         remind.setTitle("销售出库单消息");
         remind.setContent(content);

+ 16 - 16
src/custom/service/StockAutoDockDispatchService.java

@@ -40,15 +40,15 @@ public class StockAutoDockDispatchService extends ServiceController {
             ERPDocking erpDocking = new ERPDocking();
             JSONArray ErpSainvoices = erpDocking.queryErpStockBill(500, 1,"销售出库");
             JSONArray flags=new JSONArray();
-            String siteid = "ccyosg";
+            String siteid = "dlb";
             if (!ErpSainvoices.isEmpty()) {
                 for (Object ErpSainvoice : ErpSainvoices) {
                     JSONObject erpSainvoice = (JSONObject) ErpSainvoice;
                     // 经销商编号
                     String fagentnum = erpSainvoice.getString("fagentnum");
                     long sys_enterpriseid = 0;
-                    if (dbConnect.runSqlQuery("select sys_enterpriseid from sa_agents where siteid='ccyosg' and  agentnum='" + fagentnum + "'").isNotEmpty()) {
-                        sys_enterpriseid = dbConnect.runSqlQuery("select sys_enterpriseid from sa_agents where siteid='ccyosg' and  agentnum='" + fagentnum + "'").get(0).getLong("sys_enterpriseid");
+                    if (dbConnect.runSqlQuery("select sys_enterpriseid from sa_agents where siteid='dlb' and  agentnum='" + fagentnum + "'").isNotEmpty()) {
+                        sys_enterpriseid = dbConnect.runSqlQuery("select sys_enterpriseid from sa_agents where siteid='dlb' and  agentnum='" + fagentnum + "'").get(0).getLong("sys_enterpriseid");
                     } else {
                         JSONObject flag =new JSONObject();
                         flag.put("syncyosid",erpSainvoice.getStringValue("syncyosid"));
@@ -85,8 +85,8 @@ public class StockAutoDockDispatchService extends ServiceController {
                     String fsourcetype = erpSainvoice.getString("fsourcetype");
                     long sa_dispatchid=0;
                     if(StringUtils.isNotBlank(fsourcebillno)){
-                        if (dbConnect.runSqlQuery("select sa_dispatchid from sa_dispatch where siteid='ccyosg' and  billno='" + fsourcebillno + "'").isNotEmpty()) {
-                            sa_dispatchid = dbConnect.runSqlQuery("select sa_dispatchid from sa_dispatch where siteid='ccyosg' and  billno='" + fsourcebillno + "'").get(0).getLong("sa_dispatchid");
+                        if (dbConnect.runSqlQuery("select sa_dispatchid from sa_dispatch where siteid='dlb' and  billno='" + fsourcebillno + "'").isNotEmpty()) {
+                            sa_dispatchid = dbConnect.runSqlQuery("select sa_dispatchid from sa_dispatch where siteid='dlb' and  billno='" + fsourcebillno + "'").get(0).getLong("sa_dispatchid");
                         } else {
                             JSONObject flag =new JSONObject();
                             flag.put("syncyosid",erpSainvoice.getStringValue("syncyosid"));
@@ -107,7 +107,7 @@ public class StockAutoDockDispatchService extends ServiceController {
 
                     Long sa_cashbillid = 0L;
 
-                    Rows stockbillRows = dbConnect.runSqlQuery("select * from st_stockbill where siteid='ccyosg' and status='审核' and billno='" + fbillnum + "'");
+                    Rows stockbillRows = dbConnect.runSqlQuery("select * from st_stockbill where siteid='dlb' and status='审核' and billno='" + fbillnum + "'");
                     Long st_stockbillid = 0L;
                     if (stockbillRows.isEmpty() && "审核".equals(fstatus)) {
                         /**
@@ -115,7 +115,7 @@ public class StockAutoDockDispatchService extends ServiceController {
                          */
                         SQLFactory sqlFactory = new SQLFactory(this, "销售出库单新增");
                         st_stockbillid = createTableID("st_stockbill");
-                        sqlFactory.addParameter("siteid", "ccyosg");
+                        sqlFactory.addParameter("siteid", "dlb");
                         sqlFactory.addParameter("st_stockbillid", st_stockbillid);
                         sqlFactory.addParameter("sys_enterpriseid", sys_enterpriseid);
                         sqlFactory.addParameter("billno", fbillnum);
@@ -144,15 +144,15 @@ public class StockAutoDockDispatchService extends ServiceController {
                         }
                         Rows rows;
                         if (!str.toString().equals("")) {
-                            rows = dbConnect.runSqlQuery("select * from plm_item  where siteid='ccyosg' and itemno in " + "(" + str.toString() + ")");
+                            rows = dbConnect.runSqlQuery("select * from plm_item  where siteid='dlb' and itemno in " + "(" + str.toString() + ")");
                         } else {
-                            rows = dbConnect.runSqlQuery("select * from plm_item  where siteid='ccyosg' and itemno in('')");
+                            rows = dbConnect.runSqlQuery("select * from plm_item  where siteid='dlb' and itemno in('')");
                         }
                         RowsMap itemRowsMap = rows.toRowsMap("itemno");
-                        Rows distiptchRows = dbConnect.runSqlQuery("select t2.price,t1.sa_dispatch_itemsid,t1.rowno,t1.sa_orderitemsid,t2.sa_orderid,t3.sys_enterpriseid,t4.sonum,t5.itemno,t5.itemname from sa_dispatch_items t1 inner join sa_orderitems t2 on t1.sa_orderitemsid=t2.sa_orderitemsid and t1.siteid=t2.siteid inner join sa_dispatch t3 on t1.sa_dispatchid=t3.sa_dispatchid and t1.siteid=t3.siteid left join sa_order t4 on t2.sa_orderid=t4.sa_orderid and t2.siteid=t4.siteid left join plm_item t5 on t1.itemid=t5.itemid and t1.siteid=t5.siteid where t3.status in('审核','复核','关闭') and  t1.siteid='ccyosg' and  t1.sa_dispatchid = " + sa_dispatchid);
+                        Rows distiptchRows = dbConnect.runSqlQuery("select t2.price,t1.sa_dispatch_itemsid,t1.rowno,t1.sa_orderitemsid,t2.sa_orderid,t3.sys_enterpriseid,t4.sonum,t5.itemno,t5.itemname from sa_dispatch_items t1 inner join sa_orderitems t2 on t1.sa_orderitemsid=t2.sa_orderitemsid and t1.siteid=t2.siteid inner join sa_dispatch t3 on t1.sa_dispatchid=t3.sa_dispatchid and t1.siteid=t3.siteid left join sa_order t4 on t2.sa_orderid=t4.sa_orderid and t2.siteid=t4.siteid left join plm_item t5 on t1.itemid=t5.itemid and t1.siteid=t5.siteid where t3.status in('审核','复核','关闭') and  t1.siteid='dlb' and  t1.sa_dispatchid = " + sa_dispatchid);
                         RowsMap distiptchRowsMap = distiptchRows.toRowsMap("rowno");
 
-//                        Rows aftersalesmagRows = dbConnect.runSqlQuery("select t1.price,t1.sa_aftersalesmag_itemsid,t1.sa_orderitemsid,t2.sa_orderid from sa_aftersalesmag_items t1 inner join sa_orderitems t2 on t1.sa_orderitemsid=t2.sa_orderitemsid and t1.siteid=t2.siteid  where  t1.siteid='ccyosg' and  t1.sa_aftersalesmag_itemsid in " + sa_dispatch_itemsids.toString().replace("[", "(").replace("]", ")"));
+//                        Rows aftersalesmagRows = dbConnect.runSqlQuery("select t1.price,t1.sa_aftersalesmag_itemsid,t1.sa_orderitemsid,t2.sa_orderid from sa_aftersalesmag_items t1 inner join sa_orderitems t2 on t1.sa_orderitemsid=t2.sa_orderitemsid and t1.siteid=t2.siteid  where  t1.siteid='dlb' and  t1.sa_aftersalesmag_itemsid in " + sa_dispatch_itemsids.toString().replace("[", "(").replace("]", ")"));
 //                        RowsMap aftersalesmagRowsMap = aftersalesmagRows.toRowsMap("rowno");
                         BigDecimal amountTotal = BigDecimal.ZERO;
                         for (Object object : detailarray) {
@@ -168,7 +168,7 @@ public class StockAutoDockDispatchService extends ServiceController {
                             //String fbatchno = jsonObject.getString("fbatchno");
                             String fdetailnotes = jsonObject.getString("fnote");
                             SQLFactory sqlFactorydetail = new SQLFactory(this, "销售出库单明细新增");
-                            sqlFactorydetail.addParameter("siteid", "ccyosg");
+                            sqlFactorydetail.addParameter("siteid", "dlb");
                             sqlFactorydetail.addParameter("st_stockbill_itemsid", createTableID("st_stockbill_items"));
                             sqlFactorydetail.addParameter("st_stockbillid", st_stockbillid);
                             sqlFactorydetail.addParameter("rowno", frownum);
@@ -220,7 +220,7 @@ public class StockAutoDockDispatchService extends ServiceController {
 
                             sqlList.add(sqlFactorydetail.getSQL());
                         }
-                        sqlList.add("update st_stockbill set status='审核',checkby='" + createby + "',checkdate=CURRENT_TIMESTAMP where st_stockbillid = " + st_stockbillid + " and siteid='ccyosg'");  JSONObject flag =new JSONObject();
+                        sqlList.add("update st_stockbill set status='审核',checkby='" + createby + "',checkdate=CURRENT_TIMESTAMP where st_stockbillid = " + st_stockbillid + " and siteid='dlb'");  JSONObject flag =new JSONObject();
                         flag.put("syncyosid",erpSainvoice.getStringValue("syncyosid"));
                         flag.put("fupdateflag", "1");
                         flag.put("fupdatewarnlog", "");
@@ -230,7 +230,7 @@ public class StockAutoDockDispatchService extends ServiceController {
                         /**
                          * DRP存在销售出库单,且中间表状态为审核且不在删除状态时,DRP中需将当前销售出库单先反审核,修改内容后再进行审核
                          */
-                        sqlList.add("update st_stockbill set status='新建',checkby='',checkdate=null where st_stockbillid = " + stockbillRows.get(0).getLong("st_stockbillid") + " and siteid='ccyosg'");
+                        sqlList.add("update st_stockbill set status='新建',checkby='',checkdate=null where st_stockbillid = " + stockbillRows.get(0).getLong("st_stockbillid") + " and siteid='dlb'");
                         JSONObject flag =new JSONObject();
                         flag.put("syncyosid",erpSainvoice.getStringValue("syncyosid"));
                         flag.put("fupdateflag", "99");
@@ -241,7 +241,7 @@ public class StockAutoDockDispatchService extends ServiceController {
                         /**
                          * DRP存在收入凭证,且中间表状态为新建或在删除状态时,DRP中需将当前收入销售出库单先反审核
                          */
-                        sqlList.add("update st_stockbill set status='新建',checkby='',checkdate=null where st_stockbillid = " + stockbillRows.get(0).getLong("st_stockbillid") + " and siteid='ccyosg'");
+                        sqlList.add("update st_stockbill set status='新建',checkby='',checkdate=null where st_stockbillid = " + stockbillRows.get(0).getLong("st_stockbillid") + " and siteid='dlb'");
                         JSONObject flag =new JSONObject();
                         flag.put("syncyosid",erpSainvoice.getStringValue("syncyosid"));
                         flag.put("fupdateflag", "1");
@@ -274,7 +274,7 @@ public class StockAutoDockDispatchService extends ServiceController {
     }
     public void sendMsg(String content, Long st_stockbillid, Long sys_enterpriseid) throws YosException {
 
-        ArrayList<Long> userList = getEnterpriseHrs(sys_enterpriseid,"ccyosg").toArrayList("userid", new ArrayList<>());
+        ArrayList<Long> userList = getEnterpriseHrs(sys_enterpriseid,"dlb").toArrayList("userid", new ArrayList<>());
         Remind remind = new Remind(new Controller(new JSONObject()));
         remind.setTitle("销售出库单消息");
         remind.setContent(content);