|  | @@ -514,6 +514,8 @@ public class dispatch extends Controller {
 | 
	
		
			
				|  |  |          Long sa_orderid = 0L;
 | 
	
		
			
				|  |  |          Rows rows = dbConnect.runSqlQuery("select sa_dispatchid,status,billno,sa_orderid,sys_enterpriseid from sa_dispatch where sa_dispatchid ='"
 | 
	
		
			
				|  |  |                  + sa_dispatchid + "' and  siteid='" + siteid + "'");
 | 
	
		
			
				|  |  | +        Rows rowsdetail = dbConnect.runSqlQuery("select cast(sa_dispatch_itemsid AS CHAR) as sa_dispatch_itemsid from sa_dispatch_items where sa_dispatchid ='"
 | 
	
		
			
				|  |  | +                + sa_dispatchid + "' and  siteid='" + siteid + "'");
 | 
	
		
			
				|  |  |          if (rows.isEmpty()) {
 | 
	
		
			
				|  |  |              return getErrReturnObject().setErrMsg("该发货单不存在")
 | 
	
		
			
				|  |  |                      .toString();
 | 
	
	
		
			
				|  | @@ -524,6 +526,49 @@ public class dispatch extends Controller {
 | 
	
		
			
				|  |  |                          .toString();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if(siteid.equalsIgnoreCase("lsa")){
 | 
	
		
			
				|  |  | +            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(),
 | 
	
		
			
				|  |  | +                    "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();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            //
 | 
	
		
			
				|  |  | +            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")) {
 | 
	
		
			
				|  |  |              ERPDocking erpDocking = new ERPDocking(siteid);
 | 
	
	
		
			
				|  | @@ -574,6 +619,19 @@ 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");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          sendRemind(rows.get(0).getLong("sys_enterpriseid"), sa_dispatchid);
 | 
	
		
			
				|  |  |          return getSucReturnObject().toString();
 |