|
|
@@ -22,26 +22,29 @@ public class icstockbill_crm extends CrmBase {
|
|
|
String url = "/ext/whicstockbill/queryIcstockbills?fbrandId=" + fbrandId + "&needDetail=true&needWrc=true&fisuploadflag=-1&fdomain=入库&ftype=报货入库单";
|
|
|
String result = getCRM(url);
|
|
|
if (!result.isBlank()) {
|
|
|
- JSONArray jsonArray = JSONObject.parseObject(result).getJSONArray("data");
|
|
|
- for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
- JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
- String fstatus = jsonObject.getString("fstatus");
|
|
|
- String fagentNum = jsonObject.getString("fagentNum");
|
|
|
- String fbillNum_crm = jsonObject.getString("fbillNum");
|
|
|
- String billno = jsonObject.getString("fextNo1");
|
|
|
+ JSONObject resultObject = JSONObject.parseObject(result);
|
|
|
+ if (resultObject.containsKey("data")) {
|
|
|
+ JSONArray jsonArray = resultObject.getJSONArray("data");
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
+ String fstatus = jsonObject.getString("fstatus");
|
|
|
+ String fagentNum = jsonObject.getString("fagentNum");
|
|
|
+ String fbillNum_crm = jsonObject.getString("fbillNum");
|
|
|
+ String billno = jsonObject.getString("fextNo1");
|
|
|
|
|
|
- if (billno != null && !billno.isEmpty()) {
|
|
|
- Rows billRows = dbConnect.runSqlQuery("select * from st_stockbill where billno='" + billno + "' and crmbillno='" + fbillNum_crm + "' and isreceiver=1");
|
|
|
- if ("审核".equals(fstatus) && billRows.isNotEmpty()) {
|
|
|
- logger.info("销售出库单" + billno + "已收货确认,更新crm单据同步状态为1");
|
|
|
- getCRM("/ext/whicstockbill/editUploadflag?fbrandId=" + fbrandId + "&fbillnum=" + fbillNum_crm + "&fisuploadflag=1&fisuploadnote=DRP反馈已到货确认,更新状态变为1");
|
|
|
- } else if ("新建".equals(fstatus)) {
|
|
|
- if (billRows.isNotEmpty()) {
|
|
|
- logger.info("销售出库单" + billno + "已收货确认,审核crm报货入库单" + fbillNum_crm);
|
|
|
- getCRM("/ext/whicstockbill/checkInbBillAfterConfirm?fbrandId=" + fbrandId + "&fbillnum=" + fbillNum_crm);
|
|
|
- } else {
|
|
|
- logger.error("销售出库单" + billno + "未收货确认,删除crm报货入库单" + fbillNum_crm);
|
|
|
- getCRM("/ext/whicstockbill/removeInbBillAfterConfirm?fbrandId=" + fbrandId + "&fbillnum=" + fbillNum_crm);
|
|
|
+ if (billno != null && !billno.isEmpty()) {
|
|
|
+ Rows billRows = dbConnect.runSqlQuery("select * from st_stockbill where billno='" + billno + "' and crmbillno='" + fbillNum_crm + "' and isreceiver=1");
|
|
|
+ if ("审核".equals(fstatus) && billRows.isNotEmpty()) {
|
|
|
+ logger.info("销售出库单" + billno + "已收货确认,更新crm单据同步状态为1");
|
|
|
+ getCRM("/ext/whicstockbill/editUploadflag?fbrandId=" + fbrandId + "&fbillnum=" + fbillNum_crm + "&fisuploadflag=1&fisuploadnote=DRP反馈已到货确认,更新状态变为1");
|
|
|
+ } else if ("新建".equals(fstatus)) {
|
|
|
+ if (billRows.isNotEmpty()) {
|
|
|
+ logger.info("销售出库单" + billno + "已收货确认,审核crm报货入库单" + fbillNum_crm);
|
|
|
+ getCRM("/ext/whicstockbill/checkInbBillAfterConfirm?fbrandId=" + fbrandId + "&fbillnum=" + fbillNum_crm);
|
|
|
+ } else {
|
|
|
+ logger.error("销售出库单" + billno + "未收货确认,删除crm报货入库单" + fbillNum_crm);
|
|
|
+ getCRM("/ext/whicstockbill/removeInbBillAfterConfirm?fbrandId=" + fbrandId + "&fbillnum=" + fbillNum_crm);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|