1.采购建议报表调整

2.WMS采购退货销售退货调整
3.形态转换子明细无聊带出商品
This commit is contained in:
龚豆豆 2025-12-03 11:41:12 +08:00
parent 5376193416
commit cba0e4a4ee
8 changed files with 113 additions and 101 deletions

View File

@ -37,8 +37,10 @@ public class WMSPurInController {
private static String RECEIPTNOTICE = "pm_receiptnotice";//收货通知单
private static String PURINBILL = "im_purinbill";//采购入库单
private static String IM_SALOUTBILL = "im_saloutbill";//销售出库单
private static String BILLENTRY = "billentry";//收货通知单分录,采购退货申请单分录
private static String PM_PURREFUNDAPPLYBILL = "pm_purrefundapplybill";//采购退货申请单
private static String SM_RETURNAPPLY = "sm_returnapply";//销售退货申请单
private static String TQQ9_OTHERINAPPLY = "tqq9_otherinapply";//其他入库申请
private static String IM_OTHERINBILL = "im_otherinbill";//其他入库
private final static HashMap<String, String> billTypeMap = new HashMap<String, String>() {{
@ -108,8 +110,8 @@ public class WMSPurInController {
case "pm_receiptnotice":
entityType = "im_purinbill";
break;
case "pm_purrefundapplybill":
entityType = "im_purinbill";
case "sm_returnapply":
entityType = "im_saloutbill";
break;
case "tqq9_otherinapply":
entityType = "im_otherinbill";
@ -271,17 +273,17 @@ public class WMSPurInController {
}
//采购退货单
} else if (StringUtils.equals("pm_purrefundapplybill", VoucherType)) {
//销售退货单
} else if (StringUtils.equals("sm_returnapply", VoucherType)) {
//查询单据在金蝶系统中是否存在
DynamicObject pm_purrefundapplybill = BusinessDataServiceHelper.loadSingle(PM_PURREFUNDAPPLYBILL, new QFilter[]{new QFilter("billno", QCP.equals, billno)});
if (pm_purrefundapplybill == null) {
errormsg = "根据传入编号:" + billno + "未找到对应采购退货单";
DynamicObject sm_returnapply = BusinessDataServiceHelper.loadSingle(SM_RETURNAPPLY, new QFilter[]{new QFilter("billno", QCP.equals, billno)});
if (sm_returnapply == null) {
errormsg = "根据传入编号:" + billno + "未找到对应销售退货单";
resultExt = ApiResultExt.errorRetrun(entityType, errormsg, error, resultExt);
return CustomApiResult.success(resultExt);
}
//参数值组装
Long id = pm_purrefundapplybill.getLong("id");
Long id = sm_returnapply.getLong("id");
Map<String, Set<JSONObject>> param = new HashMap<>();//传入转换规则处理参数
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
for (Object detail : details) {
@ -310,8 +312,8 @@ public class WMSPurInController {
param.computeIfAbsent(entryId, k -> new HashSet<>()).add(detailObject);
}
//开始下推
String rule = BotpParamUtils.getBotpRuleId(PM_PURREFUNDAPPLYBILL, PURINBILL, "采购退货申请_采购入库_转换规则_扩展");
PushArgs pushArgs = BotpParamUtils.getPushArgs(PM_PURREFUNDAPPLYBILL, PURINBILL, BILLENTRY, param, entitypkMap, rule);
String rule = BotpParamUtils.getBotpRuleId(SM_RETURNAPPLY, IM_SALOUTBILL, "销售退货申请单_销售出库单_转换规则_扩展");
PushArgs pushArgs = BotpParamUtils.getPushArgs(SM_RETURNAPPLY, IM_SALOUTBILL, BILLENTRY, param, entitypkMap, rule);
ConvertOperationResult pushResult = ConvertServiceHelper.pushAndSave(pushArgs);
List<SourceBillReport> billReports = pushResult.getBillReports();
//下推失败直接返回
@ -331,7 +333,7 @@ public class WMSPurInController {
Iterator<Object> iterator = targetBillIds.iterator();
for (int i = 0; iterator.hasNext(); i++) {
Object next = iterator.next();
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(PURINBILL, new QFilter[]{new QFilter("id", QCP.equals, next)});
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(IM_SALOUTBILL, new QFilter[]{new QFilter("id", QCP.equals, next)});
load[i] = dynamicObject;
resultBean.setId(next.toString());
resultBean.setBillStatus(true);
@ -339,41 +341,41 @@ public class WMSPurInController {
// results.add(resultBean);
//开始提交
OperateOption operateOption = OperateOption.create();
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, PURINBILL, load, operateOption);
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, IM_SALOUTBILL, load, operateOption);
if (!sumbitResult.isSuccess()) {
List<IOperateInfo> allErrorOrValidateInfo = sumbitResult.getAllErrorOrValidateInfo();
if (allErrorOrValidateInfo.size() != 0) {
for (IOperateInfo iOperateInfo : allErrorOrValidateInfo) {
HashMap<String, Object> returnMap = resultExt.addErrorToResultBeanByNumber(results, iOperateInfo, PURINBILL);
HashMap<String, Object> returnMap = resultExt.addErrorToResultBeanByNumber(results, iOperateInfo, IM_SALOUTBILL);
results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
}
} else if (StringUtils.isNotBlank(sumbitResult.getMessage())) {
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, sumbitResult.getMessage(), PURINBILL);
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, sumbitResult.getMessage(), IM_SALOUTBILL);
results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
} else {
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, sumbitResult.getInteractionContext().getSimpleMessage(), PURINBILL);
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, sumbitResult.getInteractionContext().getSimpleMessage(), IM_SALOUTBILL);
results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
}
OperationResult deleteResult = OperationServiceHelper.executeOperate(Constants.TYPE_DELETE, PURINBILL, load, operateOption);
OperationResult deleteResult = OperationServiceHelper.executeOperate(Constants.TYPE_DELETE, IM_SALOUTBILL, load, operateOption);
} else {
//开始审核
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, PURINBILL, load, operateOption);
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, IM_SALOUTBILL, load, operateOption);
if (!auditResult.isSuccess()) {
List<IOperateInfo> allErrorOrValidateInfo1 = auditResult.getAllErrorOrValidateInfo();
if (allErrorOrValidateInfo1.size() != 0) {
for (IOperateInfo iOperateInfo : allErrorOrValidateInfo1) {
HashMap<String, Object> returnMap = resultExt.addErrorToResultBeanByNumber(results, iOperateInfo, PURINBILL);
HashMap<String, Object> returnMap = resultExt.addErrorToResultBeanByNumber(results, iOperateInfo, IM_SALOUTBILL);
results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
}
} else if (StringUtils.isNotBlank(auditResult.getMessage())) {
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, auditResult.getMessage(), PURINBILL);
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, auditResult.getMessage(), IM_SALOUTBILL);
results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
} else {
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, auditResult.getInteractionContext().getSimpleMessage(), PURINBILL);
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, auditResult.getInteractionContext().getSimpleMessage(), IM_SALOUTBILL);
results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
}
OperationResult unsubmitResult = OperationServiceHelper.executeOperate(Constants.TYPE_UNSUBMIT, PURINBILL, load, operateOption);
OperationResult deleteResult = OperationServiceHelper.executeOperate(Constants.TYPE_DELETE, PURINBILL, load, operateOption);
OperationResult unsubmitResult = OperationServiceHelper.executeOperate(Constants.TYPE_UNSUBMIT, IM_SALOUTBILL, load, operateOption);
OperationResult deleteResult = OperationServiceHelper.executeOperate(Constants.TYPE_DELETE, IM_SALOUTBILL, load, operateOption);
}
}
//其他入库申请单
@ -522,7 +524,7 @@ public class WMSPurInController {
StringBuilder errormsg = new StringBuilder();
ArrayList<String> entryOrderTypes = new ArrayList<>();
entryOrderTypes.add(RECEIPTNOTICE);
entryOrderTypes.add(PM_PURREFUNDAPPLYBILL);
entryOrderTypes.add(SM_RETURNAPPLY);
entryOrderTypes.add(TQQ9_OTHERINAPPLY);
if (!entryOrderTypes.contains(entryOrderType)) {
errormsg = errormsg.append("").append("传入参数 entryOrderType 为无效值");
@ -768,12 +770,12 @@ public class WMSPurInController {
return CustomApiResult.success(wmsXmlReturn);
}
}
//采购退货单
} else if (StringUtils.equals("pm_purrefundapplybill", entryOrderType)) {
//销售退货单
} else if (StringUtils.equals("sm_returnapply", entryOrderType)) {
//查询单据在金蝶系统中是否存在
DynamicObject pm_purrefundapplybill = BusinessDataServiceHelper.loadSingle(PM_PURREFUNDAPPLYBILL, new QFilter[]{new QFilter("billno", QCP.equals, billno)});
if (pm_purrefundapplybill == null) {
errormsg = errormsg.append("").append("根据传入编号:" + billno + "未找到对应采购退货单");
DynamicObject sm_returnapply = BusinessDataServiceHelper.loadSingle(SM_RETURNAPPLY, new QFilter[]{new QFilter("billno", QCP.equals, billno)});
if (sm_returnapply == null) {
errormsg = errormsg.append("").append("根据传入编号:" + billno + "未找到对应销售退货单");
response.setMessage(errormsg.substring(1));
response.setCode("-1");
response.setFlag("failure");
@ -784,7 +786,7 @@ public class WMSPurInController {
//参数值组装
if (orderLines.get("orderLine") instanceof Map) {
JSONObject orderLine = orderLines.getJSONObject("orderLine");
Long id = pm_purrefundapplybill.getLong("id");
Long id = sm_returnapply.getLong("id");
JSONObject detailObject = new JSONObject();
String orderLineNo = orderLine.getString("orderLineNo");//金蝶源头单据细单号
BigDecimal actualQty = orderLine.getBigDecimal("actualQty");//入库数量
@ -829,7 +831,7 @@ public class WMSPurInController {
JSONArray orderLine = orderLines.getJSONArray("orderLine");
for (Object obj : orderLine) {
JSONObject orderLine1 = gson.fromJson(gson.toJson(obj), JSONObject.class);
Long id = pm_purrefundapplybill.getLong("id");
Long id = sm_returnapply.getLong("id");
JSONObject detailObject = new JSONObject();
String orderLineNo = orderLine1.getString("orderLineNo");//金蝶源头单据细单号
BigDecimal actualQty = orderLine1.getBigDecimal("actualQty");//入库数量
@ -874,8 +876,8 @@ public class WMSPurInController {
}
//开始下推
String rule = BotpParamUtils.getBotpRuleId(PM_PURREFUNDAPPLYBILL, PURINBILL, "采购退货申请_采购入库_转换规则_扩展");
PushArgs pushArgs = BotpParamUtils.getPushArgs(PM_PURREFUNDAPPLYBILL, PURINBILL, BILLENTRY, param, entitypkMap, rule);
String rule = BotpParamUtils.getBotpRuleId(SM_RETURNAPPLY, IM_SALOUTBILL, "销售退货申请单_销售出库单_转换规则_扩展");
PushArgs pushArgs = BotpParamUtils.getPushArgs(SM_RETURNAPPLY, IM_SALOUTBILL, BILLENTRY, param, entitypkMap, rule);
ConvertOperationResult pushResult = ConvertServiceHelper.pushAndSave(pushArgs);
List<SourceBillReport> billReports = pushResult.getBillReports();
//下推失败直接返回
@ -896,12 +898,12 @@ public class WMSPurInController {
Iterator<Object> iterator = targetBillIds.iterator();
for (int i = 0; iterator.hasNext(); i++) {
Object next = iterator.next();
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(PURINBILL, new QFilter[]{new QFilter("id", QCP.equals, next)});
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(IM_SALOUTBILL, new QFilter[]{new QFilter("id", QCP.equals, next)});
load[i] = dynamicObject;
}
//开始提交
OperateOption operateOption = OperateOption.create();
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, PURINBILL, load, operateOption);
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, IM_SALOUTBILL, load, operateOption);
if (!sumbitResult.isSuccess()) {
List<IOperateInfo> allErrorOrValidateInfo = sumbitResult.getAllErrorOrValidateInfo();
if (allErrorOrValidateInfo.size() != 0) {
@ -915,14 +917,14 @@ public class WMSPurInController {
} else {
errormsg = errormsg.append("").append(sumbitResult.getInteractionContext().getSimpleMessage());
}
OperationResult deleteResult = OperationServiceHelper.executeOperate(Constants.TYPE_DELETE, PURINBILL, load, operateOption);
OperationResult deleteResult = OperationServiceHelper.executeOperate(Constants.TYPE_DELETE, IM_SALOUTBILL, load, operateOption);
response.setMessage(errormsg.substring(1));
response.setCode("-1");
response.setFlag("failure");
return CustomApiResult.success(wmsXmlReturn);
} else {
//开始审核
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, PURINBILL, load, operateOption);
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, IM_SALOUTBILL, load, operateOption);
if (!auditResult.isSuccess()) {
List<IOperateInfo> allErrorOrValidateInfo1 = auditResult.getAllErrorOrValidateInfo();
if (allErrorOrValidateInfo1.size() != 0) {
@ -935,8 +937,8 @@ public class WMSPurInController {
} else {
errormsg = errormsg.append("").append(auditResult.getInteractionContext().getSimpleMessage());
}
OperationResult unsubmitResult = OperationServiceHelper.executeOperate(Constants.TYPE_UNSUBMIT, PURINBILL, load, operateOption);
OperationResult deleteResult = OperationServiceHelper.executeOperate(Constants.TYPE_DELETE, PURINBILL, load, operateOption);
OperationResult unsubmitResult = OperationServiceHelper.executeOperate(Constants.TYPE_UNSUBMIT, IM_SALOUTBILL, load, operateOption);
OperationResult deleteResult = OperationServiceHelper.executeOperate(Constants.TYPE_DELETE, IM_SALOUTBILL, load, operateOption);
response.setMessage(errormsg.substring(1));
response.setCode("-1");
response.setFlag("failure");

View File

@ -38,8 +38,12 @@ public class WMSSaleOutController {
private static String SM_DELIVERNOTICE = "sm_delivernotice";//发货通知单
private static String IM_SALOUTBILL = "im_saloutbill";//销售出库单
private static String PURINBILL = "im_purinbill";//采购入库单
private static String BILLENTRY = "billentry";//分录
private static String SM_RETURNAPPLY = "sm_returnapply";//销售退货申请单
private static String PM_PURREFUNDAPPLYBILL = "pm_purrefundapplybill";//采购退货申请单
private static String TQQ9_OTHEROUTAPPLY = "tqq9_otheroutapply";//其他出库申请
private static String IM_OTHEROUTBILL = "im_otheroutbill";//其他出库
@ -108,8 +112,8 @@ public class WMSSaleOutController {
case "sm_delivernotice":
entityType = "im_saloutbill";
break;
case "sm_returnapply":
entityType = "im_saloutbill";
case "pm_purrefundapplybill":
entityType = "im_purinbill";
break;
case "tqq9_otheroutapply":
entityType = "im_otheroutbill";
@ -269,17 +273,17 @@ public class WMSSaleOutController {
OperationResult deleteResult = OperationServiceHelper.executeOperate(Constants.TYPE_DELETE, IM_SALOUTBILL, load, operateOption);
}
}
//销售退货单
} 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(entityType, errormsg, error, resultExt);
return CustomApiResult.success(resultExt);
}
//参数值组装
Long id = sm_returnapply.getLong("id");
Long id = pm_purrefundapplybill.getLong("id");
Map<String, Set<JSONObject>> param = new HashMap<>();//传入转换规则处理参数
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
for (Object detail : details) {
@ -309,8 +313,8 @@ public class WMSSaleOutController {
}
//开始下推
String rule = BotpParamUtils.getBotpRuleId(SM_RETURNAPPLY, IM_SALOUTBILL, "销售退货申请单_销售出库单_转换规则_扩展");
PushArgs pushArgs = BotpParamUtils.getPushArgs(SM_RETURNAPPLY, IM_SALOUTBILL, BILLENTRY, param, entitypkMap, rule);
String rule = BotpParamUtils.getBotpRuleId(PM_PURREFUNDAPPLYBILL, PURINBILL, "采购退货申请_采购入库_转换规则_扩展");
PushArgs pushArgs = BotpParamUtils.getPushArgs(PM_PURREFUNDAPPLYBILL, PURINBILL, BILLENTRY, param, entitypkMap, rule);
ConvertOperationResult pushResult = ConvertServiceHelper.pushAndSave(pushArgs);
List<SourceBillReport> billReports = pushResult.getBillReports();
if (!pushResult.isSuccess()) {
@ -329,48 +333,48 @@ public class WMSSaleOutController {
Iterator<Object> iterator = targetBillIds.iterator();
for (int i = 0; iterator.hasNext(); i++) {
Object next = iterator.next();
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(IM_SALOUTBILL, new QFilter[]{new QFilter("id", QCP.equals, next)});
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(PURINBILL, new QFilter[]{new QFilter("id", QCP.equals, next)});
load[i] = dynamicObject;
resultBean.setId(next.toString());
resultBean.setBillStatus(true);
}
//开始提交
OperateOption operateOption = OperateOption.create();
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, IM_SALOUTBILL, load, operateOption);
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, PURINBILL, load, operateOption);
if (!sumbitResult.isSuccess()) {
List<IOperateInfo> allErrorOrValidateInfo = sumbitResult.getAllErrorOrValidateInfo();
if (allErrorOrValidateInfo.size() != 0) {
for (IOperateInfo iOperateInfo : allErrorOrValidateInfo) {
HashMap<String, Object> returnMap = resultExt.addErrorToResultBeanByNumber(results, iOperateInfo, IM_SALOUTBILL);
HashMap<String, Object> returnMap = resultExt.addErrorToResultBeanByNumber(results, iOperateInfo, PURINBILL);
results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
}
} else if (StringUtils.isNotBlank(sumbitResult.getMessage())) {
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, sumbitResult.getMessage(), IM_SALOUTBILL);
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, sumbitResult.getMessage(), PURINBILL);
results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
} else {
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, sumbitResult.getInteractionContext().getSimpleMessage(), IM_SALOUTBILL);
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, sumbitResult.getInteractionContext().getSimpleMessage(), PURINBILL);
results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
}
OperationResult deleteResult = OperationServiceHelper.executeOperate(Constants.TYPE_DELETE, IM_SALOUTBILL, load, operateOption);
OperationResult deleteResult = OperationServiceHelper.executeOperate(Constants.TYPE_DELETE, PURINBILL, load, operateOption);
} else {
//开始审核
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, IM_SALOUTBILL, load, operateOption);
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, PURINBILL, load, operateOption);
if (!auditResult.isSuccess()) {
List<IOperateInfo> allErrorOrValidateInfo1 = auditResult.getAllErrorOrValidateInfo();
if (allErrorOrValidateInfo1.size() != 0) {
for (IOperateInfo iOperateInfo : allErrorOrValidateInfo1) {
HashMap<String, Object> returnMap = resultExt.addErrorToResultBeanByNumber(results, iOperateInfo, IM_SALOUTBILL);
HashMap<String, Object> returnMap = resultExt.addErrorToResultBeanByNumber(results, iOperateInfo, PURINBILL);
results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
}
} else if (StringUtils.isNotBlank(auditResult.getMessage())) {
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, auditResult.getMessage(), IM_SALOUTBILL);
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, auditResult.getMessage(), PURINBILL);
results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
} else {
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, auditResult.getInteractionContext().getSimpleMessage(), IM_SALOUTBILL);
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, auditResult.getInteractionContext().getSimpleMessage(), PURINBILL);
results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
}
OperationResult unsumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_UNSUBMIT, IM_SALOUTBILL, load, operateOption);
OperationResult deleteResult = OperationServiceHelper.executeOperate(Constants.TYPE_DELETE, IM_SALOUTBILL, load, operateOption);
OperationResult unsumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_UNSUBMIT, PURINBILL, load, operateOption);
OperationResult deleteResult = OperationServiceHelper.executeOperate(Constants.TYPE_DELETE, PURINBILL, load, operateOption);
}
}
//其他出库
@ -521,7 +525,7 @@ public class WMSSaleOutController {
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 为无效值");
@ -777,12 +781,12 @@ public class WMSSaleOutController {
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");
@ -793,7 +797,7 @@ public class WMSSaleOutController {
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
if (orderLines.get("orderLine") instanceof Map) {
JSONObject orderLine = orderLines.getJSONObject("orderLine");
Long id = sm_returnapply.getLong("id");
Long id = pm_purrefundapplybill.getLong("id");
JSONObject detailObject = new JSONObject();
String orderLineNo = orderLine.getString("orderLineNo");//金蝶源头单据细单号
BigDecimal actualQty = orderLine.getBigDecimal("actualQty");//出库数量
@ -838,7 +842,7 @@ public class WMSSaleOutController {
JSONArray orderLine = orderLines.getJSONArray("orderLine");
for (Object obj : orderLine) {
JSONObject orderLine1 = gson.fromJson(gson.toJson(obj), JSONObject.class);
Long id = sm_returnapply.getLong("id");
Long id = pm_purrefundapplybill.getLong("id");
JSONObject detailObject = new JSONObject();
String orderLineNo = orderLine1.getString("orderLineNo");//金蝶源头单据细单号
BigDecimal actualQty = orderLine1.getBigDecimal("actualQty");//出库数量
@ -882,8 +886,8 @@ public class WMSSaleOutController {
}
}
//开始下推
String rule = BotpParamUtils.getBotpRuleId(SM_RETURNAPPLY, IM_SALOUTBILL, "销售退货申请单_销售出库单_转换规则_扩展");
PushArgs pushArgs = BotpParamUtils.getPushArgs(SM_RETURNAPPLY, IM_SALOUTBILL, BILLENTRY, param, entitypkMap, rule);
String rule = BotpParamUtils.getBotpRuleId(PM_PURREFUNDAPPLYBILL, PURINBILL, "采购退货申请_采购入库_转换规则_扩展");
PushArgs pushArgs = BotpParamUtils.getPushArgs(PM_PURREFUNDAPPLYBILL, PURINBILL, BILLENTRY, param, entitypkMap, rule);
ConvertOperationResult pushResult = ConvertServiceHelper.pushAndSave(pushArgs);
List<SourceBillReport> billReports = pushResult.getBillReports();
if (!pushResult.isSuccess()) {
@ -902,12 +906,12 @@ public class WMSSaleOutController {
Iterator<Object> iterator = targetBillIds.iterator();
for (int i = 0; iterator.hasNext(); i++) {
Object next = iterator.next();
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(IM_SALOUTBILL, new QFilter[]{new QFilter("id", QCP.equals, next)});
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(PURINBILL, new QFilter[]{new QFilter("id", QCP.equals, next)});
load[i] = dynamicObject;
}
//开始提交
OperateOption operateOption = OperateOption.create();
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, IM_SALOUTBILL, load, operateOption);
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, PURINBILL, load, operateOption);
if (!sumbitResult.isSuccess()) {
List<IOperateInfo> allErrorOrValidateInfo = sumbitResult.getAllErrorOrValidateInfo();
if (allErrorOrValidateInfo.size() != 0) {
@ -920,14 +924,14 @@ public class WMSSaleOutController {
} else {
errormsg = errormsg.append("").append(sumbitResult.getInteractionContext().getSimpleMessage());
}
OperationResult deleteResult = OperationServiceHelper.executeOperate(Constants.TYPE_DELETE, IM_SALOUTBILL, load, operateOption);
OperationResult deleteResult = OperationServiceHelper.executeOperate(Constants.TYPE_DELETE, PURINBILL, load, operateOption);
response.setMessage(errormsg.substring(1));
response.setCode("-1");
response.setFlag("failure");
return CustomApiResult.success(wmsXmlReturn);
} else {
//开始审核
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, IM_SALOUTBILL, load, operateOption);
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, PURINBILL, load, operateOption);
if (!auditResult.isSuccess()) {
List<IOperateInfo> allErrorOrValidateInfo1 = auditResult.getAllErrorOrValidateInfo();
if (allErrorOrValidateInfo1.size() != 0) {
@ -941,8 +945,8 @@ public class WMSSaleOutController {
} else {
errormsg = errormsg.append("").append(auditResult.getInteractionContext().getSimpleMessage());
}
OperationResult unsumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_UNSUBMIT, IM_SALOUTBILL, load, operateOption);
OperationResult deleteResult = OperationServiceHelper.executeOperate(Constants.TYPE_DELETE, IM_SALOUTBILL, load, operateOption);
OperationResult unsumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_UNSUBMIT, PURINBILL, load, operateOption);
OperationResult deleteResult = OperationServiceHelper.executeOperate(Constants.TYPE_DELETE, PURINBILL, load, operateOption);
response.setMessage(errormsg.substring(1));
response.setCode("-1");
response.setFlag("failure");

View File

@ -23,6 +23,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.sdk.plugin.Plugin;
import java.math.BigDecimal;
import java.util.*;
/**
@ -302,16 +303,13 @@ public class PurSuggestRptFromPlugin extends AbstractFormPlugin implements Plugi
while (iterator.hasNext()) {
DynamicObject next = iterator.next();
DynamicObject entry = new DynamicObject(entryentity.getDynamicObjectType());
// DynamicObject tqq9_sku = goodMap.get(next.getLong("tqq9_sku"));
DynamicObject tqq9_material = materialMap.get(next.getLong("tqq9_material"));
DynamicObject tqq9_org = adminorgMap.get(next.getLong("tqq9_org"));
// entry.set("tqq9_sku", tqq9_sku);//tqq9_sku
entry.set("tqq9_material", tqq9_material);//物料
entry.set("tqq9_skuname", tqq9_material.getString("name"));//名称
entry.set("tqq9_skubrand", tqq9_material.getDynamicObject("tqq9_brand"));//品牌
entry.set("tqq9_unit", tqq9_material.getDynamicObject("baseunit"));//基本单位
entry.set("tqq9_org", tqq9_org);//业务归属组织
// entry.set("tqq9_totalupstock", next.get("tqq9_totalupstock"));//需上传总库存
entry.set("tqq9_shinventory", next.get("tqq9_shinventory"));//上海库存
entry.set("tqq9_bjinventory", next.get("tqq9_bjinventory"));//北京库存
entry.set("tqq9_gzinventory", next.get("tqq9_gzinventory"));//广州库存
@ -346,7 +344,11 @@ public class PurSuggestRptFromPlugin extends AbstractFormPlugin implements Plugi
entry.set("tqq9_bjsaledates", next.get("tqq9_bjsaledates"));//预计销售时间北京
entry.set("tqq9_gzsaledates", next.get("tqq9_gzsaledates"));//预计销售时间广州
entry.set("tqq9_cdsaledates", next.get("tqq9_cdsaledates"));//预计销售时间成都
if(next.getBigDecimal("tqq9_saledates").compareTo(BigDecimal.ZERO)==0){
entry.set("tqq9_saledates", -1);//预计销售时间
}else{
entry.set("tqq9_saledates", next.get("tqq9_saledates"));//预计销售时间
}
entry.set("tqq9_remark", next.get("tqq9_remark"));//备货状态
entry.set("tqq9_safeinventory", next.get("tqq9_safeinventory"));//安全库存
entry.set("tqq9_inventory_sh", next.get("tqq9_inventory_sh"));//上海在途库存

View File

@ -549,6 +549,10 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
BigDecimal tqq9_payamount = dataEntity.getBigDecimal("tqq9_payamount");
if (tqq9_payamount.compareTo(BigDecimal.ZERO) == 0) {
DynamicObjectCollection purbillentry_pay = dataEntity.getDynamicObjectCollection("purbillentry_pay");
DynamicObjectCollection billentry = dataEntity.getDynamicObjectCollection("billentry");
for (DynamicObject dynamicObject : billentry) {
dynamicObject.set("ispresent",true);
}
purbillentry_pay.clear();
SaveServiceHelper.save(new DynamicObject[]{dataEntity});
}

View File

@ -9,7 +9,6 @@ import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import java.util.Date;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -71,11 +70,8 @@ public class GetGoodsByMaterialBillPlugin extends AbstractBillPlugIn {
// 形态转换单子明细
if ("im_adjustbill".equals(dataEntityName)) {
int parentRowIndex = changeSet[0].getParentRowIndex();
if ("material1".equals(name) || "lotnumber".equals(name) || "producedate".equals(name) || "expirydate".equals(name)) {
if ("material1".equals(name) ) {
DynamicObject material = (DynamicObject) this.getModel().getValue("material1", rowIndex);
String lotnumber = (String) this.getModel().getValue("lotnumber", rowIndex);
Date producedate = (Date) this.getModel().getValue("producedate", rowIndex);
Date expirydate = (Date) this.getModel().getValue("expirydate", rowIndex);
if (material != null) {
QFilter f1 = new QFilter("tqq9_mater.number", "=", material.getString("number"));
QFilter f5 = new QFilter("tqq9_isauto", "=", true);

View File

@ -99,30 +99,29 @@ public class PurInConvertPlugin extends AbstractConvertPlugIn implements Plugin
}
String batch = jsonMap.get("batch") != null ? jsonMap.get("batch").toString() : null; // 批次
String toZone = jsonMap.get("toZone") != null ? jsonMap.get("toZone").toString() : null; // 库区
String fromZone = jsonMap.get("fromZone") != null ? jsonMap.get("fromZone").toString() : null; // 库区
DynamicObject bd_warehouse = null;
if (toZone != null) {
String wareNumber = wareTypeMap.get(toZone);
bd_warehouse = BusinessDataServiceHelper.loadSingle("bd_warehouse", new QFilter[]{new QFilter("number", QCP.equals, wareNumber)});
}
if (fromZone != null) {
String wareNumber = wareTypeMap.get(fromZone);
bd_warehouse = BusinessDataServiceHelper.loadSingle("bd_warehouse", new QFilter[]{new QFilter("number", QCP.equals, wareNumber)});
}
String wmsDetailId = jsonMap.get("wmsDetailId") != null ? jsonMap.get("wmsDetailId").toString() : null; // WMS分录id
String uniqueCode = jsonMap.get("uniqueCode") != null ? jsonMap.get("uniqueCode").toString() : null; // 商品编码
String registrationCode = jsonMap.get("registrationCode") != null ? jsonMap.get("registrationCode").toString() : null; // 注册证号
String licenceCode = jsonMap.get("licenceCode") != null ? jsonMap.get("licenceCode").toString() : null; // 生产许可证号
String producer = jsonMap.get("producer") != null ? jsonMap.get("producer").toString() : null; // 生产厂商
// DynamicObject tqq9_goodspackage = BusinessDataServiceHelper.loadSingle("tqq9_goodspackage", new QFilter[]{new QFilter("tqq9_mater.number", QCP.equals, uniqueCode).and("tqq9_isauto", QCP.equals, true)});
DynamicObject tqq9_registration = BusinessDataServiceHelper.loadSingle("tqq9_registration", new QFilter[]{new QFilter("number", QCP.equals, registrationCode)});
// DynamicObject tqq9_proxyandfactory = BusinessDataServiceHelper.loadSingle("tqq9_proxyandfactory", new QFilter[]{new QFilter("number", QCP.equals, producer)});
BigDecimal qty = entry.getBigDecimal("qty");//原数量
BigDecimal amountandtax = entry.getBigDecimal("amountandtax");//折扣后价税合计
BigDecimal amount = entry.getBigDecimal("amount");//金额
amountandtax = amountandtax.multiply(quantity).divide(qty, 10, RoundingMode.HALF_UP);//折扣后价税合计
amount = amount.multiply(quantity).divide(qty, 10, RoundingMode.HALF_UP);//金额
BigDecimal taxamount = amountandtax.subtract(amount);//税额
// 处理第一次逻辑
if (i == 0) {
entry.set("taxamount", taxamount);//税额
entry.set("curtaxamount", taxamount);//税额(本位币)
entry.set("amountandtax", amountandtax);//折扣后价税合计
@ -135,11 +134,9 @@ public class PurInConvertPlugin extends AbstractConvertPlugIn implements Plugin
entry.set("remainjoinpricebaseqty", quantity);//剩余应付基本数量
entry.set("unverifyqty", quantity); //未核销数量
entry.set("unverifybaseqty", quantity); //未核销基本数量
// 第一次直接赋值
entry.set("qty", quantity);
entry.set("baseqty", quantity);
// entry.set("tqq9_goods", tqq9_goodspackage);
entry.set("producedate", manufactureDate);
entry.set("expirydate", expirationDate);
entry.set("lotnumber", batch);
@ -159,7 +156,6 @@ public class PurInConvertPlugin extends AbstractConvertPlugIn implements Plugin
for (IDataEntityProperty property : properties) {
newEntry.set(property.getName(), entry.get(property.getName()));
}
newEntry.set("taxamount", taxamount);//税额
newEntry.set("curtaxamount", taxamount);//税额(本位币)
newEntry.set("amountandtax", amountandtax);//折扣后价税合计
@ -172,10 +168,8 @@ public class PurInConvertPlugin extends AbstractConvertPlugIn implements Plugin
newEntry.set("remainjoinpricebaseqty", quantity);//剩余应付基本数量
newEntry.set("unverifyqty", quantity); //未核销数量
newEntry.set("unverifybaseqty", quantity); //未核销基本数量
newEntry.set("qty", quantity);
newEntry.set("baseqty", quantity);
// newEntry.set("tqq9_goods", tqq9_goodspackage);
newEntry.set("producedate", manufactureDate);
newEntry.set("expirydate", expirationDate);
newEntry.set("lotnumber", batch);

View File

@ -98,26 +98,27 @@ public class SaleOutBillConvertPlugin extends AbstractConvertPlugIn implements P
}
String batch = jsonMap.get("batch") != null ? jsonMap.get("batch").toString() : null; // 批次
String fromZone = jsonMap.get("fromZone") != null ? jsonMap.get("fromZone").toString() : null; // 库区
String toZone = jsonMap.get("toZone") != null ? jsonMap.get("toZone").toString() : null; // 库区
DynamicObject bd_warehouse = null;
if (fromZone != null) {
String wareNumber = wareTypeMap.get(fromZone);
bd_warehouse = BusinessDataServiceHelper.loadSingle("bd_warehouse", new QFilter[]{new QFilter("number", QCP.equals, wareNumber)});
}
if (toZone != null) {
String wareNumber = wareTypeMap.get(toZone);
bd_warehouse = BusinessDataServiceHelper.loadSingle("bd_warehouse", new QFilter[]{new QFilter("number", QCP.equals, wareNumber)});
}
String wmsDetailId = jsonMap.get("wmsDetailId") != null ? jsonMap.get("wmsDetailId").toString() : null; // WMS分录id
String uniqueCode = jsonMap.get("uniqueCode") != null ? jsonMap.get("uniqueCode").toString() : null; // 商品编码
String registrationCode = jsonMap.get("registrationCode") != null ? jsonMap.get("registrationCode").toString() : null; // 注册证号
String licenceCode = jsonMap.get("licenceCode") != null ? jsonMap.get("licenceCode").toString() : null; // 生产许可证号
String producer = jsonMap.get("producer") != null ? jsonMap.get("producer").toString() : null; // 生产厂商
// DynamicObject tqq9_goodspackage = BusinessDataServiceHelper.loadSingle("tqq9_goodspackage", new QFilter[]{new QFilter("tqq9_mater.number", QCP.equals, uniqueCode).and("tqq9_isauto", QCP.equals, true)});
DynamicObject tqq9_registration = BusinessDataServiceHelper.loadSingle("tqq9_registration", new QFilter[]{new QFilter("number", QCP.equals, registrationCode)});
// DynamicObject tqq9_proxyandfactory = BusinessDataServiceHelper.loadSingle("tqq9_proxyandfactory", new QFilter[]{new QFilter("number", QCP.equals, producer)});
// 处理第一次逻辑
if (i == 0) {
// 第一次直接赋值
BigDecimal qty = entry.getBigDecimal("qty");//原数量
entry.set("qty", quantity);
entry.set("baseqty", quantity);
// entry.set("tqq9_goods", tqq9_goodspackage);
entry.set("producedate", manufactureDate);
entry.set("expirydate", expirationDate);
entry.set("lotnumber", batch);
@ -152,7 +153,6 @@ public class SaleOutBillConvertPlugin extends AbstractConvertPlugIn implements P
BigDecimal qty = entry.getBigDecimal("qty");//原数量
newEntry.set("qty", quantity);
newEntry.set("baseqty", quantity);
// newEntry.set("tqq9_goods", tqq9_goodspackage);
newEntry.set("producedate", manufactureDate);
newEntry.set("expirydate", expirationDate);
newEntry.set("lotnumber", batch);

View File

@ -110,11 +110,16 @@ public class YdthPurInConvertPlugin extends AbstractConvertPlugIn implements Plu
}
String batch = jsonMap.get("batch") != null ? jsonMap.get("batch").toString() : null; // 批次
String toZone = jsonMap.get("toZone") != null ? jsonMap.get("toZone").toString() : null; // 库区
String fromZone = jsonMap.get("fromZone") != null ? jsonMap.get("fromZone").toString() : null; // 库区
DynamicObject bd_warehouse = null;
if (toZone != null) {
String wareNumber = wareTypeMap.get(toZone);
bd_warehouse = BusinessDataServiceHelper.loadSingle("bd_warehouse", new QFilter[]{new QFilter("number", QCP.equals, wareNumber)});
}
if (fromZone != null) {
String wareNumber = wareTypeMap.get(fromZone);
bd_warehouse = BusinessDataServiceHelper.loadSingle("bd_warehouse", new QFilter[]{new QFilter("number", QCP.equals, wareNumber)});
}
String wmsDetailId = jsonMap.get("wmsDetailId") != null ? jsonMap.get("wmsDetailId").toString() : null; // WMS分录id
String uniqueCode = jsonMap.get("uniqueCode") != null ? jsonMap.get("uniqueCode").toString() : null; // 商品编码
String registrationCode = jsonMap.get("registrationCode") != null ? jsonMap.get("registrationCode").toString() : null; // 注册证号
@ -311,11 +316,16 @@ public class YdthPurInConvertPlugin extends AbstractConvertPlugIn implements Plu
}
String batch = jsonMap.get("batch") != null ? jsonMap.get("batch").toString() : null; // 批次
String toZone = jsonMap.get("toZone") != null ? jsonMap.get("toZone").toString() : null; // 库区
String fromZone = jsonMap.get("fromZone") != null ? jsonMap.get("fromZone").toString() : null; // 库区
DynamicObject bd_warehouse = null;
if (toZone != null) {
String wareNumber = wareTypeMap.get(toZone);
bd_warehouse = BusinessDataServiceHelper.loadSingle("bd_warehouse", new QFilter[]{new QFilter("number", QCP.equals, wareNumber)});
}
if (fromZone != null) {
String wareNumber = wareTypeMap.get(fromZone);
bd_warehouse = BusinessDataServiceHelper.loadSingle("bd_warehouse", new QFilter[]{new QFilter("number", QCP.equals, wareNumber)});
}
String wmsDetailId = jsonMap.get("wmsDetailId") != null ? jsonMap.get("wmsDetailId").toString() : null; // WMS分录id
String uniqueCode = jsonMap.get("uniqueCode") != null ? jsonMap.get("uniqueCode").toString() : null; // 商品编码
String registrationCode = jsonMap.get("registrationCode") != null ? jsonMap.get("registrationCode").toString() : null; // 注册证号