|
@@ -527,50 +527,57 @@ public class dispatch extends Controller {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(siteid.equalsIgnoreCase("lsa")){
|
|
|
- JSONObject object = new JSONObject();
|
|
|
- object.put("classname", "getIcinvbal");
|
|
|
- object.put("method", "getIcstockbillMsg");
|
|
|
+ if (siteid.equalsIgnoreCase("lsa")) {
|
|
|
+ Rows erp_urlrows = dbConnect.runSqlQuery("SELECT erp_url from sys_site_parameter WHERE siteid='" + siteid + "'");
|
|
|
+ if (erp_urlrows.isNotEmpty()) {
|
|
|
+ String url = rows.get(0).getString("erp_url");
|
|
|
+ if(!StringUtils.isBlank(url)){
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ object.put("classname", "getIcinvbal");
|
|
|
+ object.put("method", "getIcstockbillMsg");
|
|
|
+
|
|
|
+ JSONObject content = new JSONObject();
|
|
|
+
|
|
|
+ content.put("sa_dispatch_itemsids", rowsdetail.toJsonArray("sa_dispatch_itemsid"));
|
|
|
+ object.put("content", content);
|
|
|
+
|
|
|
+ WebRequest request = new WebRequest();
|
|
|
+ String result = request.doPost(object.toString(),
|
|
|
+ url);
|
|
|
+ JSONArray jsonArray = new JSONArray();
|
|
|
+ if (isJSONArray(result)) {
|
|
|
+ jsonArray = JSONArray.parseArray(result);
|
|
|
+ } else {
|
|
|
+ return getErrReturnObject().setErrMsg("与中间表连接异常")
|
|
|
+ .toString();
|
|
|
+ }
|
|
|
+ if (!jsonArray.isEmpty()) {
|
|
|
+ return getErrReturnObject().setErrMsg("中间表存在未同步的销售出库单,无法手工关闭")
|
|
|
+ .toString();
|
|
|
+ }
|
|
|
+ //
|
|
|
+ JSONObject object1 = new JSONObject();
|
|
|
+ object1.put("classname", "getIcinvbal");
|
|
|
+ object1.put("method", "canCloseSainvoiceByHand");
|
|
|
|
|
|
- JSONObject content = new JSONObject();
|
|
|
+ JSONObject content1 = new JSONObject();
|
|
|
+ content1.put("billno", rows.get(0).getString("billno"));
|
|
|
+ object1.put("content", content1);
|
|
|
|
|
|
- content.put("sa_dispatch_itemsids", rowsdetail.toJsonArray("sa_dispatch_itemsid"));
|
|
|
- object.put("content", content);
|
|
|
+ String canCloseSainvoiceByHand = request.doPost(object1.toString(),
|
|
|
+ url);
|
|
|
|
|
|
- WebRequest request = new WebRequest();
|
|
|
- String result = request.doPost(object.toString(),
|
|
|
- "http://60.190.151.198:8089/BYESB/jaxrs/webclientrest");
|
|
|
- JSONArray jsonArray = new JSONArray();
|
|
|
- if (isJSONArray(result)) {
|
|
|
- jsonArray = JSONArray.parseArray(result);
|
|
|
- } else {
|
|
|
- return getErrReturnObject().setErrMsg("与中间表连接异常")
|
|
|
- .toString();
|
|
|
- }
|
|
|
- if (!jsonArray.isEmpty()) {
|
|
|
- return getErrReturnObject().setErrMsg("中间表存在未同步的销售出库单,无法手工关闭")
|
|
|
- .toString();
|
|
|
+ if (!canCloseSainvoiceByHand.equals("true")) {
|
|
|
+ return getErrReturnObject().setErrMsg("中间表状态不为1,无法手工关闭")
|
|
|
+ .toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- //
|
|
|
- JSONObject object1 = new JSONObject();
|
|
|
- object1.put("classname", "getIcinvbal");
|
|
|
- object1.put("method", "canCloseSainvoiceByHand");
|
|
|
|
|
|
- JSONObject content1 = new JSONObject();
|
|
|
- content1.put("billno", rows.get(0).getString("billno"));
|
|
|
- object1.put("content", content1);
|
|
|
-
|
|
|
- String canCloseSainvoiceByHand = request.doPost(object1.toString(),
|
|
|
- "http://60.190.151.198:8089/BYESB/jaxrs/webclientrest");
|
|
|
-
|
|
|
- if (!canCloseSainvoiceByHand.equals("true")) {
|
|
|
- return getErrReturnObject().setErrMsg("中间表状态不为1,无法手工关闭")
|
|
|
- .toString();
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
//对接erp生成erp发货单
|
|
|
- if (Parameter.get("system.ccerp_dockswitch").equalsIgnoreCase("true")) {
|
|
|
+ if (Parameter.get("system.ccerp_dockswitch").equalsIgnoreCase("true") && !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);
|
|
@@ -619,19 +626,26 @@ public class dispatch extends Controller {
|
|
|
sqlList.add(sqlFactoryupdate.getSQL());
|
|
|
sqlList.add(DataContrlLog.createLog(this, "sa_dispatch", sa_dispatchid, "手工关闭", "发货单手工关闭成功").getSQL());
|
|
|
dbConnect.runSqlUpdate(sqlList);
|
|
|
- if(siteid.equalsIgnoreCase("lsa")){
|
|
|
- JSONObject objectfeek = new JSONObject();
|
|
|
- objectfeek.put("classname", "getIcinvbal");
|
|
|
- objectfeek.put("method", "updateSainvoiceStatus");
|
|
|
-
|
|
|
- JSONObject contentfeek = new JSONObject();
|
|
|
- contentfeek.put("billno", rows.get(0).getString("billno"));
|
|
|
- objectfeek.put("content", contentfeek);
|
|
|
- WebRequest request = new WebRequest();
|
|
|
- request.doPost(objectfeek.toString(),
|
|
|
- "http://60.190.151.198:8089/BYESB/jaxrs/webclientrest");
|
|
|
- }
|
|
|
|
|
|
+ if (siteid.equalsIgnoreCase("lsa")) {
|
|
|
+ Rows erp_urlrows = dbConnect.runSqlQuery("SELECT erp_url from sys_site_parameter WHERE siteid='" + siteid + "'");
|
|
|
+ if (erp_urlrows.isNotEmpty()) {
|
|
|
+ String url = rows.get(0).getString("erp_url");
|
|
|
+ if(!StringUtils.isBlank(url)){
|
|
|
+ JSONObject objectfeek = new JSONObject();
|
|
|
+ objectfeek.put("classname", "getIcinvbal");
|
|
|
+ objectfeek.put("method", "updateSainvoiceStatus");
|
|
|
+
|
|
|
+ JSONObject contentfeek = new JSONObject();
|
|
|
+ contentfeek.put("billno", rows.get(0).getString("billno"));
|
|
|
+ objectfeek.put("content", contentfeek);
|
|
|
+ WebRequest request = new WebRequest();
|
|
|
+ request.doPost(objectfeek.toString(),
|
|
|
+ url);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
sendRemind(rows.get(0).getLong("sys_enterpriseid"), sa_dispatchid);
|
|
|
return getSucReturnObject().toString();
|