|
@@ -1,10 +1,14 @@
|
|
|
package utility;
|
|
package utility;
|
|
|
|
|
|
|
|
|
|
+import beans.uploaderpdata.UploadDataToERP_HY;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import common.Controller;
|
|
|
import common.YosException;
|
|
import common.YosException;
|
|
|
import common.data.Row;
|
|
import common.data.Row;
|
|
|
import common.data.Rows;
|
|
import common.data.Rows;
|
|
|
|
|
+import common.data.SQLFactory;
|
|
|
|
|
+import org.dom4j.Document;
|
|
|
import utility.tools.WebRequest;
|
|
import utility.tools.WebRequest;
|
|
|
|
|
|
|
|
import java.io.BufferedReader;
|
|
import java.io.BufferedReader;
|
|
@@ -78,7 +82,11 @@ public class ERPDocking {
|
|
|
map.put("content-Type", "application/json");
|
|
map.put("content-Type", "application/json");
|
|
|
String result = new WebRequest().doPost(object.toString(), "http://124.71.196.182:8001/rest/ws_v2/basicDrp", map);
|
|
String result = new WebRequest().doPost(object.toString(), "http://124.71.196.182:8001/rest/ws_v2/basicDrp", map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
- return resultobject.getJSONObject("results").getJSONArray("list");
|
|
|
|
|
|
|
+ if(resultobject.getString("errcode").equals("0")){
|
|
|
|
|
+ return resultobject.getJSONObject("results").getJSONArray("list");
|
|
|
|
|
+ }else {
|
|
|
|
|
+ return new JSONArray();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -110,7 +118,12 @@ public class ERPDocking {
|
|
|
map.put("content-Type", "application/json");
|
|
map.put("content-Type", "application/json");
|
|
|
String result = new WebRequest().doPost(object.toString(), "http://124.71.196.182:8001/rest/ws_v2/basicDrp", map);
|
|
String result = new WebRequest().doPost(object.toString(), "http://124.71.196.182:8001/rest/ws_v2/basicDrp", map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
- return resultobject.getJSONObject("results").getJSONArray("list");
|
|
|
|
|
|
|
+ if(resultobject.getString("errcode").equals("0")){
|
|
|
|
|
+ return resultobject.getJSONObject("results").getJSONArray("list");
|
|
|
|
|
+ }else {
|
|
|
|
|
+ return new JSONArray();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -121,7 +134,7 @@ public class ERPDocking {
|
|
|
* @return
|
|
* @return
|
|
|
* @throws YosException
|
|
* @throws YosException
|
|
|
*/
|
|
*/
|
|
|
- public String createErpSainvoice(Row dispatchRow, Rows dispatchItems) throws YosException {
|
|
|
|
|
|
|
+ public String createErpSainvoice(Row dispatchRow, Rows dispatchItems,Controller controller,long sa_dispatchid) throws YosException {
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
JSONObject object= new JSONObject();
|
|
JSONObject object= new JSONObject();
|
|
@@ -160,6 +173,9 @@ public class ERPDocking {
|
|
|
map.put("content-Type", "application/json");
|
|
map.put("content-Type", "application/json");
|
|
|
String result = new WebRequest().doPost(object.toString(), "http://124.71.196.182:8001/rest/ws_v2/basicDrp", map);
|
|
String result = new WebRequest().doPost(object.toString(), "http://124.71.196.182:8001/rest/ws_v2/basicDrp", map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
|
|
+
|
|
|
|
|
+ saveLog(controller,"sa_dispatch",sa_dispatchid,"创建erp发货单",object.toString(),resultobject,dispatchRow.getString("billno"));
|
|
|
|
|
+
|
|
|
if(resultobject.getString("errcode").equals("0")){
|
|
if(resultobject.getString("errcode").equals("0")){
|
|
|
return "true";
|
|
return "true";
|
|
|
}else {
|
|
}else {
|
|
@@ -205,7 +221,7 @@ public class ERPDocking {
|
|
|
* @return
|
|
* @return
|
|
|
* @throws YosException
|
|
* @throws YosException
|
|
|
*/
|
|
*/
|
|
|
- public String closeErpSainvoice(String billno, boolean isManual) throws YosException {
|
|
|
|
|
|
|
+ public String closeErpSainvoice(String billno, boolean isManual,Controller controller,long sa_dispatchid) throws YosException {
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
JSONObject object= new JSONObject();
|
|
JSONObject object= new JSONObject();
|
|
@@ -221,6 +237,9 @@ public class ERPDocking {
|
|
|
map.put("content-Type", "application/json");
|
|
map.put("content-Type", "application/json");
|
|
|
String result = new WebRequest().doPost(object.toString(), "http://124.71.196.182:8001/rest/ws_v2/basicDrp", map);
|
|
String result = new WebRequest().doPost(object.toString(), "http://124.71.196.182:8001/rest/ws_v2/basicDrp", map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
|
|
+
|
|
|
|
|
+ saveLog(controller,"sa_dispatch",sa_dispatchid,"关闭发货单",object.toString(),resultobject,billno);
|
|
|
|
|
+
|
|
|
if(resultobject.getString("errcode").equals("0")){
|
|
if(resultobject.getString("errcode").equals("0")){
|
|
|
return "true";
|
|
return "true";
|
|
|
}else {
|
|
}else {
|
|
@@ -228,6 +247,7 @@ public class ERPDocking {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 创建Erp退/换货单
|
|
* 创建Erp退/换货单
|
|
|
* @param aftersalesmagRow
|
|
* @param aftersalesmagRow
|
|
@@ -235,7 +255,7 @@ public class ERPDocking {
|
|
|
* @return
|
|
* @return
|
|
|
* @throws YosException
|
|
* @throws YosException
|
|
|
*/
|
|
*/
|
|
|
- public String createErpSareturn(Row aftersalesmagRow, Rows aftersalesmagItems) throws YosException {
|
|
|
|
|
|
|
+ public String createErpSareturn(Row aftersalesmagRow, Rows aftersalesmagItems,Controller controller,long sa_aftersalesmagid) throws YosException {
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
JSONObject object= new JSONObject();
|
|
JSONObject object= new JSONObject();
|
|
@@ -275,6 +295,9 @@ public class ERPDocking {
|
|
|
System.out.println(object.toString());
|
|
System.out.println(object.toString());
|
|
|
String result = new WebRequest().doPost(object.toString(), "http://124.71.196.182:8001/rest/ws_v2/basicDrp", map);
|
|
String result = new WebRequest().doPost(object.toString(), "http://124.71.196.182:8001/rest/ws_v2/basicDrp", map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
|
|
+
|
|
|
|
|
+ saveLog(controller,"sa_aftersalesmag",sa_aftersalesmagid,"创建erp退/换货单",object.toString(),resultobject,aftersalesmagRow.getString("billno"));
|
|
|
|
|
+
|
|
|
if(resultobject.getString("errcode").equals("0")){
|
|
if(resultobject.getString("errcode").equals("0")){
|
|
|
return "true";
|
|
return "true";
|
|
|
}else {
|
|
}else {
|
|
@@ -319,7 +342,7 @@ public class ERPDocking {
|
|
|
* @return
|
|
* @return
|
|
|
* @throws YosException
|
|
* @throws YosException
|
|
|
*/
|
|
*/
|
|
|
- public String recheckErpSareturn(String billno, boolean isManual) throws YosException {
|
|
|
|
|
|
|
+ public String recheckErpSareturn(String billno, boolean isManual,Controller controller,long sa_aftersalesmagid) throws YosException {
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
JSONObject object= new JSONObject();
|
|
JSONObject object= new JSONObject();
|
|
@@ -335,6 +358,9 @@ public class ERPDocking {
|
|
|
map.put("content-Type", "application/json");
|
|
map.put("content-Type", "application/json");
|
|
|
String result = new WebRequest().doPost(object.toString(), "http://124.71.196.182:8001/rest/ws_v2/basicDrp", map);
|
|
String result = new WebRequest().doPost(object.toString(), "http://124.71.196.182:8001/rest/ws_v2/basicDrp", map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
|
|
+
|
|
|
|
|
+ saveLog(controller,"sa_aftersalesmag",sa_aftersalesmagid,"复核erp退/换货单",object.toString(),resultobject,billno);
|
|
|
|
|
+
|
|
|
if(resultobject.getString("errcode").equals("0")){
|
|
if(resultobject.getString("errcode").equals("0")){
|
|
|
return "true";
|
|
return "true";
|
|
|
}else {
|
|
}else {
|
|
@@ -342,6 +368,50 @@ public class ERPDocking {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 上传日志更新
|
|
|
|
|
+ * @param controller
|
|
|
|
|
+ * @param ownertable
|
|
|
|
|
+ * @param ownerid
|
|
|
|
|
+ * @param type
|
|
|
|
|
+ * @param request
|
|
|
|
|
+ * @param response
|
|
|
|
|
+ * @param billno
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public static boolean saveLog(Controller controller, String ownertable, long ownerid, String type, String request,
|
|
|
|
|
+ JSONObject response,String billno) {
|
|
|
|
|
+ boolean issuccess = false;
|
|
|
|
|
+ try {
|
|
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(new UploadDataToERP_HY(), "erp上传日志新增");
|
|
|
|
|
+ sqlFactory.addParameter("sys_erpupdatelogid", controller.createTableID("sys_erpupdatelog"));
|
|
|
|
|
+ sqlFactory.addParameter("siteid", controller.siteid);
|
|
|
|
|
+ sqlFactory.addParameter("userid", controller.userid);
|
|
|
|
|
+ sqlFactory.addParameter("username", controller.username);
|
|
|
|
|
+ sqlFactory.addParameter("ownerid", ownerid);
|
|
|
|
|
+ sqlFactory.addParameter("ownertable", ownertable);
|
|
|
|
|
+ sqlFactory.addParameter("type", type);
|
|
|
|
|
+ sqlFactory.addParameter("request", request);
|
|
|
|
|
+ sqlFactory.addParameter("response", response.toJSONString());
|
|
|
|
|
+
|
|
|
|
|
+ if ("0".equals(response.getString("errcode"))) {
|
|
|
|
|
+ sqlFactory.addParameter("erpbillno", billno);
|
|
|
|
|
+ sqlFactory.addParameter("errmsg", "");
|
|
|
|
|
+ issuccess = true;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sqlFactory.addParameter("erpbillno", "");
|
|
|
|
|
+ sqlFactory.addParameter("errmsg", response.getString("errmsg"));
|
|
|
|
|
+ issuccess = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ sqlFactory.addParameter("status", response.getString("errcode"));
|
|
|
|
|
+ controller.dbConnect.runSqlUpdate(sqlFactory);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+ return issuccess;
|
|
|
|
|
+ }
|
|
|
// /**
|
|
// /**
|
|
|
// * crm账号同步反馈
|
|
// * crm账号同步反馈
|
|
|
// *
|
|
// *
|