feat(sap): 扩展SAP单据类型支持新业务场景
- 支持新的发货单类型ZLF1、ZLF3、ZLF9替代原有的ZLF类型 - 支持新的退货单类型ZLR1、ZLR2替代原有的ZLR类型 - 新增getBillTypeByLfart方法根据SAP LFART字段动态获取单据类型 - 更新出库单生成逻辑使用动态单据类型配置 - 优化发货分配逻辑支持多种免费发货单场景 - 完善退货入库流程适配新的单据类型规则
This commit is contained in:
@@ -383,11 +383,12 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
|||||||
JSONObject json = item.getJSONObject(i);
|
JSONObject json = item.getJSONObject(i);
|
||||||
lfart = json.getString("LFART");
|
lfart = json.getString("LFART");
|
||||||
JSONObject jsonDtl = new JSONObject();
|
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("io_type", "1");
|
||||||
jsonMst.put("buss_type", "1001");
|
jsonMst.put("buss_type", billType);
|
||||||
jsonMst.put("bill_type", "1001");
|
jsonMst.put("bill_type", billType);
|
||||||
jsonMst.put("source_id", json.getLongValue("VBELN"));
|
jsonMst.put("source_id", json.getLongValue("VBELN"));
|
||||||
jsonMst.put("source_name", "交货单");
|
jsonMst.put("source_name", "交货单");
|
||||||
jsonMst.put("receiver", json.getString("CONSIGNEE")); // 收货人
|
jsonMst.put("receiver", json.getString("CONSIGNEE")); // 收货人
|
||||||
@@ -502,8 +503,13 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
|||||||
box_rows.add(map);
|
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);
|
jsonMst.put("tableData", tableData);
|
||||||
// 调用出库新增并分配
|
// 调用出库新增并分配
|
||||||
String iostorinv_id = checkOutBillService.insertDtl2(jsonMst);
|
String iostorinv_id = checkOutBillService.insertDtl2(jsonMst);
|
||||||
@@ -520,11 +526,15 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
|||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("iostorinv_id", iostorinv_id);
|
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("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("biz_date", DateUtil.now());
|
||||||
jsonMst.put("bill_status", "10");
|
jsonMst.put("bill_status", "10");
|
||||||
rawAssistIStorService.insertDtl(jsonMst);
|
rawAssistIStorService.insertDtl(jsonMst);
|
||||||
@@ -547,6 +557,48 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
|||||||
return result;
|
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
|
@Override
|
||||||
public JSONObject getReturnDeliveryInfo(JSONObject jo) {
|
public JSONObject getReturnDeliveryInfo(JSONObject jo) {
|
||||||
|
|||||||
Reference in New Issue
Block a user