出库关闭,销售退货申请换成采购退货申请

This commit is contained in:
sez 2025-12-11 16:10:16 +08:00
parent 3949e53953
commit 91d2d4d4e3
1 changed files with 21 additions and 18 deletions

View File

@ -29,6 +29,9 @@ public class WMSSaleOutCloseController {
private static String SM_DELIVERNOTICE = "sm_delivernotice";//发货通知单
private static String SM_RETURNAPPLY = "sm_returnapply";//销售退货申请单
private static String TQQ9_OTHEROUTAPPLY = "tqq9_otheroutapply";//其他出库申请
private static String PM_PURREFUNDAPPLYBILL = "pm_purrefundapplybill";//采购退货申请
private final static HashMap<String, String> billTypeMap = new HashMap<String, String>() {{
put("采购订单", "pm_receiptnotice");
put("其他入库单", "tqq9_otherinapply");
@ -100,7 +103,7 @@ public class WMSSaleOutCloseController {
ArrayList<String> VoucherTypes = new ArrayList<>();
VoucherTypes.add(SM_DELIVERNOTICE);
VoucherTypes.add(SM_RETURNAPPLY);
VoucherTypes.add(PM_PURREFUNDAPPLYBILL);
VoucherTypes.add(TQQ9_OTHEROUTAPPLY);
if (!VoucherTypes.contains(VoucherType)) {
errormsg = "传入参数 VoucherType 为无效值";
@ -155,18 +158,18 @@ public class WMSSaleOutCloseController {
}
}*/
//销售退货单
} else if (StringUtils.equals("sm_returnapply", VoucherType)) {
//采购退货申请
} else if (StringUtils.equals("pm_purrefundapplybill", VoucherType)) {
//查询单据在金蝶系统中是否存在
DynamicObject sm_returnapply = BusinessDataServiceHelper.loadSingle(SM_RETURNAPPLY, new QFilter[]{new QFilter("billno", QCP.equals, billno)});
if (sm_returnapply == null) {
errormsg = "根据传入编号:" + billno + "未找到对应销售退货单";
DynamicObject pm_purrefundapplybill = BusinessDataServiceHelper.loadSingle(PM_PURREFUNDAPPLYBILL, new QFilter[]{new QFilter("billno", QCP.equals, billno)});
if (pm_purrefundapplybill == null) {
errormsg = "根据传入编号:" + billno + "未找到对应采购退货申请";
resultExt = ApiResultExt.errorRetrun(VoucherType, errormsg, error, resultExt);
return CustomApiResult.success(resultExt);
}
resultBean.setId(sm_returnapply.getString("id"));
resultBean.setId(pm_purrefundapplybill.getString("id"));
resultBean.setBillStatus(true);
if (!StringUtils.equals("C", sm_returnapply.getString("billstatus"))) {
if (!StringUtils.equals("C", pm_purrefundapplybill.getString("billstatus"))) {
errormsg = "编号:" + billno + "的单据状态非审核,无法关闭";
resultExt = ApiResultExt.errorRetrun(VoucherType, errormsg, error, resultExt);
return CustomApiResult.success(resultExt);
@ -178,9 +181,9 @@ public class WMSSaleOutCloseController {
}*/
//开始关闭
String message = cloneOperation(sm_returnapply, "销售退货单", "sm_salorder");
String message = cloneOperation(pm_purrefundapplybill, "采购退货申请", "pm_purorderbill");
if (message.length() > 0) {
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, message, SM_RETURNAPPLY);
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, message, PM_PURREFUNDAPPLYBILL);
results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
failCount = 1;
successCount = 0;
@ -266,7 +269,7 @@ public class WMSSaleOutCloseController {
StringBuilder errormsg = new StringBuilder();
ArrayList<String> entryOrderTypes = new ArrayList<>();
entryOrderTypes.add(SM_DELIVERNOTICE);
entryOrderTypes.add(SM_RETURNAPPLY);
entryOrderTypes.add(PM_PURREFUNDAPPLYBILL);
entryOrderTypes.add(TQQ9_OTHEROUTAPPLY);
if (!entryOrderTypes.contains(orderType)) {
errormsg = errormsg.append("").append("传入参数 orderType 为无效值");
@ -336,18 +339,18 @@ public class WMSSaleOutCloseController {
response.setFlag("failure");
return CustomApiResult.success(wmsXmlReturn);
}*/
//销售退货单
} else if (StringUtils.equals("sm_returnapply", orderType)) {
//采购退货申请
} else if (StringUtils.equals("pm_purrefundapplybill", orderType)) {
//查询单据在金蝶系统中是否存在
DynamicObject sm_returnapply = BusinessDataServiceHelper.loadSingle(SM_RETURNAPPLY, new QFilter[]{new QFilter("billno", QCP.equals, billno)});
if (sm_returnapply == null) {
errormsg = errormsg.append("").append("根据传入编号:" + billno + "未找到对应销售退货单");
DynamicObject pm_purrefundapplybill = BusinessDataServiceHelper.loadSingle(PM_PURREFUNDAPPLYBILL, new QFilter[]{new QFilter("billno", QCP.equals, billno)});
if (pm_purrefundapplybill == null) {
errormsg = errormsg.append("").append("根据传入编号:" + billno + "未找到对应采购退货申请");
response.setMessage(errormsg.substring(1));
response.setCode("-1");
response.setFlag("failure");
return CustomApiResult.success(wmsXmlReturn);
}
if (!StringUtils.equals("C", sm_returnapply.getString("billstatus"))) {
if (!StringUtils.equals("C", pm_purrefundapplybill.getString("billstatus"))) {
errormsg = errormsg.append("").append("编号:" + billno + "的单据状态非审核,无法关闭");
response.setMessage(errormsg.substring(1));
response.setCode("-1");
@ -362,7 +365,7 @@ public class WMSSaleOutCloseController {
return CustomApiResult.success(wmsXmlReturn);
}*/
//开始关闭
String message = cloneOperation(sm_returnapply, "销售退货单", "sm_salorder");
String message = cloneOperation(pm_purrefundapplybill, "采购退货申请", "pm_purorderbill");
if (message.length() > 0) {
errormsg.append(message);
response.setMessage(errormsg.substring(1));