diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java index 4d498fcc4..bf100d125 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java @@ -383,11 +383,12 @@ public class SapToLmsServiceImpl implements SapToLmsService { JSONObject json = item.getJSONObject(i); lfart = json.getString("LFART"); JSONObject jsonDtl = new JSONObject(); - if (StrUtil.equals(lfart, "ZLF") || StrUtil.equals(lfart, "ZJS")) { + if (StrUtil.equals(lfart, "ZLF1") || StrUtil.equals(lfart, "ZLF3") || StrUtil.equals(lfart, "ZLF9") || StrUtil.equals(lfart, "ZJS")) { // 生成出库单 + String billType = getBillTypeByLfart(lfart); jsonMst.put("io_type", "1"); - jsonMst.put("buss_type", "1001"); - jsonMst.put("bill_type", "1001"); + jsonMst.put("buss_type", billType); + jsonMst.put("bill_type", billType); jsonMst.put("source_id", json.getLongValue("VBELN")); jsonMst.put("source_name", "交货单"); jsonMst.put("receiver", json.getString("CONSIGNEE")); // 收货人 @@ -502,8 +503,13 @@ public class SapToLmsServiceImpl implements SapToLmsService { box_rows.add(map); } } - // 发货出库 - if (StrUtil.equals(lfart, "ZLF")) { + /* + 发货分配逻辑 + * ZLF9 免费发货单-有价格 + * ZLF3 免费发货单 + * ZLF1 标准发货单 + * */ + if (StrUtil.equals(lfart, "ZLF1") || StrUtil.equals(lfart, "ZLF3") || StrUtil.equals(lfart, "ZLF9")) { jsonMst.put("tableData", tableData); // 调用出库新增并分配 String iostorinv_id = checkOutBillService.insertDtl2(jsonMst); @@ -520,11 +526,15 @@ public class SapToLmsServiceImpl implements SapToLmsService { JSONObject jsonObject = new JSONObject(); jsonObject.put("iostorinv_id", iostorinv_id); } - // 退货入库 - if (StrUtil.equals(lfart, "ZLR")) { + /* + 退货入库 - 1 销售退货单 + 退货入库 - 3 免费退货单 + */ + if (StrUtil.equals(lfart, "ZLR1") || StrUtil.equals(lfart, "ZLR2")) { jsonMst.put("tableData", box_rows); //创建退货入库单 - jsonMst.put("bill_type", "0002"); + String billType = getBillTypeByLfart(lfart); + jsonMst.put("bill_type", billType); jsonMst.put("biz_date", DateUtil.now()); jsonMst.put("bill_status", "10"); rawAssistIStorService.insertDtl(jsonMst); @@ -547,6 +557,48 @@ public class SapToLmsServiceImpl implements SapToLmsService { return result; } + /** + * @description: 根据Sap LFART获取单据类型 + * @author ManMan + * @date: 2026/4/9 14:08 + * 发货(字典值:ST_INV_OUT_TYPE) + * ZLF 1001 发货出库 (旧) + * ZLF1 1013 标准发货 (新) + * ZLF3 1014 无票发货 (新) + * ZLF9 1015 有票发货 (新) + * 退货入库(字典值:ST_INV_IN_TYPE) + * ZLR 0002 退货入库 (旧) + * ZLR1 0013 标准退货 (新) + * ZLR3 0014 免费退货 (新) + **/ + public String getBillTypeByLfart(String code){ + String billType = ""; + switch (code){ + case "ZLF1": + billType = "1013"; + break; + case "ZLF3": + billType = "1014"; + break; + case "ZLF9": + billType = "1015"; + break; + case "ZLR1": + billType = "0013"; + break; + case "ZLR2": + billType = "0014"; + break; + default: + if(code.contains("ZLR")){ + billType = "0002"; + } + if (code.contains("ZLF")){ + billType = "1001"; + } + } + return billType; + } @Override public JSONObject getReturnDeliveryInfo(JSONObject jo) {