|
|
@@ -89,10 +89,14 @@ public class ERPDocking {
|
|
|
map.put("content-Type", "application/json");
|
|
|
String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
- System.out.println(object.toString());
|
|
|
- System.out.println(resultobject.toJSONString());
|
|
|
- if (resultobject == null || resultobject.getString("errcode").equals("0")) {
|
|
|
- return resultobject.getJSONObject("results").getJSONArray("list");
|
|
|
+// System.out.println(object.toString());
|
|
|
+// System.out.println(resultobject.toJSONString());
|
|
|
+ if (resultobject != null) {
|
|
|
+ if (resultobject.getString("errcode").equals("0")) {
|
|
|
+ return resultobject.getJSONObject("results").getJSONArray("list");
|
|
|
+ } else {
|
|
|
+ return new JSONArray();
|
|
|
+ }
|
|
|
} else {
|
|
|
return new JSONArray();
|
|
|
}
|
|
|
@@ -128,8 +132,12 @@ public class ERPDocking {
|
|
|
map.put("content-Type", "application/json");
|
|
|
String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
- if (resultobject == null ||resultobject.getString("errcode").equals("0")) {
|
|
|
- return resultobject.getJSONObject("results").getJSONArray("list");
|
|
|
+ if (resultobject != null) {
|
|
|
+ if (resultobject.getString("errcode").equals("0")) {
|
|
|
+ return resultobject.getJSONObject("results").getJSONArray("list");
|
|
|
+ } else {
|
|
|
+ return new JSONArray();
|
|
|
+ }
|
|
|
} else {
|
|
|
return new JSONArray();
|
|
|
}
|
|
|
@@ -170,8 +178,12 @@ public class ERPDocking {
|
|
|
map.put("content-Type", "application/json");
|
|
|
String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
- if (resultobject == null ||resultobject.getString("errcode").equals("0")) {
|
|
|
- return resultobject.getJSONObject("results").getJSONArray("list");
|
|
|
+ if (resultobject != null) {
|
|
|
+ if (resultobject.getString("errcode").equals("0")) {
|
|
|
+ return resultobject.getJSONObject("results").getJSONArray("list");
|
|
|
+ } else {
|
|
|
+ return new JSONArray();
|
|
|
+ }
|
|
|
} else {
|
|
|
return new JSONArray();
|
|
|
}
|
|
|
@@ -230,10 +242,14 @@ public class ERPDocking {
|
|
|
|
|
|
saveLog(controller, "sa_dispatch", sa_dispatchid, "创建erp发货单", object.toString(), resultobject, dispatchRow.getString("billno"));
|
|
|
|
|
|
- if (resultobject == null ||resultobject.getString("errcode").equals("0")) {
|
|
|
- return "true";
|
|
|
+ if (resultobject != null) {
|
|
|
+ if (resultobject.getString("errcode").equals("0")) {
|
|
|
+ return "true";
|
|
|
+ } else {
|
|
|
+ return resultobject.getString("errmsg");
|
|
|
+ }
|
|
|
} else {
|
|
|
- return resultobject.getString("errmsg");
|
|
|
+ return "false";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -262,7 +278,7 @@ public class ERPDocking {
|
|
|
String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
System.out.println(resultobject);
|
|
|
- if (resultobject == null ||resultobject.getString("errcode").equals("error")) {
|
|
|
+ if (resultobject == null || resultobject.getString("errcode").equals("error")) {
|
|
|
return new JSONArray();
|
|
|
} else {
|
|
|
return resultobject.getJSONObject("results").getJSONArray("details");
|
|
|
@@ -283,7 +299,9 @@ public class ERPDocking {
|
|
|
* @return
|
|
|
* @throws YosException
|
|
|
*/
|
|
|
- public JSONArray queryErpSainvoices(int pagerows, int pagenum, JSONArray finvonums, String fagentnum, String fsonum, String fstatus, boolean onlyNeedClosed, boolean onlyNeedPartialOuts, boolean onlyWithCheckedOuts) throws YosException {
|
|
|
+ public JSONArray queryErpSainvoices(int pagerows, int pagenum, JSONArray finvonums, String fagentnum, String
|
|
|
+ fsonum, String fstatus, boolean onlyNeedClosed, boolean onlyNeedPartialOuts, boolean onlyWithCheckedOuts) throws
|
|
|
+ YosException {
|
|
|
{
|
|
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
@@ -308,7 +326,7 @@ public class ERPDocking {
|
|
|
String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
System.out.println(resultobject);
|
|
|
- if (resultobject == null ||resultobject.getString("errcode").equals("error")) {
|
|
|
+ if (resultobject == null || resultobject.getString("errcode").equals("error")) {
|
|
|
return new JSONArray();
|
|
|
} else {
|
|
|
return resultobject.getJSONObject("results").getJSONArray("list");
|
|
|
@@ -324,7 +342,8 @@ public class ERPDocking {
|
|
|
* @return
|
|
|
* @throws YosException
|
|
|
*/
|
|
|
- public String closeErpSainvoice(String billno, boolean isManual, Controller controller, long sa_dispatchid) throws YosException {
|
|
|
+ public String closeErpSainvoice(String billno, boolean isManual, Controller controller, long sa_dispatchid) throws
|
|
|
+ YosException {
|
|
|
{
|
|
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
@@ -343,10 +362,14 @@ public class ERPDocking {
|
|
|
|
|
|
saveLog(controller, "sa_dispatch", sa_dispatchid, "关闭发货单", object.toString(), resultobject, billno);
|
|
|
|
|
|
- if (resultobject == null ||resultobject.getString("errcode").equals("0")) {
|
|
|
- return "true";
|
|
|
+ if (resultobject != null) {
|
|
|
+ if (resultobject.getString("errcode").equals("0")) {
|
|
|
+ return "true";
|
|
|
+ } else {
|
|
|
+ return resultobject.getString("errmsg");
|
|
|
+ }
|
|
|
} else {
|
|
|
- return resultobject.getString("errmsg");
|
|
|
+ return "false";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -362,7 +385,8 @@ public class ERPDocking {
|
|
|
* @return
|
|
|
* @throws YosException
|
|
|
*/
|
|
|
- public String closeErpSainvoiceRow(String billno, Controller controller, long rowno, String itemno, long sa_dispatchid) throws YosException {
|
|
|
+ public String closeErpSainvoiceRow(String billno, Controller controller, long rowno, String itemno,
|
|
|
+ long sa_dispatchid) throws YosException {
|
|
|
{
|
|
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
@@ -381,11 +405,14 @@ public class ERPDocking {
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
|
|
|
saveLog(controller, "sa_dispatch", sa_dispatchid, "发货单行关闭", object.toString(), resultobject, billno);
|
|
|
-
|
|
|
- if (resultobject == null ||resultobject.getString("errcode").equals("0")) {
|
|
|
- return "true";
|
|
|
+ if (resultobject != null) {
|
|
|
+ if (resultobject.getString("errcode").equals("0")) {
|
|
|
+ return "true";
|
|
|
+ } else {
|
|
|
+ return resultobject.getString("errmsg");
|
|
|
+ }
|
|
|
} else {
|
|
|
- return resultobject.getString("errmsg");
|
|
|
+ return resultobject.getString("false");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -398,7 +425,8 @@ public class ERPDocking {
|
|
|
* @return
|
|
|
* @throws YosException
|
|
|
*/
|
|
|
- public String createErpSareturn(Row aftersalesmagRow, Rows aftersalesmagItems, Controller controller, long sa_aftersalesmagid) throws YosException {
|
|
|
+ public String createErpSareturn(Row aftersalesmagRow, Rows aftersalesmagItems, Controller controller,
|
|
|
+ long sa_aftersalesmagid) throws YosException {
|
|
|
{
|
|
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
@@ -441,11 +469,14 @@ public class ERPDocking {
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
|
|
|
saveLog(controller, "sa_aftersalesmag", sa_aftersalesmagid, "创建erp退/换货单", object.toString(), resultobject, aftersalesmagRow.getString("billno"));
|
|
|
-
|
|
|
- if (resultobject == null ||resultobject.getString("errcode").equals("0")) {
|
|
|
- return "true";
|
|
|
+ if (resultobject != null) {
|
|
|
+ if (resultobject.getString("errcode").equals("0")) {
|
|
|
+ return "true";
|
|
|
+ } else {
|
|
|
+ return resultobject.getString("errmsg");
|
|
|
+ }
|
|
|
} else {
|
|
|
- return resultobject.getString("errmsg");
|
|
|
+ return "false";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -474,7 +505,7 @@ public class ERPDocking {
|
|
|
String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
System.out.println(resultobject);
|
|
|
- if (resultobject == null ||resultobject.getString("errcode").equals("error")) {
|
|
|
+ if (resultobject == null || resultobject.getString("errcode").equals("error")) {
|
|
|
return new JSONArray();
|
|
|
} else {
|
|
|
return resultobject.getJSONObject("results").getJSONArray("details");
|
|
|
@@ -495,7 +526,8 @@ public class ERPDocking {
|
|
|
* @return
|
|
|
* @throws YosException
|
|
|
*/
|
|
|
- public JSONArray queryErpSareturns(int pagerows, int pagenum, JSONArray freturnnums, String fagentnum, String fsonum, String freturntype, String fstatus, boolean onlyNeedClosed) throws YosException {
|
|
|
+ public JSONArray queryErpSareturns(int pagerows, int pagenum, JSONArray freturnnums, String fagentnum, String
|
|
|
+ fsonum, String freturntype, String fstatus, boolean onlyNeedClosed) throws YosException {
|
|
|
{
|
|
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
@@ -519,7 +551,7 @@ public class ERPDocking {
|
|
|
String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
System.out.println(resultobject);
|
|
|
- if (resultobject == null ||resultobject.getString("errcode").equals("error")) {
|
|
|
+ if (resultobject == null || resultobject.getString("errcode").equals("error")) {
|
|
|
return new JSONArray();
|
|
|
} else {
|
|
|
return resultobject.getJSONObject("results").getJSONArray("list");
|
|
|
@@ -535,7 +567,8 @@ public class ERPDocking {
|
|
|
* @return
|
|
|
* @throws YosException
|
|
|
*/
|
|
|
- public String recheckErpSareturn(String billno, boolean isManual, Controller controller, long sa_aftersalesmagid) throws YosException {
|
|
|
+ public String recheckErpSareturn(String billno, boolean isManual, Controller controller, long sa_aftersalesmagid) throws
|
|
|
+ YosException {
|
|
|
{
|
|
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
@@ -554,10 +587,14 @@ public class ERPDocking {
|
|
|
|
|
|
saveLog(controller, "sa_aftersalesmag", sa_aftersalesmagid, "复核erp退/换货单", object.toString(), resultobject, billno);
|
|
|
|
|
|
- if (resultobject == null ||resultobject.getString("errcode").equals("0")) {
|
|
|
- return "true";
|
|
|
- } else {
|
|
|
- return resultobject.getString("errmsg");
|
|
|
+ if (resultobject != null) {
|
|
|
+ if (resultobject.getString("errcode").equals("0")) {
|
|
|
+ return "true";
|
|
|
+ } else {
|
|
|
+ return resultobject.getString("errmsg");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ return "false";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -575,7 +612,8 @@ public class ERPDocking {
|
|
|
* @param billno
|
|
|
* @return
|
|
|
*/
|
|
|
- public static boolean saveLog(Controller controller, String ownertable, long ownerid, String type, String request,
|
|
|
+ public static boolean saveLog(Controller controller, String ownertable, long ownerid, String type, String
|
|
|
+ request,
|
|
|
JSONObject response, String billno) {
|
|
|
boolean issuccess = false;
|
|
|
try {
|
|
|
@@ -683,7 +721,7 @@ public class ERPDocking {
|
|
|
String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
|
|
|
- if (resultobject == null ||resultobject.getString("errcode").equals("0")) {
|
|
|
+ if (resultobject == null || resultobject.getString("errcode").equals("0")) {
|
|
|
return "true";
|
|
|
} else {
|
|
|
return resultobject.getString("errmsg");
|