Jelajahi Sumber

楚楚erp对接逻辑注释

hu 1 Minggu lalu
induk
melakukan
c517e797ad

+ 34 - 34
src/custom/restcontroller/webmanage/sale/aftersalesmag/aftersalesmag.java

@@ -609,18 +609,18 @@ public class aftersalesmag extends Controller {
                 sqlList.add("update sa_orderitems set returnqty=returnqty+" + returnqty + " where sa_orderitemsid=" + row.getString("sa_orderitemsid"));
             }
         }
-        if (Parameter.getBoolean("system.ccerp_dockswitch")) {
-
-            ERPDocking erpDocking =new ERPDocking(siteid);
-            if (!erpDocking.getUrl().isEmpty()) {
-                String billno = rows.get(0).getString("billno");
-                String result =erpDocking.recheckErpSareturn(billno,false,this,sa_aftersalesmagid);
-                if(!result.equals("true")){
-                    return getErrReturnObject().setErrMsg(result).toString();
-                }
-            }
-
-        }
+//        if (Parameter.getBoolean("system.ccerp_dockswitch")) {
+//
+//            ERPDocking erpDocking =new ERPDocking(siteid);
+//            if (!erpDocking.getUrl().isEmpty()) {
+//                String billno = rows.get(0).getString("billno");
+//                String result =erpDocking.recheckErpSareturn(billno,false,this,sa_aftersalesmagid);
+//                if(!result.equals("true")){
+//                    return getErrReturnObject().setErrMsg(result).toString();
+//                }
+//            }
+//
+//        }
         Long sa_cashbillid = 0L;
         if (rows.get(0).getString("type").equals("退货单")) {
             if (rows.get(0).getDouble("returnamount") > 0) {
@@ -818,17 +818,17 @@ public class aftersalesmag extends Controller {
         }
 
         ArrayList<String> sqlList = new ArrayList<>();
-        if (Parameter.getBoolean("system.ccerp_dockswitch")) {
-            ERPDocking erpDocking = new ERPDocking(siteid);
-            if (!erpDocking.getUrl().isEmpty()) {
-                String billno = rows.get(0).getString("billno");
-                String result = erpDocking.recheckErpSareturn(billno, true, this, sa_aftersalesmagid);
-                if (!result.equals("true")) {
-                    return getErrReturnObject().setErrMsg(result).toString();
-                }
-            }
-
-        }
+//        if (Parameter.getBoolean("system.ccerp_dockswitch")) {
+//            ERPDocking erpDocking = new ERPDocking(siteid);
+//            if (!erpDocking.getUrl().isEmpty()) {
+//                String billno = rows.get(0).getString("billno");
+//                String result = erpDocking.recheckErpSareturn(billno, true, this, sa_aftersalesmagid);
+//                if (!result.equals("true")) {
+//                    return getErrReturnObject().setErrMsg(result).toString();
+//                }
+//            }
+//
+//        }
 
 
         if (rows.get(0).getString("type").equals("退货单")) {
@@ -926,17 +926,17 @@ public class aftersalesmag extends Controller {
 
         ArrayList<String> sqlList = new ArrayList<>();
 
-        if (Parameter.getBoolean("system.ccerp_dockswitch")) {
-            ERPDocking erpDocking = new ERPDocking(siteid);
-            if (!erpDocking.getUrl().isEmpty()) {
-                String billno = rows.get(0).getString("billno");
-                JSONArray jsonArray = erpDocking.queryErpSareturn(billno);
-                if (!jsonArray.isEmpty()) {
-                    return getErrReturnObject().setErrMsg("请在erp中删除该返退单后进行此反复核操作").toString();
-                }
-            }
-
-        }
+//        if (Parameter.getBoolean("system.ccerp_dockswitch")) {
+//            ERPDocking erpDocking = new ERPDocking(siteid);
+//            if (!erpDocking.getUrl().isEmpty()) {
+//                String billno = rows.get(0).getString("billno");
+//                JSONArray jsonArray = erpDocking.queryErpSareturn(billno);
+//                if (!jsonArray.isEmpty()) {
+//                    return getErrReturnObject().setErrMsg("请在erp中删除该返退单后进行此反复核操作").toString();
+//                }
+//            }
+//
+//        }
 
         Long sa_cashbillid = 0L;
         long sys_enterpriseid = rows.get(0).getLong("sys_enterpriseid");

+ 54 - 54
src/custom/restcontroller/webmanage/sale/dispatch/dispatch.java

@@ -579,25 +579,25 @@ public class dispatch extends Controller {
         }
 
         //对接erp生成erp发货单
-        if (Parameter.getBoolean("system.ccerp_dockswitch") && !siteid.equalsIgnoreCase("lsa")) {
-            ERPDocking erpDocking = new ERPDocking(siteid);
-            if (!erpDocking.getUrl().isEmpty()) {
-                String result = erpDocking.closeErpSainvoice(rows.get(0).getString("billno"), true, this, sa_dispatchid);
-                if (!result.equals("true")) {
-                    return getErrReturnObject().setErrMsg(result).toString();
-                } else {
-                    JSONArray jsonArray = erpDocking.queryErpSainvoice(rows.get(0).getString("billno"));
-                    ArrayList<String> dispatchsqlList = new ArrayList<>();
-                    if (!jsonArray.isEmpty()) {
-                        for (Object object1 : jsonArray) {
-                            JSONObject jsonObject = (JSONObject) object1;
-                            dispatchsqlList.add("update sa_dispatch_items set outwarehouseqty=" + jsonObject.getBigDecimal("fqty1") + " where rowno =" + jsonObject.getIntValue("frownum") + " and sa_dispatchid='" + sa_dispatchid + "' and siteid='" + siteid + "'");
-                        }
-                    }
-                    dbConnect.runSqlUpdate(dispatchsqlList);
-                }
-            }
-        }
+//        if (Parameter.getBoolean("system.ccerp_dockswitch") && !siteid.equalsIgnoreCase("lsa")) {
+//            ERPDocking erpDocking = new ERPDocking(siteid);
+//            if (!erpDocking.getUrl().isEmpty()) {
+//                String result = erpDocking.closeErpSainvoice(rows.get(0).getString("billno"), true, this, sa_dispatchid);
+//                if (!result.equals("true")) {
+//                    return getErrReturnObject().setErrMsg(result).toString();
+//                } else {
+//                    JSONArray jsonArray = erpDocking.queryErpSainvoice(rows.get(0).getString("billno"));
+//                    ArrayList<String> dispatchsqlList = new ArrayList<>();
+//                    if (!jsonArray.isEmpty()) {
+//                        for (Object object1 : jsonArray) {
+//                            JSONObject jsonObject = (JSONObject) object1;
+//                            dispatchsqlList.add("update sa_dispatch_items set outwarehouseqty=" + jsonObject.getBigDecimal("fqty1") + " where rowno =" + jsonObject.getIntValue("frownum") + " and sa_dispatchid='" + sa_dispatchid + "' and siteid='" + siteid + "'");
+//                        }
+//                    }
+//                    dbConnect.runSqlUpdate(dispatchsqlList);
+//                }
+//            }
+//        }
         ArrayList<String> sqlList = new ArrayList<>();
 
         Rows rowsOrderDetail = dbConnect.runSqlQuery("select t1.undeliqty,t1.deliedqty,t1.qty,t1.sa_orderitemsid from sa_orderitems t1 where t1.sa_orderitemsid in (select sa_orderitemsid from sa_dispatch_items where sa_dispatchid=" + sa_dispatchid + ")");
@@ -688,37 +688,37 @@ public class dispatch extends Controller {
                 batchDeleteErr.addErr(row.getLong("sa_dispatch_itemsid"), "第" + row.getString("rowno") + "行的发货单明细已关闭,请勿重复关闭");
                 continue;
             }
-            if (Parameter.getBoolean("system.ccerp_dockswitch")) {
-                ERPDocking erpDocking = new ERPDocking(siteid);
-                if (!erpDocking.getUrl().isEmpty()) {
-                    String result = erpDocking.closeErpSainvoiceRow(row.getString("billno"), this, row.getLong("rowno"), row.getString("itemno"), row.getLong("sa_dispatchid"));
-                    if (!result.equals("true")) {
-                        batchDeleteErr.addErr(row.getLong("sa_dispatch_itemsid"), result);
-                        continue;
-                    } else {
-                        sqlList.add("update sa_dispatch_items set isclose=1 where sa_dispatch_itemsid=" + row.getLong("sa_dispatch_itemsid"));
-                        sqlList.add("update sa_orderitems set undeliqty=" + rowsMap.get(row.getLong("sa_orderitemsid")).get(0).getBigDecimal("undeliqty").add(row.getBigDecimal("qty").subtract(row.getBigDecimal("outwarehouseqty"))) + ",deliedqty=" + rowsMap.get(row.getLong("sa_orderitemsid")).get(0).getBigDecimal("deliedqty").subtract(row.getBigDecimal("qty").subtract(row.getBigDecimal("outwarehouseqty"))) + " where sa_orderitemsid=" + row.getLong("sa_orderitemsid"));
-                    }
-                }
-            }
+//            if (Parameter.getBoolean("system.ccerp_dockswitch")) {
+//                ERPDocking erpDocking = new ERPDocking(siteid);
+//                if (!erpDocking.getUrl().isEmpty()) {
+//                    String result = erpDocking.closeErpSainvoiceRow(row.getString("billno"), this, row.getLong("rowno"), row.getString("itemno"), row.getLong("sa_dispatchid"));
+//                    if (!result.equals("true")) {
+//                        batchDeleteErr.addErr(row.getLong("sa_dispatch_itemsid"), result);
+//                        continue;
+//                    } else {
+//                        sqlList.add("update sa_dispatch_items set isclose=1 where sa_dispatch_itemsid=" + row.getLong("sa_dispatch_itemsid"));
+//                        sqlList.add("update sa_orderitems set undeliqty=" + rowsMap.get(row.getLong("sa_orderitemsid")).get(0).getBigDecimal("undeliqty").add(row.getBigDecimal("qty").subtract(row.getBigDecimal("outwarehouseqty"))) + ",deliedqty=" + rowsMap.get(row.getLong("sa_orderitemsid")).get(0).getBigDecimal("deliedqty").subtract(row.getBigDecimal("qty").subtract(row.getBigDecimal("outwarehouseqty"))) + " where sa_orderitemsid=" + row.getLong("sa_orderitemsid"));
+//                    }
+//                }
+//            }
         }
         dbConnect.runSqlUpdate(sqlList);
 
         Rows sumcountRows = dbConnect.runSqlQuery("select count(1) sumcount from sa_dispatch_items where sa_dispatchid=" + rows.get(0).getLong("sa_dispatchid") + " and siteid='" + siteid + "'");
         Rows closecountRows = dbConnect.runSqlQuery("select  count(1) closecount from sa_dispatch_items where sa_dispatchid=" + rows.get(0).getLong("sa_dispatchid") + " and siteid='" + siteid + "' and isclose=1");
         if (sumcountRows.get(0).getLong("sumcount") == closecountRows.get(0).getLong("closecount")) {
-            if (Parameter.getBoolean("system.ccerp_dockswitch")) {
-                ERPDocking erpDocking = new ERPDocking(siteid);
-                if (!erpDocking.getUrl().isEmpty()) {
-                    String result = erpDocking.closeErpSainvoice(rows.get(0).getString("billno"), true, this, rows.get(0).getLong("sa_dispatchid"));
-                    if (!result.equals("true")) {
-                        return getErrReturnObject().setErrMsg(result).toString();
-                    } else {
-                        dbConnect.runSqlUpdate("update sa_dispatch set status='手工关闭',closeby='" + username + "',closedate=CURRENT_TIMESTAMP  where sa_dispatchid=" + rows.get(0).getLong("sa_dispatchid"));
-                        dbConnect.runSqlUpdate(DataContrlLog.createLog(this, "sa_dispatch", rows.get(0).getLong("sa_dispatchid"), "手工关闭", "发货单手工关闭成功").getSQL());
-                    }
-                }
-            }
+//            if (Parameter.getBoolean("system.ccerp_dockswitch")) {
+//                ERPDocking erpDocking = new ERPDocking(siteid);
+//                if (!erpDocking.getUrl().isEmpty()) {
+//                    String result = erpDocking.closeErpSainvoice(rows.get(0).getString("billno"), true, this, rows.get(0).getLong("sa_dispatchid"));
+//                    if (!result.equals("true")) {
+//                        return getErrReturnObject().setErrMsg(result).toString();
+//                    } else {
+//                        dbConnect.runSqlUpdate("update sa_dispatch set status='手工关闭',closeby='" + username + "',closedate=CURRENT_TIMESTAMP  where sa_dispatchid=" + rows.get(0).getLong("sa_dispatchid"));
+//                        dbConnect.runSqlUpdate(DataContrlLog.createLog(this, "sa_dispatch", rows.get(0).getLong("sa_dispatchid"), "手工关闭", "发货单手工关闭成功").getSQL());
+//                    }
+//                }
+//            }
         }
 
         return batchDeleteErr.getReturnObject().toString();
@@ -975,16 +975,16 @@ public class dispatch extends Controller {
             sqlList.add("update sa_dispatch set sa_orderid=" + orderRows.get(0).getLong("sa_orderid") + " where siteid='" + siteid + "' and sa_dispatchid=" + sa_dispatchid);
         }
         //对接erp生成erp发货单
-        if (Parameter.getBoolean("system.ccerp_dockswitch")) {
-            ERPDocking erpDocking = new ERPDocking(siteid);
-            if (!erpDocking.getUrl().isEmpty()) {
-                String result = erpDocking.createErpSainvoice(rows.get(0), rowsdetail, this, sa_dispatchid);
-                if (!result.equals("true")) {
-                    System.out.println(result);
-                    return getErrReturnObject().setErrMsg(result).toString();
-                }
-            }
-        }
+//        if (Parameter.getBoolean("system.ccerp_dockswitch")) {
+//            ERPDocking erpDocking = new ERPDocking(siteid);
+//            if (!erpDocking.getUrl().isEmpty()) {
+//                String result = erpDocking.createErpSainvoice(rows.get(0), rowsdetail, this, sa_dispatchid);
+//                if (!result.equals("true")) {
+//                    System.out.println(result);
+//                    return getErrReturnObject().setErrMsg(result).toString();
+//                }
+//            }
+//        }
         //对接erp成功后统一更新订单数量
         for (Row row : rowsDispatchDetailGroup) {
             logger.info(new Date() + "复核测试:" + "update sa_orderitems set undeliqty=" + rowsMap.get(row.getLong("sa_orderitemsid")).get(0).getBigDecimal("undeliqty").subtract(row.getBigDecimal("qty")) + ",deliedqty=" + (row.getBigDecimal("qty").add(rowsMap.get(row.getLong("sa_orderitemsid")).get(0).getBigDecimal("deliedqty"))) + " where sa_orderitemsid=" + row.getLong("sa_orderitemsid"));

+ 6 - 6
src/custom/restcontroller/webmanage/sale/dispatch/dispatchItems.java

@@ -339,9 +339,9 @@ public class dispatchItems extends Controller {
             }
         }else{
             if (rows.toJsonArray("itemno").size() != 0) {
-                if (Parameter.getBoolean("system.ccerp_dockswitch")) {
-                    jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, rows.toJsonArray("itemno"));
-                }
+//                if (Parameter.getBoolean("system.ccerp_dockswitch")) {
+//                    jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, rows.toJsonArray("itemno"));
+//                }
             }
         }
         SQLFactory sqlFactory1 = new SQLFactory(this, "商品发货数量汇总");
@@ -558,9 +558,9 @@ public class dispatchItems extends Controller {
         ERPDocking erpDocking = new ERPDocking(siteid);
         JSONArray jsonArray = new JSONArray();
         if (rows.toJsonArray("itemno").size() != 0) {
-            if (Parameter.getBoolean("system.ccerp_dockswitch")) {
-                //jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, rows.toJsonArray("itemno"));
-            }
+//            if (Parameter.getBoolean("system.ccerp_dockswitch")) {
+//                //jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, rows.toJsonArray("itemno"));
+//            }
 
         }
         SQLFactory sqlFactory1 = new SQLFactory(this, "商品发货数量汇总");

+ 16 - 16
src/custom/restcontroller/webmanage/sale/invbal/invbal.java

@@ -285,14 +285,14 @@ public class invbal extends Controller {
         ERPDocking erpDocking = new ERPDocking(siteid);
         JSONArray jsonArray = new JSONArray();
         if (rows.toJsonArray("itemno").size() != 0) {
-            if (Parameter.getBoolean("system.ccerp_dockswitch")) {
-                if (rows.toJsonArray("itemno").size() <= 2000) {
-                    jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, rows.toJsonArray("itemno"));
-                } else {
-                    jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, new JSONArray());
-                }
-
-            }
+//            if (Parameter.getBoolean("system.ccerp_dockswitch")) {
+//                if (rows.toJsonArray("itemno").size() <= 2000) {
+//                    jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, rows.toJsonArray("itemno"));
+//                } else {
+//                    jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, new JSONArray());
+//                }
+//
+//            }
         }
 
         if (!jsonArray.isEmpty()) {
@@ -561,14 +561,14 @@ public class invbal extends Controller {
         ERPDocking erpDocking = new ERPDocking(siteid);
         JSONArray jsonArray = new JSONArray();
         if (rows.toJsonArray("itemno").size() != 0) {
-            if (Parameter.getBoolean("system.ccerp_dockswitch")) {
-                if (rows.toJsonArray("itemno").size() <= 2000) {
-                    jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, rows.toJsonArray("itemno"));
-                } else {
-                    jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, new JSONArray());
-                }
-
-            }
+//            if (Parameter.getBoolean("system.ccerp_dockswitch")) {
+//                if (rows.toJsonArray("itemno").size() <= 2000) {
+//                    jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, rows.toJsonArray("itemno"));
+//                } else {
+//                    jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, new JSONArray());
+//                }
+//
+//            }
         }
 
         if (!jsonArray.isEmpty()) {

+ 10 - 10
src/custom/restcontroller/webmanage/sale/item/Item.java

@@ -370,11 +370,11 @@ public class Item extends Controller {
 
         ERPDocking erpDocking = new ERPDocking(siteid);
         JSONArray jsonArray = new JSONArray();
-        if (Parameter.getBoolean("system.ccerp_dockswitch")) {
-            if (!rows.toJsonArray("itemno").isEmpty()) {
-                jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, rows.toJsonArray("itemno"));
-            }
-        }
+//        if (Parameter.getBoolean("system.ccerp_dockswitch")) {
+//            if (!rows.toJsonArray("itemno").isEmpty()) {
+//                jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, rows.toJsonArray("itemno"));
+//            }
+//        }
         if (!jsonArray.isEmpty()) {
             for (Object object : jsonArray) {
                 JSONObject jsonObject = (JSONObject) object;
@@ -459,11 +459,11 @@ public class Item extends Controller {
         } else {
             ERPDocking erpDocking = new ERPDocking(siteid);
             JSONArray jsonArray = new JSONArray();
-            if (Parameter.getBoolean("system.ccerp_dockswitch")) {
-                if (!rows.toJsonArray("itemno").isEmpty()) {
-                    jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, rows.toJsonArray("itemno"));
-                }
-            }
+//            if (Parameter.getBoolean("system.ccerp_dockswitch")) {
+//                if (!rows.toJsonArray("itemno").isEmpty()) {
+//                    jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, rows.toJsonArray("itemno"));
+//                }
+//            }
             if (!jsonArray.isEmpty()) {
                 for (Object object : jsonArray) {
                     JSONObject jsonObject = (JSONObject) object;

+ 8 - 8
src/custom/restcontroller/webmanage/sale/order/OrderItems.java

@@ -769,11 +769,11 @@ public class OrderItems extends Controller {
                 }
             } else {
                 ERPDocking erpDocking = new ERPDocking(siteid);
-                if (rows.toJsonArray("itemno").size() != 0) {
-                    if (Parameter.getBoolean("system.ccerp_dockswitch")) {
-                        jsonArray = erpDocking.getErpIcinvbalRows(1000, 1, rows.toJsonArray("itemno"));
-                    }
-                }
+//                if (rows.toJsonArray("itemno").size() != 0) {
+//                    if (Parameter.getBoolean("system.ccerp_dockswitch")) {
+//                        jsonArray = erpDocking.getErpIcinvbalRows(1000, 1, rows.toJsonArray("itemno"));
+//                    }
+//                }
                 if (!jsonArray.isEmpty()) {
                     for (Object object : jsonArray) {
                         JSONObject jsonObject = (JSONObject) object;
@@ -1000,9 +1000,9 @@ public class OrderItems extends Controller {
         ERPDocking erpDocking = new ERPDocking(siteid);
         JSONArray jsonArray = new JSONArray();
         if (rows.toJsonArray("itemno").size() != 0) {
-            if (Parameter.getBoolean("system.ccerp_dockswitch")) {
-                jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, rows.toJsonArray("itemno"));
-            }
+//            if (Parameter.getBoolean("system.ccerp_dockswitch")) {
+//                jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, rows.toJsonArray("itemno"));
+//            }
         }
 
         if (!jsonArray.isEmpty()) {