|
@@ -24,6 +24,10 @@ import java.util.HashMap;
|
|
|
|
|
|
public class ERPDocking {
|
|
|
public static boolean loginstatus = false;
|
|
|
+ //楚楚
|
|
|
+ String url = "http://124.71.196.182:8001/rest/ws_v2/basicDrp";
|
|
|
+ //德莱宝
|
|
|
+// String url = "http://192.168.3.89:8001/rest/ws_v2/basicDrp";
|
|
|
|
|
|
public ERPDocking() {
|
|
|
// try {
|
|
@@ -55,6 +59,7 @@ public class ERPDocking {
|
|
|
|
|
|
/**
|
|
|
* 获取erp物料档案
|
|
|
+ *
|
|
|
* @param begindate
|
|
|
* @param pagerows
|
|
|
* @param pagenum
|
|
@@ -63,8 +68,8 @@ public class ERPDocking {
|
|
|
*/
|
|
|
public JSONArray getErpItemRows(String begindate, int pagerows, int pagenum) throws YosException {
|
|
|
|
|
|
- JSONObject object= new JSONObject();
|
|
|
- JSONObject objectdetail= new JSONObject();
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ JSONObject objectdetail = new JSONObject();
|
|
|
objectdetail.put("fstatus", "审核");
|
|
|
objectdetail.put("fmodel", "");
|
|
|
objectdetail.put("fitemname", "");
|
|
@@ -73,37 +78,38 @@ public class ERPDocking {
|
|
|
objectdetail.put("pagerows", pagerows);
|
|
|
objectdetail.put("pagenum", pagenum);
|
|
|
objectdetail.put("changedateBeg", begindate);
|
|
|
- object.put("access_token","basicDrp");
|
|
|
- object.put("classname","Titem");
|
|
|
- object.put("method","queryPage");
|
|
|
- object.put("content",objectdetail);
|
|
|
+ object.put("access_token", "basicDrp");
|
|
|
+ object.put("classname", "Titem");
|
|
|
+ object.put("method", "queryPage");
|
|
|
+ object.put("content", objectdetail);
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
map.put("content-Type", "application/json");
|
|
|
- String result = new WebRequest().doPost(object.toString(), "http://192.168.3.89:8001/rest/ws_v2/basicDrp", map);
|
|
|
+ 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.getString("errcode").equals("0")){
|
|
|
+ if (resultobject.getString("errcode").equals("0")) {
|
|
|
return resultobject.getJSONObject("results").getJSONArray("list");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return new JSONArray();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- *查询Erp库存
|
|
|
+ * 查询Erp库存
|
|
|
+ *
|
|
|
* @param pagerows
|
|
|
* @param pagenum
|
|
|
* @param fitemnos
|
|
|
* @return
|
|
|
* @throws YosException
|
|
|
*/
|
|
|
- public JSONArray getErpIcinvbalRows( int pagerows, int pagenum,JSONArray fitemnos) throws YosException {
|
|
|
+ public JSONArray getErpIcinvbalRows(int pagerows, int pagenum, JSONArray fitemnos) throws YosException {
|
|
|
{
|
|
|
|
|
|
- JSONObject object= new JSONObject();
|
|
|
- JSONObject objectdetail= new JSONObject();
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ JSONObject objectdetail = new JSONObject();
|
|
|
objectdetail.put("fstockno", "01");
|
|
|
objectdetail.put("fmodel", "");
|
|
|
objectdetail.put("fitemname", "");
|
|
@@ -111,36 +117,38 @@ public class ERPDocking {
|
|
|
objectdetail.put("fitemnos", fitemnos);
|
|
|
objectdetail.put("pagerows", pagerows);
|
|
|
objectdetail.put("pagenum", pagenum);
|
|
|
- object.put("access_token","basicDrp");
|
|
|
- object.put("classname","Icinvbal");
|
|
|
- object.put("method","queryPage");
|
|
|
- object.put("content",objectdetail);
|
|
|
+ object.put("access_token", "basicDrp");
|
|
|
+ object.put("classname", "Icinvbal");
|
|
|
+ object.put("method", "queryPage");
|
|
|
+ object.put("content", objectdetail);
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
map.put("content-Type", "application/json");
|
|
|
- String result = new WebRequest().doPost(object.toString(), "http://192.168.3.89:8001/rest/ws_v2/basicDrp", map);
|
|
|
+ String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
- if(resultobject.getString("errcode").equals("0")){
|
|
|
+ if (resultobject.getString("errcode").equals("0")) {
|
|
|
return resultobject.getJSONObject("results").getJSONArray("list");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return new JSONArray();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- *查询Erp批次库存
|
|
|
+ * 查询Erp批次库存
|
|
|
+ *
|
|
|
* @param pagerows
|
|
|
* @param pagenum
|
|
|
* @param fitemnos
|
|
|
* @return
|
|
|
* @throws YosException
|
|
|
*/
|
|
|
- public JSONArray getErpIcinvbalBatchRows( int pagerows, int pagenum,JSONArray fitemnos) throws YosException {
|
|
|
+ public JSONArray getErpIcinvbalBatchRows(int pagerows, int pagenum, JSONArray fitemnos) throws YosException {
|
|
|
{
|
|
|
|
|
|
- JSONObject object= new JSONObject();
|
|
|
- JSONObject objectdetail= new JSONObject();
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ JSONObject objectdetail = new JSONObject();
|
|
|
objectdetail.put("fstockno", "01");
|
|
|
objectdetail.put("fstockname", "");
|
|
|
objectdetail.put("fmodel", "");
|
|
@@ -151,18 +159,18 @@ public class ERPDocking {
|
|
|
objectdetail.put("fitemnos", fitemnos);
|
|
|
objectdetail.put("pagerows", pagerows);
|
|
|
objectdetail.put("pagenum", pagenum);
|
|
|
- object.put("access_token","basicDrp");
|
|
|
- object.put("classname","Icinvbal");
|
|
|
- object.put("method","queryPageOfBatch");
|
|
|
- object.put("content",objectdetail);
|
|
|
+ object.put("access_token", "basicDrp");
|
|
|
+ object.put("classname", "Icinvbal");
|
|
|
+ object.put("method", "queryPageOfBatch");
|
|
|
+ object.put("content", objectdetail);
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
map.put("content-Type", "application/json");
|
|
|
- String result = new WebRequest().doPost(object.toString(), "http://192.168.3.89:8001/rest/ws_v2/basicDrp", map);
|
|
|
+ String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
- if(resultobject.getString("errcode").equals("0")){
|
|
|
+ if (resultobject.getString("errcode").equals("0")) {
|
|
|
return resultobject.getJSONObject("results").getJSONArray("list");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return new JSONArray();
|
|
|
}
|
|
|
|
|
@@ -171,33 +179,34 @@ public class ERPDocking {
|
|
|
|
|
|
/**
|
|
|
* 创建Erp发货单
|
|
|
+ *
|
|
|
* @param dispatchRow
|
|
|
* @param dispatchItems
|
|
|
* @return
|
|
|
* @throws YosException
|
|
|
*/
|
|
|
- public String createErpSainvoice(Row dispatchRow, Rows dispatchItems,Controller controller,long sa_dispatchid) throws YosException {
|
|
|
+ public String createErpSainvoice(Row dispatchRow, Rows dispatchItems, Controller controller, long sa_dispatchid) throws YosException {
|
|
|
{
|
|
|
|
|
|
- JSONObject object= new JSONObject();
|
|
|
- JSONObject objectdetail= new JSONObject();
|
|
|
- JSONArray jsonArray =new JSONArray();
|
|
|
- object.put("access_token","basicDrp");
|
|
|
- object.put("classname","Sainvoice");
|
|
|
- object.put("method","createSainvoice");
|
|
|
- objectdetail.put("finvonum",dispatchRow.getString("billno"));
|
|
|
- objectdetail.put("fagentnum",dispatchRow.getString("agentnum"));
|
|
|
- objectdetail.put("fagentname",dispatchRow.getString("enterprisename"));
|
|
|
- objectdetail.put("fsonum",dispatchRow.getString("sonum"));
|
|
|
- objectdetail.put("fdate",dispatchRow.getString("billdate"));
|
|
|
- objectdetail.put("fnotes",dispatchRow.getString("remarks"));
|
|
|
- objectdetail.put("fcontact",dispatchRow.getString("name"));
|
|
|
- objectdetail.put("fmobilephone",dispatchRow.getString("phonenumber"));
|
|
|
- objectdetail.put("faddress",dispatchRow.getString("address"));
|
|
|
- objectdetail.put("createby",dispatchRow.getString("createby"));
|
|
|
- if(dispatchItems.isNotEmpty()){
|
|
|
- for (Row row:dispatchItems) {
|
|
|
- JSONObject jsonObject=new JSONObject();
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ JSONObject objectdetail = new JSONObject();
|
|
|
+ JSONArray jsonArray = new JSONArray();
|
|
|
+ object.put("access_token", "basicDrp");
|
|
|
+ object.put("classname", "Sainvoice");
|
|
|
+ object.put("method", "createSainvoice");
|
|
|
+ objectdetail.put("finvonum", dispatchRow.getString("billno"));
|
|
|
+ objectdetail.put("fagentnum", dispatchRow.getString("agentnum"));
|
|
|
+ objectdetail.put("fagentname", dispatchRow.getString("enterprisename"));
|
|
|
+ objectdetail.put("fsonum", dispatchRow.getString("sonum"));
|
|
|
+ objectdetail.put("fdate", dispatchRow.getString("billdate"));
|
|
|
+ objectdetail.put("fnotes", dispatchRow.getString("remarks"));
|
|
|
+ objectdetail.put("fcontact", dispatchRow.getString("name"));
|
|
|
+ objectdetail.put("fmobilephone", dispatchRow.getString("phonenumber"));
|
|
|
+ objectdetail.put("faddress", dispatchRow.getString("address"));
|
|
|
+ objectdetail.put("createby", dispatchRow.getString("createby"));
|
|
|
+ if (dispatchItems.isNotEmpty()) {
|
|
|
+ for (Row row : dispatchItems) {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("fsonum", row.getString("sonum"));
|
|
|
jsonObject.put("fsorownum", row.getString("sorowno"));
|
|
|
jsonObject.put("fprodnum", row.getString("itemno"));
|
|
@@ -209,26 +218,28 @@ public class ERPDocking {
|
|
|
jsonArray.add(jsonObject);
|
|
|
}
|
|
|
}
|
|
|
- objectdetail.put("details",jsonArray);
|
|
|
- object.put("content",objectdetail);
|
|
|
+ objectdetail.put("details", jsonArray);
|
|
|
+ object.put("content", objectdetail);
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
map.put("content-Type", "application/json");
|
|
|
- String result = new WebRequest().doPost(object.toString(), "http://192.168.3.89:8001/rest/ws_v2/basicDrp", map);
|
|
|
+ String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
|
|
|
- saveLog(controller,"sa_dispatch",sa_dispatchid,"创建erp发货单",object.toString(),resultobject,dispatchRow.getString("billno"));
|
|
|
+ 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";
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return resultobject.getString("errmsg");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 查询Erp发货单(单个)
|
|
|
+ *
|
|
|
* @param billno
|
|
|
* @return
|
|
|
* @throws YosException
|
|
@@ -236,22 +247,22 @@ public class ERPDocking {
|
|
|
public JSONArray queryErpSainvoice(String billno) throws YosException {
|
|
|
{
|
|
|
|
|
|
- JSONObject object= new JSONObject();
|
|
|
- JSONObject objectdetail= new JSONObject();
|
|
|
- object.put("access_token","basicDrp");
|
|
|
- object.put("classname","Sainvoice");
|
|
|
- object.put("method","queryOne");
|
|
|
- objectdetail.put("finvonum",billno);
|
|
|
- object.put("content",objectdetail);
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ JSONObject objectdetail = new JSONObject();
|
|
|
+ object.put("access_token", "basicDrp");
|
|
|
+ object.put("classname", "Sainvoice");
|
|
|
+ object.put("method", "queryOne");
|
|
|
+ objectdetail.put("finvonum", billno);
|
|
|
+ object.put("content", objectdetail);
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
map.put("content-Type", "application/json");
|
|
|
- String result = new WebRequest().doPost(object.toString(), "http://192.168.3.89:8001/rest/ws_v2/basicDrp", map);
|
|
|
+ String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
System.out.println(resultobject);
|
|
|
- if(resultobject.getString("errcode").equals("error")){
|
|
|
+ if (resultobject.getString("errcode").equals("error")) {
|
|
|
return new JSONArray();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return resultobject.getJSONObject("results").getJSONArray("details");
|
|
|
}
|
|
|
}
|
|
@@ -259,6 +270,7 @@ public class ERPDocking {
|
|
|
|
|
|
/**
|
|
|
* 查询Erp发货单(批量)
|
|
|
+ *
|
|
|
* @param pagerows
|
|
|
* @param pagenum
|
|
|
* @param finvonums
|
|
@@ -269,67 +281,69 @@ 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();
|
|
|
- JSONObject objectdetail= new JSONObject();
|
|
|
- object.put("access_token","basicDrp");
|
|
|
- object.put("classname","Sainvoice");
|
|
|
- object.put("method","queryPage");
|
|
|
- objectdetail.put("pagenum",pagenum);
|
|
|
- objectdetail.put("pagerows",pagerows);
|
|
|
- objectdetail.put("finvonums",finvonums);
|
|
|
- objectdetail.put("fagentnum",fagentnum);
|
|
|
- objectdetail.put("fsonum",fsonum);
|
|
|
- objectdetail.put("fstatus",fstatus);
|
|
|
- objectdetail.put("onlyNeedClosed",onlyNeedClosed);
|
|
|
- objectdetail.put("onlyNeedPartialOuts",onlyNeedPartialOuts);
|
|
|
- objectdetail.put("onlyWithCheckedOuts",onlyWithCheckedOuts);
|
|
|
- object.put("content",objectdetail);
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ JSONObject objectdetail = new JSONObject();
|
|
|
+ object.put("access_token", "basicDrp");
|
|
|
+ object.put("classname", "Sainvoice");
|
|
|
+ object.put("method", "queryPage");
|
|
|
+ objectdetail.put("pagenum", pagenum);
|
|
|
+ objectdetail.put("pagerows", pagerows);
|
|
|
+ objectdetail.put("finvonums", finvonums);
|
|
|
+ objectdetail.put("fagentnum", fagentnum);
|
|
|
+ objectdetail.put("fsonum", fsonum);
|
|
|
+ objectdetail.put("fstatus", fstatus);
|
|
|
+ objectdetail.put("onlyNeedClosed", onlyNeedClosed);
|
|
|
+ objectdetail.put("onlyNeedPartialOuts", onlyNeedPartialOuts);
|
|
|
+ objectdetail.put("onlyWithCheckedOuts", onlyWithCheckedOuts);
|
|
|
+ object.put("content", objectdetail);
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
map.put("content-Type", "application/json");
|
|
|
System.out.println(object.toString());
|
|
|
- String result = new WebRequest().doPost(object.toString(), "http://192.168.3.89:8001/rest/ws_v2/basicDrp", map);
|
|
|
+ String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
System.out.println(resultobject);
|
|
|
- if(resultobject.getString("errcode").equals("error")){
|
|
|
+ if (resultobject.getString("errcode").equals("error")) {
|
|
|
return new JSONArray();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return resultobject.getJSONObject("results").getJSONArray("list");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 关闭Erp发货单
|
|
|
+ *
|
|
|
* @param billno
|
|
|
* @param isManual
|
|
|
* @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();
|
|
|
- JSONObject objectdetail= new JSONObject();
|
|
|
- object.put("access_token","basicDrp");
|
|
|
- object.put("classname","Sainvoice");
|
|
|
- object.put("method","closeSainvoice");
|
|
|
- objectdetail.put("finvonum",billno);
|
|
|
- objectdetail.put("isManual",isManual);
|
|
|
- object.put("content",objectdetail);
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ JSONObject objectdetail = new JSONObject();
|
|
|
+ object.put("access_token", "basicDrp");
|
|
|
+ object.put("classname", "Sainvoice");
|
|
|
+ object.put("method", "closeSainvoice");
|
|
|
+ objectdetail.put("finvonum", billno);
|
|
|
+ objectdetail.put("isManual", isManual);
|
|
|
+ object.put("content", objectdetail);
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
map.put("content-Type", "application/json");
|
|
|
- String result = new WebRequest().doPost(object.toString(), "http://192.168.3.89:8001/rest/ws_v2/basicDrp", map);
|
|
|
+ String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
|
|
|
- saveLog(controller,"sa_dispatch",sa_dispatchid,"关闭发货单",object.toString(),resultobject,billno);
|
|
|
+ saveLog(controller, "sa_dispatch", sa_dispatchid, "关闭发货单", object.toString(), resultobject, billno);
|
|
|
|
|
|
- if(resultobject.getString("errcode").equals("0")){
|
|
|
+ if (resultobject.getString("errcode").equals("0")) {
|
|
|
return "true";
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return resultobject.getString("errmsg");
|
|
|
}
|
|
|
}
|
|
@@ -337,6 +351,7 @@ public class ERPDocking {
|
|
|
|
|
|
/**
|
|
|
* Erp发货单行关闭
|
|
|
+ *
|
|
|
* @param billno
|
|
|
* @param controller
|
|
|
* @param rowno
|
|
@@ -345,29 +360,29 @@ 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();
|
|
|
- JSONObject objectdetail= new JSONObject();
|
|
|
- object.put("access_token","basicDrp");
|
|
|
- object.put("classname","Sainvoice");
|
|
|
- object.put("method","closeRowOfSainvoice");
|
|
|
- objectdetail.put("finvonum",billno);
|
|
|
- objectdetail.put("fprodnum",itemno);
|
|
|
- objectdetail.put("frownum",rowno);
|
|
|
- object.put("content",objectdetail);
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ JSONObject objectdetail = new JSONObject();
|
|
|
+ object.put("access_token", "basicDrp");
|
|
|
+ object.put("classname", "Sainvoice");
|
|
|
+ object.put("method", "closeRowOfSainvoice");
|
|
|
+ objectdetail.put("finvonum", billno);
|
|
|
+ objectdetail.put("fprodnum", itemno);
|
|
|
+ objectdetail.put("frownum", rowno);
|
|
|
+ object.put("content", objectdetail);
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
map.put("content-Type", "application/json");
|
|
|
- String result = new WebRequest().doPost(object.toString(), "http://192.168.3.89:8001/rest/ws_v2/basicDrp", map);
|
|
|
+ String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
|
|
|
- saveLog(controller,"sa_dispatch",sa_dispatchid,"发货单行关闭",object.toString(),resultobject,billno);
|
|
|
+ saveLog(controller, "sa_dispatch", sa_dispatchid, "发货单行关闭", object.toString(), resultobject, billno);
|
|
|
|
|
|
- if(resultobject.getString("errcode").equals("0")){
|
|
|
+ if (resultobject.getString("errcode").equals("0")) {
|
|
|
return "true";
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return resultobject.getString("errmsg");
|
|
|
}
|
|
|
}
|
|
@@ -375,36 +390,37 @@ public class ERPDocking {
|
|
|
|
|
|
/**
|
|
|
* 创建Erp退/换货单
|
|
|
+ *
|
|
|
* @param aftersalesmagRow
|
|
|
* @param aftersalesmagItems
|
|
|
* @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();
|
|
|
- JSONObject objectdetail= new JSONObject();
|
|
|
- JSONArray jsonArray =new JSONArray();
|
|
|
- object.put("access_token","basicDrp");
|
|
|
- object.put("classname","Sareturn");
|
|
|
- object.put("method","createSareturn");
|
|
|
- objectdetail.put("freturnnum",aftersalesmagRow.getString("billno"));
|
|
|
- objectdetail.put("fagentnum",aftersalesmagRow.getString("agentnum"));
|
|
|
- objectdetail.put("fagentname",aftersalesmagRow.getString("enterprisename"));
|
|
|
- objectdetail.put("faccclsnum","01");
|
|
|
- objectdetail.put("fdate",aftersalesmagRow.getString("billdate"));
|
|
|
- objectdetail.put("fnotes",aftersalesmagRow.getString("reason"));
|
|
|
- objectdetail.put("createby",aftersalesmagRow.getString("createby"));
|
|
|
- if(aftersalesmagRow.getString("type").equals("退货单")){
|
|
|
- objectdetail.put("freturntype","退货");
|
|
|
- }else if(aftersalesmagRow.getString("type").equals("换货单")){
|
|
|
- objectdetail.put("freturntype","换货");
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ JSONObject objectdetail = new JSONObject();
|
|
|
+ JSONArray jsonArray = new JSONArray();
|
|
|
+ object.put("access_token", "basicDrp");
|
|
|
+ object.put("classname", "Sareturn");
|
|
|
+ object.put("method", "createSareturn");
|
|
|
+ objectdetail.put("freturnnum", aftersalesmagRow.getString("billno"));
|
|
|
+ objectdetail.put("fagentnum", aftersalesmagRow.getString("agentnum"));
|
|
|
+ objectdetail.put("fagentname", aftersalesmagRow.getString("enterprisename"));
|
|
|
+ objectdetail.put("faccclsnum", "01");
|
|
|
+ objectdetail.put("fdate", aftersalesmagRow.getString("billdate"));
|
|
|
+ objectdetail.put("fnotes", aftersalesmagRow.getString("reason"));
|
|
|
+ objectdetail.put("createby", aftersalesmagRow.getString("createby"));
|
|
|
+ if (aftersalesmagRow.getString("type").equals("退货单")) {
|
|
|
+ objectdetail.put("freturntype", "退货");
|
|
|
+ } else if (aftersalesmagRow.getString("type").equals("换货单")) {
|
|
|
+ objectdetail.put("freturntype", "换货");
|
|
|
}
|
|
|
|
|
|
- if(aftersalesmagItems.isNotEmpty()){
|
|
|
- for (Row row:aftersalesmagItems) {
|
|
|
- JSONObject jsonObject=new JSONObject();
|
|
|
+ if (aftersalesmagItems.isNotEmpty()) {
|
|
|
+ for (Row row : aftersalesmagItems) {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("fprodnum", row.getString("itemno"));
|
|
|
jsonObject.put("fbatchbnum", row.getString("batchno"));
|
|
|
jsonObject.put("fqty", row.getString("qty"));
|
|
@@ -413,27 +429,29 @@ public class ERPDocking {
|
|
|
jsonArray.add(jsonObject);
|
|
|
}
|
|
|
}
|
|
|
- objectdetail.put("details",jsonArray);
|
|
|
- object.put("content",objectdetail);
|
|
|
+ objectdetail.put("details", jsonArray);
|
|
|
+ object.put("content", objectdetail);
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
map.put("content-Type", "application/json");
|
|
|
System.out.println(object.toString());
|
|
|
- String result = new WebRequest().doPost(object.toString(), "http://192.168.3.89:8001/rest/ws_v2/basicDrp", map);
|
|
|
+ String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
|
|
|
- saveLog(controller,"sa_aftersalesmag",sa_aftersalesmagid,"创建erp退/换货单",object.toString(),resultobject,aftersalesmagRow.getString("billno"));
|
|
|
+ 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";
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return resultobject.getString("errmsg");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 查询Erp退/换货单(单个)
|
|
|
+ *
|
|
|
* @param billno
|
|
|
* @return
|
|
|
* @throws YosException
|
|
@@ -441,28 +459,30 @@ public class ERPDocking {
|
|
|
public JSONArray queryErpSareturn(String billno) throws YosException {
|
|
|
{
|
|
|
|
|
|
- JSONObject object= new JSONObject();
|
|
|
- JSONObject objectdetail= new JSONObject();
|
|
|
- object.put("access_token","basicDrp");
|
|
|
- object.put("classname","Sareturn");
|
|
|
- object.put("method","queryOne");
|
|
|
- objectdetail.put("freturnnum",billno);
|
|
|
- object.put("content",objectdetail);
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ JSONObject objectdetail = new JSONObject();
|
|
|
+ object.put("access_token", "basicDrp");
|
|
|
+ object.put("classname", "Sareturn");
|
|
|
+ object.put("method", "queryOne");
|
|
|
+ objectdetail.put("freturnnum", billno);
|
|
|
+ object.put("content", objectdetail);
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
map.put("content-Type", "application/json");
|
|
|
- String result = new WebRequest().doPost(object.toString(), "http://192.168.3.89:8001/rest/ws_v2/basicDrp", map);
|
|
|
+ String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
System.out.println(resultobject);
|
|
|
- if(resultobject.getString("errcode").equals("error")){
|
|
|
+ if (resultobject.getString("errcode").equals("error")) {
|
|
|
return new JSONArray();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return resultobject.getJSONObject("results").getJSONArray("details");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 查询Erpt退/换货单(批量)
|
|
|
+ *
|
|
|
* @param pagerows
|
|
|
* @param pagenum
|
|
|
* @param freturnnums
|
|
@@ -473,66 +493,68 @@ 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();
|
|
|
- JSONObject objectdetail= new JSONObject();
|
|
|
- object.put("access_token","basicDrp");
|
|
|
- object.put("classname","Sareturn");
|
|
|
- object.put("method","queryPage");
|
|
|
- objectdetail.put("pagenum",pagenum);
|
|
|
- objectdetail.put("pagerows",pagerows);
|
|
|
- objectdetail.put("freturnnums",freturnnums);
|
|
|
- objectdetail.put("fagentnum",fagentnum);
|
|
|
- objectdetail.put("fsonum",fsonum);
|
|
|
- objectdetail.put("freturntype",freturntype);
|
|
|
- objectdetail.put("fstatus",fstatus);
|
|
|
- objectdetail.put("onlyNeedClosed",onlyNeedClosed);
|
|
|
- object.put("content",objectdetail);
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ JSONObject objectdetail = new JSONObject();
|
|
|
+ object.put("access_token", "basicDrp");
|
|
|
+ object.put("classname", "Sareturn");
|
|
|
+ object.put("method", "queryPage");
|
|
|
+ objectdetail.put("pagenum", pagenum);
|
|
|
+ objectdetail.put("pagerows", pagerows);
|
|
|
+ objectdetail.put("freturnnums", freturnnums);
|
|
|
+ objectdetail.put("fagentnum", fagentnum);
|
|
|
+ objectdetail.put("fsonum", fsonum);
|
|
|
+ objectdetail.put("freturntype", freturntype);
|
|
|
+ objectdetail.put("fstatus", fstatus);
|
|
|
+ objectdetail.put("onlyNeedClosed", onlyNeedClosed);
|
|
|
+ object.put("content", objectdetail);
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
map.put("content-Type", "application/json");
|
|
|
System.out.println(object.toString());
|
|
|
- String result = new WebRequest().doPost(object.toString(), "http://192.168.3.89:8001/rest/ws_v2/basicDrp", map);
|
|
|
+ String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
System.out.println(resultobject);
|
|
|
- if(resultobject.getString("errcode").equals("error")){
|
|
|
+ if (resultobject.getString("errcode").equals("error")) {
|
|
|
return new JSONArray();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return resultobject.getJSONObject("results").getJSONArray("list");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 复核Erp退/换货单
|
|
|
+ *
|
|
|
* @param billno
|
|
|
* @param isManual
|
|
|
* @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();
|
|
|
- JSONObject objectdetail= new JSONObject();
|
|
|
- object.put("access_token","basicDrp");
|
|
|
- object.put("classname","Sareturn");
|
|
|
- object.put("method","closeSareturn");
|
|
|
- objectdetail.put("freturnnum",billno);
|
|
|
- objectdetail.put("isManual",isManual);
|
|
|
- object.put("content",objectdetail);
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ JSONObject objectdetail = new JSONObject();
|
|
|
+ object.put("access_token", "basicDrp");
|
|
|
+ object.put("classname", "Sareturn");
|
|
|
+ object.put("method", "closeSareturn");
|
|
|
+ objectdetail.put("freturnnum", billno);
|
|
|
+ objectdetail.put("isManual", isManual);
|
|
|
+ object.put("content", objectdetail);
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
map.put("content-Type", "application/json");
|
|
|
- String result = new WebRequest().doPost(object.toString(), "http://192.168.3.89:8001/rest/ws_v2/basicDrp", map);
|
|
|
+ String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
|
|
|
- saveLog(controller,"sa_aftersalesmag",sa_aftersalesmagid,"复核erp退/换货单",object.toString(),resultobject,billno);
|
|
|
+ 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";
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return resultobject.getString("errmsg");
|
|
|
}
|
|
|
}
|
|
@@ -541,6 +563,7 @@ public class ERPDocking {
|
|
|
|
|
|
/**
|
|
|
* 上传日志更新
|
|
|
+ *
|
|
|
* @param controller
|
|
|
* @param ownertable
|
|
|
* @param ownerid
|
|
@@ -551,7 +574,7 @@ public class ERPDocking {
|
|
|
* @return
|
|
|
*/
|
|
|
public static boolean saveLog(Controller controller, String ownertable, long ownerid, String type, String request,
|
|
|
- JSONObject response,String billno) {
|
|
|
+ JSONObject response, String billno) {
|
|
|
boolean issuccess = false;
|
|
|
try {
|
|
|
Rows rows = controller.dbConnect.runSqlQuery(
|
|
@@ -592,44 +615,45 @@ public class ERPDocking {
|
|
|
|
|
|
/**
|
|
|
* 查询销售出库单
|
|
|
+ *
|
|
|
* @param pagerows
|
|
|
* @param pagenum
|
|
|
* @return
|
|
|
* @throws YosException
|
|
|
*/
|
|
|
- public JSONArray queryErpStockBill(int pagerows, int pagenum,String fbtname) throws YosException {
|
|
|
+ public JSONArray queryErpStockBill(int pagerows, int pagenum, String fbtname) throws YosException {
|
|
|
{
|
|
|
- JSONArray fupdateFlags=new JSONArray();
|
|
|
+ JSONArray fupdateFlags = new JSONArray();
|
|
|
fupdateFlags.add(0);
|
|
|
fupdateFlags.add(99);
|
|
|
fupdateFlags.add(2);
|
|
|
- JSONObject object= new JSONObject();
|
|
|
- JSONObject objectdetail= new JSONObject();
|
|
|
- object.put("access_token","basicDrp");
|
|
|
- object.put("classname","TstockbillOuts");
|
|
|
- object.put("method","queryPageForSyncYos");
|
|
|
- objectdetail.put("pagenum",pagenum);
|
|
|
- objectdetail.put("pagerows",pagerows);
|
|
|
- objectdetail.put("fbillnums",new JSONArray());
|
|
|
- objectdetail.put("fagentnum","");
|
|
|
- objectdetail.put("fstatus","审核");
|
|
|
- objectdetail.put("frb","");
|
|
|
- objectdetail.put("fstockno","");
|
|
|
- objectdetail.put("fbtname",fbtname);
|
|
|
- objectdetail.put("fminperiod","");
|
|
|
- objectdetail.put("fupdateFlags",fupdateFlags);
|
|
|
-
|
|
|
- object.put("content",objectdetail);
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ JSONObject objectdetail = new JSONObject();
|
|
|
+ object.put("access_token", "basicDrp");
|
|
|
+ object.put("classname", "TstockbillOuts");
|
|
|
+ object.put("method", "queryPageForSyncYos");
|
|
|
+ objectdetail.put("pagenum", pagenum);
|
|
|
+ objectdetail.put("pagerows", pagerows);
|
|
|
+ objectdetail.put("fbillnums", new JSONArray());
|
|
|
+ objectdetail.put("fagentnum", "");
|
|
|
+ objectdetail.put("fstatus", "审核");
|
|
|
+ objectdetail.put("frb", "");
|
|
|
+ objectdetail.put("fstockno", "");
|
|
|
+ objectdetail.put("fbtname", fbtname);
|
|
|
+ objectdetail.put("fminperiod", "");
|
|
|
+ objectdetail.put("fupdateFlags", fupdateFlags);
|
|
|
+
|
|
|
+ object.put("content", objectdetail);
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
map.put("content-Type", "application/json");
|
|
|
System.out.println(object.toString());
|
|
|
- String result = new WebRequest().doPost(object.toString(), "http://192.168.3.89:8001/rest/ws_v2/basicDrp", map);
|
|
|
+ String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
System.out.println(resultobject);
|
|
|
- if(resultobject.getString("errcode").equals("error")){
|
|
|
+ if (resultobject.getString("errcode").equals("error")) {
|
|
|
return new JSONArray();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return resultobject.getJSONObject("results").getJSONArray("list");
|
|
|
}
|
|
|
}
|
|
@@ -637,28 +661,29 @@ public class ERPDocking {
|
|
|
|
|
|
/**
|
|
|
* 更新erp出库单标志
|
|
|
+ *
|
|
|
* @return
|
|
|
* @throws YosException
|
|
|
*/
|
|
|
public String updateErpupdateFlag(JSONArray flags) throws YosException {
|
|
|
{
|
|
|
|
|
|
- JSONObject object= new JSONObject();
|
|
|
- JSONObject objectdetail= new JSONObject();
|
|
|
- object.put("access_token","basicDrp");
|
|
|
- object.put("classname","TstockbillOuts");
|
|
|
- object.put("method","syncFupdateFlags");
|
|
|
- objectdetail.put("flags",flags);
|
|
|
- object.put("content",objectdetail);
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ JSONObject objectdetail = new JSONObject();
|
|
|
+ object.put("access_token", "basicDrp");
|
|
|
+ object.put("classname", "TstockbillOuts");
|
|
|
+ object.put("method", "syncFupdateFlags");
|
|
|
+ objectdetail.put("flags", flags);
|
|
|
+ object.put("content", objectdetail);
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
map.put("content-Type", "application/json");
|
|
|
- String result = new WebRequest().doPost(object.toString(), "http://192.168.3.89:8001/rest/ws_v2/basicDrp", map);
|
|
|
+ String result = new WebRequest().doPost(object.toString(), url, map);
|
|
|
JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
|
|
|
- if(resultobject.getString("errcode").equals("0")){
|
|
|
+ if (resultobject.getString("errcode").equals("0")) {
|
|
|
return "true";
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return resultobject.getString("errmsg");
|
|
|
}
|
|
|
}
|