parent
950dffedcd
commit
752bcdf1be
|
|
@ -37,8 +37,6 @@ public class WMSLogiSyncController {
|
|||
ApiResultExt resultExt = new ApiResultExt();
|
||||
List<ApiResultExt.ResultBean> results = new ArrayList<>();
|
||||
resultExt.setResult(results);
|
||||
// Gson gson = new Gson();
|
||||
// HashMap<String, Object> data = gson.fromJson(dataString, HashMap.class);
|
||||
String billno = cDPCode;
|
||||
ApiResultExt.ResultBean resultBean = new ApiResultExt.ResultBean();
|
||||
results.add(resultBean);
|
||||
|
|
@ -55,8 +53,6 @@ public class WMSLogiSyncController {
|
|||
resultBean.setNumber(billno);
|
||||
resultBean.setType(Constants.TYPE_UPDATE);
|
||||
String entityType = Constants.IM_PURINBILL;
|
||||
// String ExpressCompany = data.get("ExpressCompany").toString();//快递公司
|
||||
// String cWayBillCode = data.get("cWayBillCode").toString();//快递单号
|
||||
//必填项校验
|
||||
if (ApiResultExt.validateRequired(billno, "String")) {
|
||||
errorMsg="传入参数 cDPCode 为空";
|
||||
|
|
|
|||
|
|
@ -40,9 +40,6 @@ public class WMSPurInCloseController {
|
|||
ApiResultExt resultExt = new ApiResultExt();
|
||||
List<ApiResultExt.ResultBean> results = new ArrayList<>();
|
||||
resultExt.setResult(results);
|
||||
// Gson gson = new Gson();
|
||||
// HashMap<String, Object> data = gson.fromJson(dataString, HashMap.class);
|
||||
// String VoucherType = (String) data.get("VoucherType");//单据类型
|
||||
String billno = cVouCode;//单据编号
|
||||
ApiResultExt.ResultBean resultBean = new ApiResultExt.ResultBean();
|
||||
results.add(resultBean);
|
||||
|
|
@ -185,27 +182,9 @@ public class WMSPurInCloseController {
|
|||
resultExt = ApiResultExt.errorRetrun(VoucherType, errormsg, error, resultExt);
|
||||
return CustomApiResult.success(resultExt);
|
||||
}
|
||||
//开始关闭
|
||||
tqq9_otherinapply.set("tqq9_isclose",true);
|
||||
SaveServiceHelper.save(new DynamicObject[]{tqq9_otherinapply});
|
||||
|
||||
// //开始提交
|
||||
// OperateOption operateOption = OperateOption.create();
|
||||
// OperationResult closeResult = OperationServiceHelper.executeOperate(Constants.TYPE_CLOSE, TQQ9_OTHERINAPPLY, new DynamicObject[]{tqq9_otherinapply}, operateOption);
|
||||
// if (!closeResult.isSuccess()) {
|
||||
// List<IOperateInfo> allErrorOrValidateInfo = closeResult.getAllErrorOrValidateInfo();
|
||||
// if (allErrorOrValidateInfo.size() != 0) {
|
||||
// for (IOperateInfo iOperateInfo : allErrorOrValidateInfo) {
|
||||
// HashMap<String, Object> returnMap = resultExt.addErrorToResultBeanByNumber(results, iOperateInfo, TQQ9_OTHERINAPPLY);
|
||||
// results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
|
||||
// }
|
||||
// } else if (StringUtils.isNotBlank(closeResult.getMessage())) {
|
||||
// HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, closeResult.getMessage(), TQQ9_OTHERINAPPLY);
|
||||
// results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
|
||||
// } else {
|
||||
// HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, closeResult.getInteractionContext().getSimpleMessage(), TQQ9_OTHERINAPPLY);
|
||||
// results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
//回传成功
|
||||
int failCount = 0;//失败数量
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package tqq9.lc123.cloud.app.api.controller;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.drew.lang.annotations.NotNull;
|
||||
import com.google.gson.Gson;
|
||||
import kd.bos.dataentity.OperateOption;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.utils.StringUtils;
|
||||
|
|
@ -20,6 +21,7 @@ import kd.bos.orm.query.QFilter;
|
|||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.botp.ConvertServiceHelper;
|
||||
import kd.bos.servicehelper.operation.OperationServiceHelper;
|
||||
import tqq9.lc123.cloud.app.api.model.WMSXmlReturn;
|
||||
import tqq9.lc123.cloud.app.api.utils.ApiResultExt;
|
||||
import tqq9.lc123.cloud.app.api.utils.Constants;
|
||||
import tqq9.lc123.cloud.app.plugin.utils.BotpParamUtils;
|
||||
|
|
@ -54,11 +56,7 @@ public class WMSPurInController {
|
|||
ApiResultExt resultExt = new ApiResultExt();
|
||||
List<ApiResultExt.ResultBean> results = new ArrayList<>();
|
||||
resultExt.setResult(results);
|
||||
// Gson gson = new Gson();
|
||||
// HashMap<String, Object> data = gson.fromJson(dataString, HashMap.class);
|
||||
// String VoucherType = (String) data.get("VoucherType");//单据类型
|
||||
String billno = erpOrderCode;//收货通知单编号
|
||||
// JSONArray details = (JSONArray) data.get("details");
|
||||
ApiResultExt.ResultBean resultBean = new ApiResultExt.ResultBean();
|
||||
results.add(resultBean);
|
||||
JSONObject key = new JSONObject();
|
||||
|
|
@ -204,7 +202,7 @@ public class WMSPurInController {
|
|||
// results.add(resultBean);
|
||||
//开始提交
|
||||
OperateOption operateOption = OperateOption.create();
|
||||
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, RECEIPTNOTICE, load, operateOption);
|
||||
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, PURINBILL, load, operateOption);
|
||||
if (!sumbitResult.isSuccess()) {
|
||||
List<IOperateInfo> allErrorOrValidateInfo = sumbitResult.getAllErrorOrValidateInfo();
|
||||
if (allErrorOrValidateInfo.size() != 0) {
|
||||
|
|
@ -221,7 +219,7 @@ public class WMSPurInController {
|
|||
}
|
||||
} else {
|
||||
//开始审核
|
||||
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, RECEIPTNOTICE, load, operateOption);
|
||||
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, PURINBILL, load, operateOption);
|
||||
if (!auditResult.isSuccess()) {
|
||||
List<IOperateInfo> allErrorOrValidateInfo1 = auditResult.getAllErrorOrValidateInfo();
|
||||
if (allErrorOrValidateInfo1.size() != 0) {
|
||||
|
|
@ -295,20 +293,18 @@ public class WMSPurInController {
|
|||
//获取下推单据id准备提交审核操作
|
||||
Set<Object> targetBillIds = pushResult.getTargetBillIds();
|
||||
DynamicObject[] load = new DynamicObject[targetBillIds.size()];
|
||||
HashMap<Object, String> reMap = new HashMap<Object, String>();
|
||||
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)});
|
||||
load[i] = dynamicObject;
|
||||
reMap.put(dynamicObject.get("id"), dynamicObject.getString("billno"));
|
||||
resultBean.setId(next.toString());
|
||||
resultBean.setBillStatus(true);
|
||||
}
|
||||
// results.add(resultBean);
|
||||
//开始提交
|
||||
OperateOption operateOption = OperateOption.create();
|
||||
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, PM_PURREFUNDAPPLYBILL, load, operateOption);
|
||||
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, PURINBILL, load, operateOption);
|
||||
if (!sumbitResult.isSuccess()) {
|
||||
List<IOperateInfo> allErrorOrValidateInfo = sumbitResult.getAllErrorOrValidateInfo();
|
||||
if (allErrorOrValidateInfo.size() != 0) {
|
||||
|
|
@ -325,7 +321,7 @@ public class WMSPurInController {
|
|||
}
|
||||
} else {
|
||||
//开始审核
|
||||
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, PM_PURREFUNDAPPLYBILL, load, operateOption);
|
||||
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, PURINBILL, load, operateOption);
|
||||
if (!auditResult.isSuccess()) {
|
||||
List<IOperateInfo> allErrorOrValidateInfo1 = auditResult.getAllErrorOrValidateInfo();
|
||||
if (allErrorOrValidateInfo1.size() != 0) {
|
||||
|
|
@ -399,20 +395,18 @@ public class WMSPurInController {
|
|||
//获取下推单据id准备提交审核操作
|
||||
Set<Object> targetBillIds = pushResult.getTargetBillIds();
|
||||
DynamicObject[] load = new DynamicObject[targetBillIds.size()];
|
||||
HashMap<Object, String> reMap = new HashMap<Object, String>();
|
||||
Iterator<Object> iterator = targetBillIds.iterator();
|
||||
for (int i = 0; iterator.hasNext(); i++) {
|
||||
Object next = iterator.next();
|
||||
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(IM_OTHERINBILL, new QFilter[]{new QFilter("id", QCP.equals, next)});
|
||||
load[i] = dynamicObject;
|
||||
reMap.put(dynamicObject.get("id"), dynamicObject.getString("billno"));
|
||||
resultBean.setId(next.toString());
|
||||
resultBean.setBillStatus(true);
|
||||
}
|
||||
// results.add(resultBean);
|
||||
//开始提交
|
||||
OperateOption operateOption = OperateOption.create();
|
||||
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, TQQ9_OTHERINAPPLY, load, operateOption);
|
||||
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, IM_OTHERINBILL, load, operateOption);
|
||||
if (!sumbitResult.isSuccess()) {
|
||||
List<IOperateInfo> allErrorOrValidateInfo = sumbitResult.getAllErrorOrValidateInfo();
|
||||
if (allErrorOrValidateInfo.size() != 0) {
|
||||
|
|
@ -430,7 +424,7 @@ public class WMSPurInController {
|
|||
|
||||
} else {
|
||||
//开始审核
|
||||
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, TQQ9_OTHERINAPPLY, load, operateOption);
|
||||
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, IM_OTHERINBILL, load, operateOption);
|
||||
if (!auditResult.isSuccess()) {
|
||||
List<IOperateInfo> allErrorOrValidateInfo1 = auditResult.getAllErrorOrValidateInfo();
|
||||
if (allErrorOrValidateInfo1.size() != 0) {
|
||||
|
|
@ -460,4 +454,542 @@ public class WMSPurInController {
|
|||
|
||||
}
|
||||
|
||||
@ApiPostMapping(value = "/WMSPushPurIn_SH", desc = "WMS-入库回传")
|
||||
public CustomApiResult<WMSXmlReturn> WMS_PurInPush_SH(@NotNull @ApiParam(value = "入参", required = true) Map<String, Object> dataMap) {
|
||||
//返回值初始化
|
||||
Gson gson = new Gson();
|
||||
JSONObject data = gson.fromJson(dataMap.toString(), JSONObject.class);
|
||||
JSONObject receipt = data.getJSONObject("receipt");
|
||||
JSONObject header = receipt.getJSONObject("header");
|
||||
JSONObject receiptHeader = header.getJSONObject("receiptHeader");
|
||||
String billno = receiptHeader.getString("erpOrderCode");//单据编号
|
||||
String erpOrderType = receiptHeader.getString("erpOrderType");//单据类型
|
||||
JSONObject details = receipt.getJSONObject("details");
|
||||
WMSXmlReturn wmsXmlReturn = new WMSXmlReturn();
|
||||
WMSXmlReturn.Response response = new WMSXmlReturn.Response();
|
||||
wmsXmlReturn.setResponse(response);
|
||||
response.setCode("0");
|
||||
response.setFlag("success");
|
||||
response.setMessage("成功");
|
||||
StringBuilder errormsg = new StringBuilder();
|
||||
ArrayList<String> erpOrderTypes = new ArrayList<>();
|
||||
erpOrderTypes.add(RECEIPTNOTICE);
|
||||
erpOrderTypes.add(PM_PURREFUNDAPPLYBILL);
|
||||
erpOrderTypes.add(TQQ9_OTHERINAPPLY);
|
||||
if (!erpOrderTypes.contains(erpOrderType)) {
|
||||
errormsg = errormsg.append(",").append("传入参数 VoucherType 为无效值");
|
||||
response.setMessage(errormsg.substring(1));
|
||||
response.setCode("-1");
|
||||
response.setFlag("failure");
|
||||
return CustomApiResult.success(wmsXmlReturn);
|
||||
}
|
||||
//必填项校验
|
||||
if (ApiResultExt.validateRequired(erpOrderType, "String")) {
|
||||
errormsg = errormsg.append(",").append("传入参数 erpOrderType 为空");
|
||||
}
|
||||
if (ApiResultExt.validateRequired(billno, "String")) {
|
||||
errormsg = errormsg.append(",").append("传入参数 erpOrderCode 为空");
|
||||
}
|
||||
if (details.get("detail") instanceof Map) {
|
||||
JSONObject detail = details.getJSONObject("detail");
|
||||
JSONObject receiptDetail = detail.getJSONObject("receiptDetail");
|
||||
BigDecimal quantity = receiptDetail.getBigDecimal("quantity");//入库数量
|
||||
String erpOrderLineNum = receiptDetail.getString("erpOrderLineNum");//金蝶源头单据细单号
|
||||
if (receiptDetail.getString("erpOrderLineNum").length() > 19) {
|
||||
errormsg = errormsg.append(",").append("Value " + erpOrderLineNum + " is out of range for a Long. Using default value");
|
||||
response.setMessage(errormsg.substring(1));
|
||||
response.setCode("-1");
|
||||
response.setFlag("failure");
|
||||
return CustomApiResult.success(wmsXmlReturn);
|
||||
}
|
||||
DynamicObject isexsit = BusinessDataServiceHelper.loadSingle(erpOrderType, new QFilter[]{new QFilter("billentry.id", QCP.equals, receiptDetail.getLong("erpOrderLineNum"))});
|
||||
if (isexsit == null) {
|
||||
errormsg = errormsg.append(",").append("传入参数 erpOrderLineNum 在金蝶系统中未查询到对应单据");
|
||||
}
|
||||
if (ApiResultExt.validateRequired(quantity, "BigDecimal")) {
|
||||
errormsg = errormsg.append(",").append("传入参数 quantity 为空");
|
||||
}
|
||||
if (ApiResultExt.validateRequired(erpOrderLineNum, "String")) {
|
||||
errormsg = errormsg.append(",").append("传入参数 erpOrderLineNum 为空");
|
||||
}
|
||||
|
||||
if (errormsg.length() > 0) {
|
||||
response.setMessage(errormsg.substring(1));
|
||||
response.setCode("-1");
|
||||
response.setFlag("failure");
|
||||
return CustomApiResult.success(wmsXmlReturn);
|
||||
}
|
||||
} else {
|
||||
JSONArray detail1 = details.getJSONArray("detail");
|
||||
for (Object obj : detail1) {
|
||||
JSONObject detail = gson.fromJson(gson.toJson(obj), JSONObject.class);
|
||||
JSONObject receiptDetail = detail.getJSONObject("receiptDetail");
|
||||
BigDecimal quantity = receiptDetail.getBigDecimal("quantity");//入库数量
|
||||
String erpOrderLineNum = receiptDetail.getString("erpOrderLineNum");//金蝶源头单据细单号
|
||||
if (receiptDetail.getString("erpOrderLineNum").length() > 19) {
|
||||
errormsg = errormsg.append(",").append("Value " + erpOrderLineNum + " is out of range for a Long. Using default value");
|
||||
response.setMessage(errormsg.substring(1));
|
||||
response.setCode("-1");
|
||||
response.setFlag("failure");
|
||||
return CustomApiResult.success(wmsXmlReturn);
|
||||
}
|
||||
DynamicObject isexsit = BusinessDataServiceHelper.loadSingle(erpOrderType, new QFilter[]{new QFilter("billentry.id", QCP.equals, receiptDetail.getLong("erpOrderLineNum"))});
|
||||
if (isexsit == null) {
|
||||
errormsg = errormsg.append(",").append("传入参数 erpOrderLineNum 在金蝶系统中未查询到对应单据");
|
||||
}
|
||||
if (ApiResultExt.validateRequired(quantity, "BigDecimal")) {
|
||||
errormsg = errormsg.append(",").append("传入参数 quantity 为空");
|
||||
}
|
||||
if (ApiResultExt.validateRequired(erpOrderLineNum, "String")) {
|
||||
errormsg = errormsg.append(",").append("传入参数 erpOrderLineNum 为空");
|
||||
}
|
||||
}
|
||||
if (errormsg.length() > 0) {
|
||||
response.setMessage(errormsg.substring(1));
|
||||
response.setCode("-1");
|
||||
response.setFlag("failure");
|
||||
return CustomApiResult.success(wmsXmlReturn);
|
||||
}
|
||||
}
|
||||
//收货通知单
|
||||
if (StringUtils.equals("pm_receiptnotice", erpOrderType)) {
|
||||
//查询单据在金蝶系统中是否存在
|
||||
DynamicObject receiptnotice = BusinessDataServiceHelper.loadSingle(RECEIPTNOTICE, new QFilter[]{new QFilter("billno", QCP.equals, billno)});
|
||||
if (receiptnotice == null) {
|
||||
errormsg = errormsg.append(",").append("根据传入编号:" + billno + "未找到对应收货通知单");
|
||||
response.setMessage(errormsg.substring(1));
|
||||
response.setCode("-1");
|
||||
response.setFlag("failure");
|
||||
return CustomApiResult.success(wmsXmlReturn);
|
||||
}
|
||||
Map<String, Object> param = new HashMap<>();//传入转换规则处理参数
|
||||
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
|
||||
//参数值组装
|
||||
if (details.get("detail") instanceof Map) {
|
||||
JSONObject detail = details.getJSONObject("detail");
|
||||
JSONObject containers = detail.getJSONObject("containers");
|
||||
JSONObject container = containers.getJSONObject("container");
|
||||
JSONObject receiptDetail = detail.getJSONObject("receiptDetail");
|
||||
Long id = receiptnotice.getLong("id");
|
||||
JSONObject detailObject = new JSONObject();
|
||||
JSONObject receiptContainer = container.getJSONObject("receiptContainer");
|
||||
String erpOrderLineNum = receiptDetail.getString("erpOrderLineNum");//金蝶源头单据细单号
|
||||
BigDecimal quantity = receiptDetail.getBigDecimal("quantity");//入库数量
|
||||
String uniqueCode = receiptContainer.getString("itemCode");//商品编码
|
||||
Date manufactureDate = receiptContainer.getDate("created");//生产日期
|
||||
Date expirationDate = receiptContainer.getDate("lastUpdated");//失效期
|
||||
String batch = receiptContainer.getString("batch");//批次
|
||||
String attribute1 = receiptContainer.getString("attribute1");//注册证号
|
||||
String attribute3 = receiptContainer.getString("attribute3");//生产许可证
|
||||
String attribute2 = receiptContainer.getString("attribute2");//生产厂商
|
||||
detailObject.put("entryId", erpOrderLineNum);
|
||||
detailObject.put("uniqueCode", uniqueCode);
|
||||
detailObject.put("quantity", quantity);
|
||||
detailObject.put("manufactureDate", manufactureDate);
|
||||
detailObject.put("expirationDate", expirationDate);
|
||||
detailObject.put("batch", batch);
|
||||
detailObject.put("registrationCode", attribute1);
|
||||
detailObject.put("licenceCode", attribute3);
|
||||
detailObject.put("producer", attribute2);
|
||||
detailObject.put("VoucherType", erpOrderType);
|
||||
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(receiptDetail.getLong("erpOrderLineNum"));
|
||||
param.put(erpOrderLineNum, detailObject);
|
||||
} else {
|
||||
JSONArray detail1 = details.getJSONArray("detail");
|
||||
for (Object obj : detail1) {
|
||||
JSONObject detail = gson.fromJson(gson.toJson(obj), JSONObject.class);
|
||||
JSONObject containers = detail.getJSONObject("containers");
|
||||
JSONObject container = containers.getJSONObject("container");
|
||||
JSONObject receiptDetail = detail.getJSONObject("receiptDetail");
|
||||
Long id = receiptnotice.getLong("id");
|
||||
// Map<String, Object> param = new HashMap<>();//传入转换规则处理参数
|
||||
// HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
|
||||
JSONObject detailObject = new JSONObject();
|
||||
JSONObject receiptContainer = container.getJSONObject("receiptContainer");
|
||||
String erpOrderLineNum = receiptDetail.getString("erpOrderLineNum");//金蝶源头单据细单号
|
||||
BigDecimal quantity = receiptDetail.getBigDecimal("quantity");//入库数量
|
||||
String uniqueCode = receiptContainer.getString("itemCode");//商品编码
|
||||
Date manufactureDate = receiptContainer.getDate("created");//生产日期
|
||||
Date expirationDate = receiptContainer.getDate("lastUpdated");//失效期
|
||||
String batch = receiptContainer.getString("batch");//批次
|
||||
String attribute1 = receiptContainer.getString("attribute1");//注册证号
|
||||
String attribute3 = receiptContainer.getString("attribute3");//生产许可证
|
||||
String attribute2 = receiptContainer.getString("attribute2");//生产厂商
|
||||
detailObject.put("entryId", erpOrderLineNum);
|
||||
detailObject.put("uniqueCode", uniqueCode);
|
||||
detailObject.put("quantity", quantity);
|
||||
detailObject.put("manufactureDate", manufactureDate);
|
||||
detailObject.put("expirationDate", expirationDate);
|
||||
detailObject.put("batch", batch);
|
||||
detailObject.put("registrationCode", attribute1);
|
||||
detailObject.put("licenceCode", attribute3);
|
||||
detailObject.put("producer", attribute2);
|
||||
detailObject.put("VoucherType", erpOrderType);
|
||||
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(receiptDetail.getLong("erpOrderLineNum"));
|
||||
param.put(erpOrderLineNum, detailObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//开始下推
|
||||
String rule = BotpParamUtils.getBotpRuleId(RECEIPTNOTICE, PURINBILL, "收货通知单_采购入库单_转换规则");
|
||||
PushArgs pushArgs = BotpParamUtils.getPushArgs(RECEIPTNOTICE, PURINBILL, BILLENTRY, param, entitypkMap, rule);
|
||||
ConvertOperationResult pushResult = ConvertServiceHelper.pushAndSave(pushArgs);
|
||||
List<SourceBillReport> billReports = pushResult.getBillReports();
|
||||
//下推失败直接返回
|
||||
if (!pushResult.isSuccess()) {
|
||||
for (SourceBillReport billReport : billReports) {
|
||||
String billMessage = billReport.getFailMessage();
|
||||
errormsg = errormsg.append(",").append(billMessage);
|
||||
}
|
||||
response.setMessage(errormsg.substring(1));
|
||||
response.setCode("-1");
|
||||
response.setFlag("failure");
|
||||
return CustomApiResult.success(wmsXmlReturn);
|
||||
}
|
||||
//获取下推单据id准备提交审核操作
|
||||
Set<Object> targetBillIds = pushResult.getTargetBillIds();
|
||||
DynamicObject[] load = new DynamicObject[targetBillIds.size()];
|
||||
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)});
|
||||
load[i] = dynamicObject;
|
||||
}
|
||||
//开始提交
|
||||
OperateOption operateOption = OperateOption.create();
|
||||
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) {
|
||||
String message = iOperateInfo.getMessage();
|
||||
errormsg = errormsg.append(",").append(message);
|
||||
}
|
||||
} else if (StringUtils.isNotBlank(sumbitResult.getMessage())) {
|
||||
errormsg = errormsg.append(",").append(sumbitResult.getMessage());
|
||||
} else {
|
||||
errormsg = errormsg.append(",").append(sumbitResult.getInteractionContext().getSimpleMessage());
|
||||
}
|
||||
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);
|
||||
if (!auditResult.isSuccess()) {
|
||||
List<IOperateInfo> allErrorOrValidateInfo1 = auditResult.getAllErrorOrValidateInfo();
|
||||
if (allErrorOrValidateInfo1.size() != 0) {
|
||||
for (IOperateInfo iOperateInfo : allErrorOrValidateInfo1) {
|
||||
String message = iOperateInfo.getMessage();
|
||||
errormsg = errormsg.append(",").append(message);
|
||||
}
|
||||
} else if (StringUtils.isNotBlank(auditResult.getMessage())) {
|
||||
errormsg = errormsg.append(",").append(sumbitResult.getMessage());
|
||||
} else {
|
||||
errormsg = errormsg.append(",").append(sumbitResult.getInteractionContext().getSimpleMessage());
|
||||
}
|
||||
response.setMessage(errormsg.substring(1));
|
||||
response.setCode("-1");
|
||||
response.setFlag("failure");
|
||||
return CustomApiResult.success(wmsXmlReturn);
|
||||
}
|
||||
}
|
||||
//采购退货单
|
||||
} else if (StringUtils.equals("pm_purrefundapplybill", erpOrderType)) {
|
||||
//查询单据在金蝶系统中是否存在
|
||||
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);
|
||||
}
|
||||
Map<String, Object> param = new HashMap<>();//传入转换规则处理参数
|
||||
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
|
||||
//参数值组装
|
||||
if (details.get("detail") instanceof JSONObject) {
|
||||
JSONObject detail = details.getJSONObject("detail");
|
||||
JSONObject containers = detail.getJSONObject("containers");
|
||||
JSONObject container = containers.getJSONObject("container");
|
||||
JSONObject receiptDetail = detail.getJSONObject("receiptDetail");
|
||||
Long id = pm_purrefundapplybill.getLong("id");
|
||||
JSONObject detailObject = new JSONObject();
|
||||
JSONObject receiptContainer = container.getJSONObject("receiptContainer");
|
||||
String erpOrderLineNum = receiptDetail.getString("erpOrderLineNum");//金蝶源头单据细单号
|
||||
BigDecimal quantity = receiptDetail.getBigDecimal("quantity");//入库数量
|
||||
String uniqueCode = receiptContainer.getString("itemCode");//商品编码
|
||||
Date manufactureDate = receiptContainer.getDate("created");//生产日期
|
||||
Date expirationDate = receiptContainer.getDate("lastUpdated");//失效期
|
||||
String batch = receiptContainer.getString("batch");//批次
|
||||
String attribute1 = receiptContainer.getString("attribute1");//注册证号
|
||||
String attribute3 = receiptContainer.getString("attribute3");//生产许可证
|
||||
String attribute2 = receiptContainer.getString("attribute2");//生产厂商
|
||||
detailObject.put("entryId", erpOrderLineNum);
|
||||
detailObject.put("uniqueCode", uniqueCode);
|
||||
detailObject.put("quantity", quantity);
|
||||
detailObject.put("manufactureDate", manufactureDate);
|
||||
detailObject.put("expirationDate", expirationDate);
|
||||
detailObject.put("batch", batch);
|
||||
detailObject.put("registrationCode", attribute1);
|
||||
detailObject.put("licenceCode", attribute3);
|
||||
detailObject.put("producer", attribute2);
|
||||
detailObject.put("VoucherType", erpOrderType);
|
||||
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(receiptDetail.getLong("erpOrderLineNum"));
|
||||
param.put(erpOrderLineNum, detailObject);
|
||||
} else {
|
||||
JSONArray detail1 = details.getJSONArray("detail");
|
||||
for (Object obj : detail1) {
|
||||
JSONObject detail = gson.fromJson(gson.toJson(obj), JSONObject.class);
|
||||
JSONObject containers = detail.getJSONObject("containers");
|
||||
JSONObject container = containers.getJSONObject("container");
|
||||
JSONObject receiptDetail = detail.getJSONObject("receiptDetail");
|
||||
Long id = pm_purrefundapplybill.getLong("id");
|
||||
JSONObject detailObject = new JSONObject();
|
||||
JSONObject receiptContainer = container.getJSONObject("receiptContainer");
|
||||
String erpOrderLineNum = receiptDetail.getString("erpOrderLineNum");//金蝶源头单据细单号
|
||||
BigDecimal quantity = receiptDetail.getBigDecimal("quantity");//入库数量
|
||||
String uniqueCode = receiptContainer.getString("itemCode");//商品编码
|
||||
Date manufactureDate = receiptContainer.getDate("created");//生产日期
|
||||
Date expirationDate = receiptContainer.getDate("lastUpdated");//失效期
|
||||
String batch = receiptContainer.getString("batch");//批次
|
||||
String attribute1 = receiptContainer.getString("attribute1");//注册证号
|
||||
String attribute3 = receiptContainer.getString("attribute3");//生产许可证
|
||||
String attribute2 = receiptContainer.getString("attribute2");//生产厂商
|
||||
detailObject.put("entryId", erpOrderLineNum);
|
||||
detailObject.put("uniqueCode", uniqueCode);
|
||||
detailObject.put("quantity", quantity);
|
||||
detailObject.put("manufactureDate", manufactureDate);
|
||||
detailObject.put("expirationDate", expirationDate);
|
||||
detailObject.put("batch", batch);
|
||||
detailObject.put("registrationCode", attribute1);
|
||||
detailObject.put("licenceCode", attribute3);
|
||||
detailObject.put("producer", attribute2);
|
||||
detailObject.put("VoucherType", erpOrderType);
|
||||
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(receiptDetail.getLong("erpOrderLineNum"));
|
||||
param.put(erpOrderLineNum, detailObject);
|
||||
}
|
||||
}
|
||||
|
||||
//开始下推
|
||||
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()) {
|
||||
for (SourceBillReport billReport : billReports) {
|
||||
String billMessage = billReport.getFailMessage();
|
||||
errormsg = errormsg.append(",").append(billMessage);
|
||||
}
|
||||
response.setMessage(errormsg.substring(1));
|
||||
response.setCode("-1");
|
||||
response.setFlag("failure");
|
||||
return CustomApiResult.success(wmsXmlReturn);
|
||||
|
||||
}
|
||||
//获取下推单据id准备提交审核操作
|
||||
Set<Object> targetBillIds = pushResult.getTargetBillIds();
|
||||
DynamicObject[] load = new DynamicObject[targetBillIds.size()];
|
||||
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)});
|
||||
load[i] = dynamicObject;
|
||||
}
|
||||
//开始提交
|
||||
OperateOption operateOption = OperateOption.create();
|
||||
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) {
|
||||
String message = iOperateInfo.getMessage();
|
||||
errormsg = errormsg.append(",").append(message);
|
||||
}
|
||||
} else if (StringUtils.isNotBlank(sumbitResult.getMessage())) {
|
||||
errormsg = errormsg.append(",").append(sumbitResult.getMessage());
|
||||
|
||||
} else {
|
||||
errormsg = errormsg.append(",").append(sumbitResult.getInteractionContext().getSimpleMessage());
|
||||
}
|
||||
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);
|
||||
if (!auditResult.isSuccess()) {
|
||||
List<IOperateInfo> allErrorOrValidateInfo1 = auditResult.getAllErrorOrValidateInfo();
|
||||
if (allErrorOrValidateInfo1.size() != 0) {
|
||||
for (IOperateInfo iOperateInfo : allErrorOrValidateInfo1) {
|
||||
String message = iOperateInfo.getMessage();
|
||||
errormsg = errormsg.append(",").append(message);
|
||||
}
|
||||
} else if (StringUtils.isNotBlank(auditResult.getMessage())) {
|
||||
errormsg = errormsg.append(",").append(sumbitResult.getMessage());
|
||||
} else {
|
||||
errormsg = errormsg.append(",").append(sumbitResult.getInteractionContext().getSimpleMessage());
|
||||
}
|
||||
response.setMessage(errormsg.substring(1));
|
||||
response.setCode("-1");
|
||||
response.setFlag("failure");
|
||||
return CustomApiResult.success(wmsXmlReturn);
|
||||
}
|
||||
}
|
||||
//其他入库申请单
|
||||
} else if (StringUtils.equals("tqq9_otherinapply", erpOrderType)) {
|
||||
//查询单据在金蝶系统中是否存在
|
||||
DynamicObject tqq9_otherinapply = BusinessDataServiceHelper.loadSingle(TQQ9_OTHERINAPPLY, new QFilter[]{new QFilter("billno", QCP.equals, billno)});
|
||||
if (tqq9_otherinapply == null) {
|
||||
errormsg = errormsg.append(",").append("根据传入编号:" + billno + "未找到对应其他入库申请单");
|
||||
response.setMessage(errormsg.substring(1));
|
||||
response.setCode("-1");
|
||||
response.setFlag("failure");
|
||||
return CustomApiResult.success(wmsXmlReturn);
|
||||
}
|
||||
Map<String, Object> param = new HashMap<>();//传入转换规则处理参数
|
||||
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
|
||||
//参数值组装
|
||||
if (details.get("detail") instanceof JSONObject) {
|
||||
JSONObject detail = details.getJSONObject("detail");
|
||||
JSONObject containers = detail.getJSONObject("containers");
|
||||
JSONObject container = containers.getJSONObject("container");
|
||||
JSONObject receiptDetail = detail.getJSONObject("receiptDetail");
|
||||
Long id = tqq9_otherinapply.getLong("id");
|
||||
JSONObject detailObject = new JSONObject();
|
||||
JSONObject receiptContainer = container.getJSONObject("receiptContainer");
|
||||
String erpOrderLineNum = receiptDetail.getString("erpOrderLineNum");//金蝶源头单据细单号
|
||||
BigDecimal quantity = receiptDetail.getBigDecimal("quantity");//入库数量
|
||||
String uniqueCode = receiptContainer.getString("itemCode");//商品编码
|
||||
Date manufactureDate = receiptContainer.getDate("created");//生产日期
|
||||
Date expirationDate = receiptContainer.getDate("lastUpdated");//失效期
|
||||
String batch = receiptContainer.getString("batch");//批次
|
||||
String attribute1 = receiptContainer.getString("attribute1");//注册证号
|
||||
String attribute3 = receiptContainer.getString("attribute3");//生产许可证
|
||||
String attribute2 = receiptContainer.getString("attribute2");//生产厂商
|
||||
detailObject.put("entryId", erpOrderLineNum);
|
||||
detailObject.put("uniqueCode", uniqueCode);
|
||||
detailObject.put("quantity", quantity);
|
||||
detailObject.put("manufactureDate", manufactureDate);
|
||||
detailObject.put("expirationDate", expirationDate);
|
||||
detailObject.put("batch", batch);
|
||||
detailObject.put("registrationCode", attribute1);
|
||||
detailObject.put("licenceCode", attribute3);
|
||||
detailObject.put("producer", attribute2);
|
||||
detailObject.put("VoucherType", erpOrderType);
|
||||
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(receiptDetail.getLong("erpOrderLineNum"));
|
||||
param.put(erpOrderLineNum, detailObject);
|
||||
} else {
|
||||
JSONArray detail1 = details.getJSONArray("detail");
|
||||
for (Object obj : detail1) {
|
||||
JSONObject detail = gson.fromJson(gson.toJson(obj), JSONObject.class);
|
||||
JSONObject containers = detail.getJSONObject("containers");
|
||||
JSONObject container = containers.getJSONObject("container");
|
||||
JSONObject receiptDetail = detail.getJSONObject("receiptDetail");
|
||||
Long id = tqq9_otherinapply.getLong("id");
|
||||
JSONObject detailObject = new JSONObject();
|
||||
JSONObject receiptContainer = container.getJSONObject("receiptContainer");
|
||||
String erpOrderLineNum = receiptDetail.getString("erpOrderLineNum");//金蝶源头单据细单号
|
||||
BigDecimal quantity = receiptDetail.getBigDecimal("quantity");//入库数量
|
||||
String uniqueCode = receiptContainer.getString("itemCode");//商品编码
|
||||
Date manufactureDate = receiptContainer.getDate("created");//生产日期
|
||||
Date expirationDate = receiptContainer.getDate("lastUpdated");//失效期
|
||||
String batch = receiptContainer.getString("batch");//批次
|
||||
String attribute1 = receiptContainer.getString("attribute1");//注册证号
|
||||
String attribute3 = receiptContainer.getString("attribute3");//生产许可证
|
||||
String attribute2 = receiptContainer.getString("attribute2");//生产厂商
|
||||
detailObject.put("entryId", erpOrderLineNum);
|
||||
detailObject.put("uniqueCode", uniqueCode);
|
||||
detailObject.put("quantity", quantity);
|
||||
detailObject.put("manufactureDate", manufactureDate);
|
||||
detailObject.put("expirationDate", expirationDate);
|
||||
detailObject.put("batch", batch);
|
||||
detailObject.put("registrationCode", attribute1);
|
||||
detailObject.put("licenceCode", attribute3);
|
||||
detailObject.put("producer", attribute2);
|
||||
detailObject.put("VoucherType", erpOrderType);
|
||||
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(receiptDetail.getLong("erpOrderLineNum"));
|
||||
param.put(erpOrderLineNum, detailObject);
|
||||
}
|
||||
}
|
||||
|
||||
//开始下推
|
||||
String rule = BotpParamUtils.getBotpRuleId(TQQ9_OTHERINAPPLY, IM_OTHERINBILL, "其他入库申请_其他入库_转换规则");
|
||||
PushArgs pushArgs = BotpParamUtils.getPushArgs(TQQ9_OTHERINAPPLY, IM_OTHERINBILL, BILLENTRY, param, entitypkMap, rule);
|
||||
ConvertOperationResult pushResult = ConvertServiceHelper.pushAndSave(pushArgs);
|
||||
List<SourceBillReport> billReports = pushResult.getBillReports();
|
||||
//下推失败直接返回
|
||||
if (!pushResult.isSuccess()) {
|
||||
for (SourceBillReport billReport : billReports) {
|
||||
String billMessage = billReport.getFailMessage();
|
||||
errormsg = errormsg.append(",").append(billMessage);
|
||||
}
|
||||
response.setMessage(errormsg.substring(1));
|
||||
response.setCode("-1");
|
||||
response.setFlag("failure");
|
||||
return CustomApiResult.success(wmsXmlReturn);
|
||||
}
|
||||
//获取下推单据id准备提交审核操作
|
||||
Set<Object> targetBillIds = pushResult.getTargetBillIds();
|
||||
DynamicObject[] load = new DynamicObject[targetBillIds.size()];
|
||||
Iterator<Object> iterator = targetBillIds.iterator();
|
||||
for (int i = 0; iterator.hasNext(); i++) {
|
||||
Object next = iterator.next();
|
||||
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(IM_OTHERINBILL, new QFilter[]{new QFilter("id", QCP.equals, next)});
|
||||
load[i] = dynamicObject;
|
||||
}
|
||||
//开始提交
|
||||
OperateOption operateOption = OperateOption.create();
|
||||
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, IM_OTHERINBILL, load, operateOption);
|
||||
if (!sumbitResult.isSuccess()) {
|
||||
List<IOperateInfo> allErrorOrValidateInfo = sumbitResult.getAllErrorOrValidateInfo();
|
||||
if (allErrorOrValidateInfo.size() != 0) {
|
||||
for (IOperateInfo iOperateInfo : allErrorOrValidateInfo) {
|
||||
String billMessage = iOperateInfo.getMessage();
|
||||
errormsg = errormsg.append(",").append(billMessage);
|
||||
}
|
||||
} else if (StringUtils.isNotBlank(sumbitResult.getMessage())) {
|
||||
errormsg = errormsg.append(",").append(sumbitResult.getMessage());
|
||||
} else {
|
||||
errormsg = errormsg.append(",").append(sumbitResult.getInteractionContext().getSimpleMessage());
|
||||
}
|
||||
response.setMessage(errormsg.substring(1));
|
||||
response.setCode("-1");
|
||||
response.setFlag("failure");
|
||||
return CustomApiResult.success(wmsXmlReturn);
|
||||
|
||||
} else {
|
||||
//开始审核
|
||||
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, IM_OTHERINBILL, load, operateOption);
|
||||
if (!auditResult.isSuccess()) {
|
||||
List<IOperateInfo> allErrorOrValidateInfo1 = auditResult.getAllErrorOrValidateInfo();
|
||||
if (allErrorOrValidateInfo1.size() != 0) {
|
||||
for (IOperateInfo iOperateInfo : allErrorOrValidateInfo1) {
|
||||
String billMessage = iOperateInfo.getMessage();
|
||||
errormsg = errormsg.append(",").append(billMessage);
|
||||
}
|
||||
} else if (StringUtils.isNotBlank(auditResult.getMessage())) {
|
||||
errormsg = errormsg.append(",").append(sumbitResult.getMessage());
|
||||
|
||||
} else {
|
||||
errormsg = errormsg.append(",").append(sumbitResult.getInteractionContext().getSimpleMessage());
|
||||
}
|
||||
response.setMessage(errormsg.substring(1));
|
||||
response.setCode("-1");
|
||||
response.setFlag("failure");
|
||||
return CustomApiResult.success(wmsXmlReturn);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//回传成功
|
||||
return CustomApiResult.success(wmsXmlReturn);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -40,9 +40,6 @@ public class WMSSaleOutCloseController {
|
|||
ApiResultExt resultExt = new ApiResultExt();
|
||||
List<ApiResultExt.ResultBean> results = new ArrayList<>();
|
||||
resultExt.setResult(results);
|
||||
// Gson gson = new Gson();
|
||||
// HashMap<String, Object> data = gson.fromJson(dataString, HashMap.class);
|
||||
// String VoucherType = (String) data.get("VoucherType");//单据类型
|
||||
String billno = cVouCode;//单据编号
|
||||
ApiResultExt.ResultBean resultBean = new ApiResultExt.ResultBean();
|
||||
results.add(resultBean);
|
||||
|
|
@ -188,27 +185,11 @@ public class WMSSaleOutCloseController {
|
|||
resultExt = ApiResultExt.errorRetrun(VoucherType, errormsg, error, resultExt);
|
||||
return CustomApiResult.success(resultExt);
|
||||
}
|
||||
//开始关闭
|
||||
tqq9_otheroutapply.set("tqq9_isclose",true);
|
||||
SaveServiceHelper.save(new DynamicObject[]{tqq9_otheroutapply});
|
||||
//开始关闭
|
||||
// OperateOption operateOption = OperateOption.create();
|
||||
// OperationResult closeResult = OperationServiceHelper.executeOperate(Constants.TYPE_CLOSE, TQQ9_OTHEROUTAPPLY, new DynamicObject[]{tqq9_otheroutapply}, operateOption);
|
||||
// if (!closeResult.isSuccess()) {
|
||||
// List<IOperateInfo> allErrorOrValidateInfo = closeResult.getAllErrorOrValidateInfo();
|
||||
// if (allErrorOrValidateInfo.size() != 0) {
|
||||
// for (IOperateInfo iOperateInfo : allErrorOrValidateInfo) {
|
||||
// HashMap<String, Object> returnMap = resultExt.addErrorToResultBeanByNumber(results, iOperateInfo, TQQ9_OTHEROUTAPPLY);
|
||||
// results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
|
||||
// }
|
||||
// } else if (StringUtils.isNotBlank(closeResult.getMessage())) {
|
||||
// HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, closeResult.getMessage(), TQQ9_OTHEROUTAPPLY);
|
||||
// results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
|
||||
// } else {
|
||||
// HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, closeResult.getInteractionContext().getSimpleMessage(), TQQ9_OTHEROUTAPPLY);
|
||||
// results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
//回传成功
|
||||
int failCount = 0;//失败数量
|
||||
|
|
|
|||
|
|
@ -54,11 +54,7 @@ public class WMSSaleOutController {
|
|||
ApiResultExt resultExt = new ApiResultExt();
|
||||
List<ApiResultExt.ResultBean> results = new ArrayList<>();
|
||||
resultExt.setResult(results);
|
||||
// Gson gson = new Gson();
|
||||
// HashMap<String, Object> data = gson.fromJson(dataString, HashMap.class);
|
||||
// String VoucherType = (String) data.get("VoucherType");//单据类型
|
||||
String billno = erpOrderCode;//单据编号
|
||||
// JSONArray details = (JSONArray) data.get("details");
|
||||
ApiResultExt.ResultBean resultBean = new ApiResultExt.ResultBean();
|
||||
results.add(resultBean);
|
||||
JSONObject key = new JSONObject();
|
||||
|
|
@ -196,7 +192,7 @@ public class WMSSaleOutController {
|
|||
// results.add(resultBean);
|
||||
//开始提交
|
||||
OperateOption operateOption = OperateOption.create();
|
||||
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, SM_DELIVERNOTICE, 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) {
|
||||
|
|
@ -213,7 +209,7 @@ public class WMSSaleOutController {
|
|||
}
|
||||
} else {
|
||||
//开始审核
|
||||
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, SM_DELIVERNOTICE, 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) {
|
||||
|
|
@ -286,20 +282,17 @@ public class WMSSaleOutController {
|
|||
//获取下推单据id准备提交审核操作
|
||||
Set<Object> targetBillIds = pushResult.getTargetBillIds();
|
||||
DynamicObject[] load = new DynamicObject[targetBillIds.size()];
|
||||
HashMap<Object, String> reMap = new HashMap<Object, String>();
|
||||
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)});
|
||||
load[i] = dynamicObject;
|
||||
reMap.put(dynamicObject.get("id"), dynamicObject.getString("billno"));
|
||||
resultBean.setId(next.toString());
|
||||
resultBean.setBillStatus(true);
|
||||
}
|
||||
// results.add(resultBean);
|
||||
//开始提交
|
||||
OperateOption operateOption = OperateOption.create();
|
||||
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, SM_RETURNAPPLY, 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) {
|
||||
|
|
@ -316,7 +309,7 @@ public class WMSSaleOutController {
|
|||
}
|
||||
} else {
|
||||
//开始审核
|
||||
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, SM_RETURNAPPLY, 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) {
|
||||
|
|
@ -413,7 +406,7 @@ public class WMSSaleOutController {
|
|||
// results.add(resultBean);
|
||||
//开始提交
|
||||
OperateOption operateOption = OperateOption.create();
|
||||
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, TQQ9_OTHEROUTAPPLY, load, operateOption);
|
||||
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, IM_OTHEROUTBILL, load, operateOption);
|
||||
if (!sumbitResult.isSuccess()) {
|
||||
List<IOperateInfo> allErrorOrValidateInfo = sumbitResult.getAllErrorOrValidateInfo();
|
||||
if (allErrorOrValidateInfo.size() != 0) {
|
||||
|
|
@ -430,7 +423,7 @@ public class WMSSaleOutController {
|
|||
}
|
||||
} else {
|
||||
//开始审核
|
||||
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, TQQ9_OTHEROUTAPPLY, load, operateOption);
|
||||
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, IM_OTHEROUTBILL, load, operateOption);
|
||||
if (!auditResult.isSuccess()) {
|
||||
List<IOperateInfo> allErrorOrValidateInfo1 = auditResult.getAllErrorOrValidateInfo();
|
||||
if (allErrorOrValidateInfo1.size() != 0) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,77 @@
|
|||
package tqq9.lc123.cloud.app.api.model;
|
||||
|
||||
import kd.bos.openapi.common.custom.annotation.ApiParam;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class WMSXmlReturn implements Serializable {
|
||||
|
||||
@ApiParam("返回结果")
|
||||
private Response response;
|
||||
|
||||
public Response getResponse() {
|
||||
return response;
|
||||
}
|
||||
|
||||
public void setResponse(Response response) {
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static class Response {
|
||||
|
||||
|
||||
@ApiParam("flag")
|
||||
private String flag;
|
||||
|
||||
@ApiParam("code")
|
||||
private String code;
|
||||
|
||||
@ApiParam("message")
|
||||
private String message;
|
||||
|
||||
|
||||
// Getter 和 Setter 方法
|
||||
public String getFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(String flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
// 构建 XML 格式的字符串
|
||||
sb.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||
sb.append("<response>\n");
|
||||
|
||||
sb.append("<flag>").append(flag).append("</flag>\n");
|
||||
sb.append("<code>").append(code).append("</code>\n");
|
||||
sb.append("<message>").append(message).append("</message>\n");
|
||||
|
||||
sb.append("</response>");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package tqq9.lc123.cloud.app.api.plugin;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import kd.bos.openapi.api.plugin.ApiDeserializerPlugin;
|
||||
import tqq9.lc123.cloud.app.plugin.utils.HttpRequestUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class WMSApiDeserializerPlugin implements ApiDeserializerPlugin {
|
||||
@Override
|
||||
public Map<String, Object> deserializer(String request, String contentType) {
|
||||
if(contentType.contains("xml")){
|
||||
JSONObject data = HttpRequestUtils.xmlToJson(request);
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.put("dataMap",data);
|
||||
return dataMap;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package tqq9.lc123.cloud.app.api.plugin;
|
||||
|
||||
import kd.bos.openapi.api.plugin.ApiSerializerPlugin;
|
||||
import kd.bos.openapi.api.plugin.SerializerResult;
|
||||
import kd.bos.openapi.common.result.OpenApiResult;
|
||||
import tqq9.lc123.cloud.app.api.model.WMSXmlReturn;
|
||||
|
||||
public class WMSApiSerializerPlugin implements ApiSerializerPlugin {
|
||||
@Override
|
||||
public SerializerResult serialize(Object response, String accept, String contentTyp){
|
||||
if (contentTyp.contains("xml")) {
|
||||
OpenApiResult openApiResult = (OpenApiResult) response;
|
||||
Object data = openApiResult.getData();
|
||||
if(data!=null){
|
||||
String errorCode = openApiResult.getErrorCode();
|
||||
WMSXmlReturn wmsXmlReturn = (WMSXmlReturn) data;
|
||||
WMSXmlReturn.Response response1 = wmsXmlReturn.getResponse();
|
||||
response1.setCode(errorCode);
|
||||
SerializerResult serializerResult = new SerializerResult(contentTyp,response1.toString());
|
||||
return serializerResult;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -13,10 +13,8 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 采购入库反写批次注册证管理
|
||||
|
|
@ -38,7 +36,8 @@ public class PurInIotManagePlugin extends AbstractOperationServicePlugIn impleme
|
|||
QFilter qFilter = new QFilter("billno", QCP.equals, billno);
|
||||
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle("im_purinbill", qFilter.toArray());
|
||||
DynamicObjectCollection billentry = dynamicObject.getDynamicObjectCollection("billentry");
|
||||
DynamicObject[] tqq9_goodlotmanages=new DynamicObject[billentry.size()];
|
||||
// DynamicObject[] tqq9_goodlotmanages=new DynamicObject[billentry.size()];
|
||||
DynamicObjectCollection tqq9_goodlotmanages = new DynamicObjectCollection();
|
||||
boolean falg = false;
|
||||
for (int i = 0; i < billentry.size(); i++) {
|
||||
DynamicObject entry = billentry.get(i);
|
||||
|
|
@ -69,11 +68,16 @@ public class PurInIotManagePlugin extends AbstractOperationServicePlugIn impleme
|
|||
DynamicObject tqq9_goodlotmanage1 = BusinessDataServiceHelper.loadSingle("tqq9_goodlotmanage", goodlotmanageF.toArray());
|
||||
if (tqq9_goodlotmanage1 == null && StringUtils.isNotBlank(lotnumber)) {
|
||||
falg = true;
|
||||
tqq9_goodlotmanages[i]=tqq9_goodlotmanage;
|
||||
tqq9_goodlotmanages.add(tqq9_goodlotmanage);
|
||||
}
|
||||
}
|
||||
if (falg) {
|
||||
SaveServiceHelper.save(tqq9_goodlotmanages);
|
||||
DynamicObject[] objects = new DynamicObject[tqq9_goodlotmanages.size()];
|
||||
for (int i = 0; i < tqq9_goodlotmanages.size(); i++) {
|
||||
objects[i] = tqq9_goodlotmanages.get(i);
|
||||
}
|
||||
|
||||
SaveServiceHelper.save(objects);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue