WMS单据类型映射

This commit is contained in:
龚豆豆 2025-10-10 12:22:01 +08:00
parent bf797cafe5
commit d390ae99d4
5 changed files with 128 additions and 7 deletions

View File

@ -41,6 +41,30 @@ public class WMSPurInController {
private static String PM_PURREFUNDAPPLYBILL = "pm_purrefundapplybill";//采购退货申请单
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>() {{
put("采购订单", "pm_receiptnotice");
put("其他入库单", "tqq9_otherinapply");
put("销售退货单", "sm_returnapply");
put("调拨入库单", "tqq9_otherinapply");
put("采购退货单", "pm_purrefundapplybill");
put("销售订单", "sm_delivernotice");
put("其他出库单", "tqq9_otheroutapply");
put("调拨出库单", "tqq9_otheroutapply");
put("PTCK", "sm_delivernotice");
put("CGTH", "pm_purrefundapplybill");
put("DBCK", "tqq9_otheroutapply");
put("PKCK", "tqq9_otheroutapply");
put("TZCK", "tqq9_otheroutapply");
put("YPCK", "tqq9_otheroutapply");
put("BSCK", "tqq9_otheroutapply");
put("GQCK", "tqq9_otheroutapply");
put("CGRK", "pm_receiptnotice");
put("DBRK", "tqq9_otherinapply");
put("THRK", "sm_returnapply");
put("ZPRK", "tqq9_otherinapply");
put("PYRK", "tqq9_otherinapply");
put("TZRK", "tqq9_otherinapply");
}};
@ApiPostMapping(value = "/WMSPushPurIn", desc = "WMS-入库回传")
public CustomApiResult<ApiResultExt> WMS_PurInPush
@ -73,6 +97,7 @@ public class WMSPurInController {
resultBean.setType(Constants.TYPE_PUSH);
//判断回传类型
VoucherType=billTypeMap.get(VoucherType);
String entityType = "";
switch (VoucherType) {
case "pm_receiptnotice":
@ -463,6 +488,7 @@ public class WMSPurInController {
JSONObject entryOrder = request.getJSONObject("entryOrder");
String billno = entryOrder.getString("entryOrderCode");
String entryOrderType = entryOrder.getString("entryOrderType");
entryOrderType=billTypeMap.get(entryOrderType);
JSONObject orderLines = request.getJSONObject("orderLines");
WMSXmlReturn wmsXmlReturn = new WMSXmlReturn();
WMSXmlReturn.Response response = new WMSXmlReturn.Response();

View File

@ -32,7 +32,30 @@ 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 final static HashMap<String, String> billTypeMap = new HashMap<String, String>() {{
put("采购订单", "pm_receiptnotice");
put("其他入库单", "tqq9_otherinapply");
put("销售退货单", "sm_returnapply");
put("调拨入库单", "tqq9_otherinapply");
put("采购退货单", "pm_purrefundapplybill");
put("销售订单", "sm_delivernotice");
put("其他出库单", "tqq9_otheroutapply");
put("调拨出库单", "tqq9_otheroutapply");
put("PTCK", "sm_delivernotice");
put("CGTH", "pm_purrefundapplybill");
put("DBCK", "tqq9_otheroutapply");
put("PKCK", "tqq9_otheroutapply");
put("TZCK", "tqq9_otheroutapply");
put("YPCK", "tqq9_otheroutapply");
put("BSCK", "tqq9_otheroutapply");
put("GQCK", "tqq9_otheroutapply");
put("CGRK", "pm_receiptnotice");
put("DBRK", "tqq9_otherinapply");
put("THRK", "sm_returnapply");
put("ZPRK", "tqq9_otherinapply");
put("PYRK", "tqq9_otherinapply");
put("TZRK", "tqq9_otherinapply");
}};
@ApiPostMapping(value = "/WMSSaleOutClose", desc = "WMS-出库关闭")
public CustomApiResult<ApiResultExt> WMSSaleOutClose
(
@ -63,6 +86,7 @@ public class WMSSaleOutCloseController {
//必填项校验
VoucherType=billTypeMap.get(VoucherType);
if (ApiResultExt.validateRequired(VoucherType, "String")) {
errormsg = "传入参数 VoucherType 为空";
resultExt = ApiResultExt.errorRetrun(VoucherType, errormsg, error, resultExt);
@ -214,6 +238,7 @@ public class WMSSaleOutCloseController {
JSONObject request = data.getJSONObject("request");
String billno = request.getString("orderCode");
String orderType = request.getString("orderType");
orderType=billTypeMap.get(orderType);
WMSXmlReturn wmsXmlReturn = new WMSXmlReturn();
WMSXmlReturn.Response response = new WMSXmlReturn.Response();
wmsXmlReturn.setResponse(response);

View File

@ -43,6 +43,31 @@ public class WMSSaleOutController {
private static String TQQ9_OTHEROUTAPPLY = "tqq9_otheroutapply";//其他出库申请
private static String IM_OTHEROUTBILL = "im_otheroutbill";//其他出库
private final static HashMap<String, String> billTypeMap = new HashMap<String, String>() {{
put("采购订单", "pm_receiptnotice");
put("其他入库单", "tqq9_otherinapply");
put("销售退货单", "sm_returnapply");
put("调拨入库单", "tqq9_otherinapply");
put("采购退货单", "pm_purrefundapplybill");
put("销售订单", "sm_delivernotice");
put("其他出库单", "tqq9_otheroutapply");
put("调拨出库单", "tqq9_otheroutapply");
put("PTCK", "sm_delivernotice");
put("CGTH", "pm_purrefundapplybill");
put("DBCK", "tqq9_otheroutapply");
put("PKCK", "tqq9_otheroutapply");
put("TZCK", "tqq9_otheroutapply");
put("YPCK", "tqq9_otheroutapply");
put("BSCK", "tqq9_otheroutapply");
put("GQCK", "tqq9_otheroutapply");
put("CGRK", "pm_receiptnotice");
put("DBRK", "tqq9_otherinapply");
put("THRK", "sm_returnapply");
put("ZPRK", "tqq9_otherinapply");
put("PYRK", "tqq9_otherinapply");
put("TZRK", "tqq9_otherinapply");
}};
@ApiPostMapping(value = "/WMS_SaleOutnPush", desc = "WMS-出库回传")
public CustomApiResult<ApiResultExt> WMS_SaleOutnPush
(
@ -72,6 +97,7 @@ public class WMSSaleOutController {
resultBean.setNumber(billno);
resultBean.setType(Constants.TYPE_PUSH);
//判断回传类型
VoucherType=billTypeMap.get(VoucherType);
String entityType = "";
switch (VoucherType) {
case "sm_delivernotice":
@ -462,6 +488,7 @@ public class WMSSaleOutController {
JSONObject deliveryOrder = request.getJSONObject("deliveryOrder");
String billno = deliveryOrder.getString("deliveryOrderCode");
String orderType = deliveryOrder.getString("orderType");
orderType=billTypeMap.get(orderType);
JSONObject orderLines = request.getJSONObject("orderLines");
WMSXmlReturn wmsXmlReturn = new WMSXmlReturn();
WMSXmlReturn.Response response = new WMSXmlReturn.Response();

View File

@ -41,7 +41,6 @@ public class PurOrderBillRebatePlugin extends AbstractOperationServicePlugIn imp
String operationKey = e.getOperationKey();
if (StringUtils.equals("save",operationKey)) {
for (DynamicObject dataEntity : e.getDataEntities()) {
DynamicObject supplier = dataEntity.getDynamicObject("supplier");//供应商
DynamicObject org = dataEntity.getDynamicObject("org");//组织
BigDecimal tqq9_hshfsyje = dataEntity.getBigDecimal("tqq9_hshfsyje");//含税货返使用金额
@ -49,7 +48,7 @@ public class PurOrderBillRebatePlugin extends AbstractOperationServicePlugIn imp
if(tqq9_hshfsyje.compareTo(BigDecimal.ZERO)>0){
DynamicObject tqq9_hshfsysl = dataEntity.getDynamicObject("tqq9_hshfsysl");//含税货返使用税率
BigDecimal taxrate = tqq9_hshfsysl.getBigDecimal("taxrate");
BigDecimal taxamount = tqq9_hshfsyje.multiply(taxrate.divide(new BigDecimal(100)));//税额
BigDecimal taxamount = tqq9_hshfsyje.multiply(taxrate.divide(new BigDecimal(100).add(taxrate)));//税额
HashMap<String,Object> bodyMap =new HashMap<>();
bodyMap.put("supplierId",supplier.getString("number"));
bodyMap.put("companyId",org.getString("number"));
@ -66,11 +65,56 @@ public class PurOrderBillRebatePlugin extends AbstractOperationServicePlugIn imp
}else if(tqq9_hsxfsyje.compareTo(BigDecimal.ZERO)>0){
DynamicObject tqq9_hsxfsysl = dataEntity.getDynamicObject("tqq9_hsxfsysl");//含税现返使用税率
BigDecimal taxrate = tqq9_hsxfsysl.getBigDecimal("taxrate");
BigDecimal taxamount = tqq9_hsxfsyje.multiply(taxrate.divide(new BigDecimal(100)));//税额
BigDecimal taxamount = tqq9_hsxfsyje.multiply(taxrate.divide(new BigDecimal(100).add(taxrate)));//税额
HashMap<String,Object> bodyMap =new HashMap<>();
bodyMap.put("supplierId",supplier.getString("number"));
bodyMap.put("companyId",org.getString("number"));
bodyMap.put("type",1);
bodyMap.put("money",tqq9_hsxfsyje);
bodyMap.put("taxAmount",taxamount);
Gson gson = new Gson();
try {
String bodyString = HttpRequestUtils.postJson(URL, bodyMap.toString(), tokenMap);
HashMap map = gson.fromJson(bodyString, HashMap.class);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
}
}else if(StringUtils.equals("delete",operationKey)){
for (DynamicObject dataEntity : e.getDataEntities()) {
DynamicObject supplier = dataEntity.getDynamicObject("supplier");//供应商
DynamicObject org = dataEntity.getDynamicObject("org");//组织
BigDecimal tqq9_hshfsyje = dataEntity.getBigDecimal("tqq9_hshfsyje");//含税货返使用金额
BigDecimal tqq9_hsxfsyje = dataEntity.getBigDecimal("tqq9_hsxfsyje");//含税现返使用金额
if(tqq9_hshfsyje.compareTo(BigDecimal.ZERO)>0){
DynamicObject tqq9_hshfsysl = dataEntity.getDynamicObject("tqq9_hshfsysl");//含税货返使用税率
BigDecimal taxrate = tqq9_hshfsysl.getBigDecimal("taxrate");
BigDecimal taxamount = tqq9_hshfsyje.multiply(taxrate.divide(new BigDecimal(100).add(taxrate)));//税额
HashMap<String,Object> bodyMap =new HashMap<>();
bodyMap.put("supplierId",supplier.getString("number"));
bodyMap.put("companyId",org.getString("number"));
bodyMap.put("type",0);
bodyMap.put("money",tqq9_hshfsyje);
bodyMap.put("taxAmount",taxamount);
Gson gson = new Gson();
try {
String bodyString = HttpRequestUtils.postJson(URL, bodyMap.toString(), tokenMap);
HashMap map = gson.fromJson(bodyString, HashMap.class);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}else if(tqq9_hsxfsyje.compareTo(BigDecimal.ZERO)>0){
DynamicObject tqq9_hsxfsysl = dataEntity.getDynamicObject("tqq9_hsxfsysl");//含税现返使用税率
BigDecimal taxrate = tqq9_hsxfsysl.getBigDecimal("taxrate");
BigDecimal taxamount = tqq9_hsxfsyje.multiply(taxrate.divide(new BigDecimal(100).add(taxrate)));//税额
HashMap<String,Object> bodyMap =new HashMap<>();
bodyMap.put("supplierId",supplier.getString("number"));
bodyMap.put("companyId",org.getString("number"));
bodyMap.put("type",1);
bodyMap.put("money",tqq9_hsxfsyje);
bodyMap.put("taxAmount",taxamount);
Gson gson = new Gson();

View File

@ -1,6 +1,5 @@
package tqq9.lc123.cloud.app.plugin.operate.sys;
import com.grapecity.documents.excel.B;
import kd.bos.dataentity.OperateOption;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.operate.result.IOperateInfo;
@ -9,7 +8,7 @@ import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.args.AfterOperationArgs;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.fi.cas.helper.OperateServiceHelper;
import kd.bos.servicehelper.operation.OperationServiceHelper;
import java.math.BigDecimal;
import java.util.List;
@ -87,7 +86,7 @@ public class MaterialAuditOp extends AbstractOperationServicePlugIn {
goods.set("tqq9_skutype4", material.getString("tqq9_spfliii"));
goods.set("tqq9_isauto", true);
goods.set("enable", "1");
OperationResult operationResult1 = OperateServiceHelper.executeOperate("save", "tqq9_goodspackage", new DynamicObject[]{goods}, OperateOption.create());
OperationResult operationResult1 = OperationServiceHelper.executeOperate("save", "tqq9_goodspackage", new DynamicObject[]{goods}, OperateOption.create());
if(!operationResult1.isSuccess()){
List<IOperateInfo> allErrorOrValidateInfo = operationResult1.getAllErrorOrValidateInfo();
for (IOperateInfo iOperateInfo : allErrorOrValidateInfo) {