fix:交货单优化
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
| 目录/文件 | 说明 |
|
||||
|-----------|------|
|
||||
| `api/SapApi.java` | SAP HTTP 调用(MM054 收货确认、MM057 物料转储、MM064 委外交货确认、PP066 生产入库等) |
|
||||
| `api/SapApi.java` | SAP HTTP 调用(MM054 收货确认、MM057 物料转储、MM064 委外交货确认、PP066 生产入库、MDG004 供应商查询等) |
|
||||
| `api/dto/` | SAP 接口请求/响应 DTO |
|
||||
| `controller/SapSyncController.java` | SAP → WMS 同步入口(`/wms/sap_services/maintain/*`) |
|
||||
| `enums/SapConstant.java` | SAP 接口常量 |
|
||||
@@ -32,6 +32,17 @@
|
||||
- 字段映射:`matnr→material_code`、`maktx→material_name`、`atwrt→material_spec`、`meins→qty_unit_name`(并按 `unit_code` 反查 `qty_unit_id`)。
|
||||
|
||||
|
||||
## SAP 供应商主数据查询(MDG004,WMS 主动拉取)
|
||||
|
||||
| 接口 | 说明 | 实现 |
|
||||
|------|------|------|
|
||||
| `SapApi#supplierQuery(partner)` | 按供应商编码查询供应商名称 | `ext_manage.sap.service.SapSupplierQueryService` |
|
||||
|
||||
- 请求:`header.intf_id=MDG004`、`src_system=SRM`、`dest_system=sap`;`body[0].PARTNER` 填供应商编码,其余字段按约定留空。
|
||||
- 响应:`body[].name_org1`(其次 `bu_sort1`、`name_org2`)为供应商名称;`partner` 会补前导零(`500178` → `0000500178`),比对时归一化。
|
||||
- 该接口仅用于展示类字段(如交货单供应商名称),超时 10s,查询失败回退本地 `md_cs_supplierbase`,仍取不到则留空且不阻断主流程;结果进程内缓存。
|
||||
|
||||
|
||||
## 业务模块位置
|
||||
|
||||
业务 CRUD、下推、回传策略等均在 `org.nl.wms.pm_manage.sap` 下:
|
||||
@@ -44,6 +55,15 @@
|
||||
|
||||
详细接口文档见各业务模块下的 `READ.MD`。
|
||||
|
||||
### SAP 交货单(MM054 收货确认)
|
||||
|
||||
- 同步:`POST /wms/sap_services/maintain/insertSapJhd`,落 `sap_delivery_order` / `sap_delivery_item`;
|
||||
同步时按 `lifnr` 调 MDG004 取供应商名称写入 `lifnr_name`(取不到留空,不阻断同步)。
|
||||
- 页面 `wms/pm_manage/sap/sapDelivery/index`:
|
||||
- 修改单据仅允许调整明细「存储地点」或删除明细行,其余字段只读;
|
||||
- 收货确认弹窗可勾选「批量修改存储地点」,选定仓库后:所选交货单全部明细的 `lgort` 更新为该仓库,
|
||||
并按该存储地点组装 MM054(`POST /api/sapDelivery/confirmReceipt`,body `{vbelns:[...], lgort:"H002"}`,`lgort` 为空则按明细原存储地点)。
|
||||
|
||||
### SAP 部门领料出库(PP113 → PP055)
|
||||
|
||||
- 同步:`POST /wms/sap_services/maintain/insertSapLld`,报文为 `header + body[]`(行项目扁平列表),
|
||||
|
||||
@@ -106,6 +106,53 @@ public class SapApi {
|
||||
return postQuery("SAP库存查询[" + SapConstant.INTF_MM027 + "]", buildStockQueryRequest(matnr, werks, lgort));
|
||||
}
|
||||
|
||||
/**
|
||||
* MDG004 供应商主数据查询(按供应商编码,返回体与写入类接口一致,body 为数组)
|
||||
*
|
||||
* @param partner 供应商编码
|
||||
*/
|
||||
public JSONObject supplierQuery(String partner) {
|
||||
// 供应商名称只用于单据展示,超时时间不宜过长,避免阻塞交货单同步
|
||||
return postQuery("SAP供应商查询[" + SapConstant.INTF_MDG004 + "]", buildSupplierQueryRequest(partner), 10000);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建 MDG004 供应商查询请求,除 PARTNER 外其余字段按接口约定固定为空
|
||||
*/
|
||||
private JSONObject buildSupplierQueryRequest(String partner) {
|
||||
JSONObject header = new JSONObject();
|
||||
header.put("intf_id", SapConstant.INTF_MDG004);
|
||||
header.put("src_system", SapConstant.SRC_SYSTEM);
|
||||
header.put("dest_system", SapConstant.DEST_SYSTEM);
|
||||
header.put("src_msgid", "wsx");
|
||||
header.put("requesttime", "");
|
||||
header.put("backup1", "1");
|
||||
header.put("backup2", "2");
|
||||
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("PARTNER", StrUtil.blankToDefault(partner, "").trim());
|
||||
item.put("TAXNUM", "");
|
||||
item.put("CRDAT", "");
|
||||
item.put("CRTIM", "");
|
||||
item.put("CHDAT", "");
|
||||
item.put("CHTIM", "");
|
||||
item.put("ZRSV03", "");
|
||||
item.put("ZRSV04", "");
|
||||
item.put("ZRSV05", "");
|
||||
item.put("ZRSV06", "");
|
||||
item.put("ZRSV07", "");
|
||||
item.put("PAGE", " ");
|
||||
item.put("COUNT", " ");
|
||||
|
||||
JSONArray body = new JSONArray();
|
||||
body.add(item);
|
||||
|
||||
JSONObject request = new JSONObject();
|
||||
request.put("header", header);
|
||||
request.put("body", body);
|
||||
return request;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建 MM027 库存查询请求。除物料、工厂、仓库外,其余字段按接口约定固定。
|
||||
*/
|
||||
@@ -138,14 +185,20 @@ public class SapApi {
|
||||
return request;
|
||||
}
|
||||
private JSONObject postQuery(String bizLabel, Object request) {
|
||||
return postQuery(bizLabel, request, -1);
|
||||
}
|
||||
|
||||
private JSONObject postQuery(String bizLabel, Object request, int timeoutMillis) {
|
||||
String param = request instanceof String ? (String) request : JSON.toJSONString(request);
|
||||
log.info("{}请求:{}", bizLabel, param);
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(SAP_INBOUND_URL)
|
||||
HttpRequest httpRequest = HttpRequest.post(SAP_INBOUND_URL)
|
||||
.basicAuth(BASIC_AUTH_USER, BASIC_AUTH_PASSWORD)
|
||||
.body(param)
|
||||
.execute()
|
||||
.body();
|
||||
.body(param);
|
||||
if (timeoutMillis > 0) {
|
||||
httpRequest.timeout(timeoutMillis);
|
||||
}
|
||||
String resultMsg = httpRequest.execute().body();
|
||||
log.info("{}响应:{}", bizLabel, resultMsg);
|
||||
if (!StringUtils.hasText(resultMsg)) {
|
||||
return null;
|
||||
|
||||
@@ -36,7 +36,7 @@ public class SapSyncController {
|
||||
private final SapBillFeedbackService sapBillFeedbackService;
|
||||
|
||||
@PostMapping("/insertSapJhd")
|
||||
@Log("SAP收货单同步-收货确认后生成物料凭证insertSapRkd用于出入库-做完不回传")
|
||||
@Log("SAP交货单同步-收货确认后生成物料凭证insertSapRkd用于出入库-做完不回传")
|
||||
public ResponseEntity<Object> insertSapJhd(@RequestBody DeliveryOrderDTO deliveryOrderDTO) {
|
||||
JSONObject result = sapDeliveryService.insertSapJhd(deliveryOrderDTO);
|
||||
return ResponseData.build(result, HttpStatus.OK);
|
||||
|
||||
@@ -42,6 +42,9 @@ public class SapConstant {
|
||||
/** 接口编号:物料主数据查询(SAP → WMS 物料同步) */
|
||||
public static final String INTF_MDG012 = "MDG012";
|
||||
|
||||
/** 接口编号:供应商主数据查询(按供应商编码查名称) */
|
||||
public static final String INTF_MDG004 = "MDG004";
|
||||
|
||||
/** 物料查询同步来源系统 */
|
||||
public static final String MATERIAL_QUERY_SRC_SYSTEM = "WMS";
|
||||
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
package org.nl.wms.ext_manage.sap.service;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.basedata_manage.service.IMdCsSupplierbaseService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdCsSupplierbase;
|
||||
import org.nl.wms.ext_manage.sap.api.SapApi;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 供应商名称查询:按供应商编码调用 SAP MDG004 取名称,查询失败时回退本地供应商主数据。
|
||||
* <p>
|
||||
* 供应商名称只用于单据展示,查询失败不阻断主流程(返回 null,由调用方决定是否留空)。
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SapSupplierQueryService {
|
||||
|
||||
/** 供应商编码 → 名称缓存,供应商名称变更频率极低,进程内缓存即可 */
|
||||
private static final Map<String, String> NAME_CACHE = new ConcurrentHashMap<>();
|
||||
|
||||
private final SapApi sapApi;
|
||||
private final IMdCsSupplierbaseService supplierbaseService;
|
||||
|
||||
/**
|
||||
* 按供应商编码获取供应商名称,取不到返回 null
|
||||
*/
|
||||
public String getSupplierName(String lifnr) {
|
||||
if (StrUtil.isBlank(lifnr)) {
|
||||
return null;
|
||||
}
|
||||
String code = lifnr.trim();
|
||||
String cached = NAME_CACHE.get(code);
|
||||
if (StrUtil.isNotBlank(cached)) {
|
||||
return cached;
|
||||
}
|
||||
String name = queryFromSap(code);
|
||||
if (StrUtil.isBlank(name)) {
|
||||
name = queryFromLocal(code);
|
||||
}
|
||||
if (StrUtil.isNotBlank(name)) {
|
||||
NAME_CACHE.put(code, name);
|
||||
return name;
|
||||
}
|
||||
log.warn("供应商{}名称获取失败,MDG004与本地供应商主数据均未查到", code);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用 MDG004 查询供应商名称
|
||||
*/
|
||||
private String queryFromSap(String code) {
|
||||
JSONObject result;
|
||||
try {
|
||||
result = sapApi.supplierQuery(code);
|
||||
} catch (Exception e) {
|
||||
log.warn("MDG004查询供应商{}失败:{}", code, e.getMessage());
|
||||
return null;
|
||||
}
|
||||
if (result == null) {
|
||||
return null;
|
||||
}
|
||||
String msgty = StrUtil.trim(result.getString("msgty"));
|
||||
// 查询类接口 body 可能是数组(MDG004 示例)也可能是对象,两种都兼容
|
||||
Object bodyValue = result.get("body");
|
||||
JSONArray body = null;
|
||||
if (bodyValue instanceof JSONArray) {
|
||||
body = (JSONArray) bodyValue;
|
||||
} else if (bodyValue instanceof JSONObject) {
|
||||
body = new JSONArray();
|
||||
body.add(bodyValue);
|
||||
}
|
||||
if (body == null || body.isEmpty()) {
|
||||
if ("E".equalsIgnoreCase(msgty)) {
|
||||
log.warn("MDG004查询供应商{}失败:{}", code, StrUtil.blankToDefault(result.getString("msgtx"), "接口返回为空"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < body.size(); i++) {
|
||||
JSONObject supplier = body.getJSONObject(i);
|
||||
if (supplier == null) {
|
||||
continue;
|
||||
}
|
||||
// SAP 返回的 partner 会补前导零(500178 → 0000500178),需归一化后比对;只有一条时直接取用
|
||||
String partner = supplier.getString("partner");
|
||||
if (body.size() > 1 && StrUtil.isNotBlank(partner) && !samePartner(partner, code)) {
|
||||
continue;
|
||||
}
|
||||
String name = resolveName(supplier);
|
||||
if (StrUtil.isNotBlank(name)) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 回退本地供应商主数据表
|
||||
*/
|
||||
private String queryFromLocal(String code) {
|
||||
try {
|
||||
MdCsSupplierbase supplier = supplierbaseService.getOne(new LambdaQueryWrapper<MdCsSupplierbase>()
|
||||
.eq(MdCsSupplierbase::getSupp_code, code)
|
||||
.last("LIMIT 1"), false);
|
||||
if (supplier != null && StrUtil.isNotBlank(supplier.getSupp_name())) {
|
||||
return supplier.getSupp_name().trim();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("本地供应商主数据查询{}失败:{}", code, e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 供应商名称:优先 name_org1,其次 bu_sort1、name_org2
|
||||
*/
|
||||
private String resolveName(JSONObject supplier) {
|
||||
String name = StrUtil.trim(supplier.getString("name_org1"));
|
||||
if (StrUtil.isNotBlank(name)) {
|
||||
return name;
|
||||
}
|
||||
name = StrUtil.trim(supplier.getString("bu_sort1"));
|
||||
if (StrUtil.isNotBlank(name)) {
|
||||
return name;
|
||||
}
|
||||
return StrUtil.trim(supplier.getString("name_org2"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 供应商编码比对,忽略前导零差异
|
||||
*/
|
||||
private boolean samePartner(String partner, String code) {
|
||||
String left = StrUtil.trim(partner);
|
||||
String right = StrUtil.trim(code);
|
||||
if (StrUtil.equals(left, right)) {
|
||||
return true;
|
||||
}
|
||||
return StrUtil.equals(stripLeadingZeros(left), stripLeadingZeros(right));
|
||||
}
|
||||
|
||||
private String stripLeadingZeros(String value) {
|
||||
String result = value == null ? "" : value.replaceFirst("^0+", "");
|
||||
return result.isEmpty() ? "0" : result;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.pm_manage.sap.sapDelivery.service.SapDeliveryService;
|
||||
import org.nl.wms.pm_manage.sap.sapDelivery.service.dto.SapDeliveryConfirmDto;
|
||||
import org.nl.wms.pm_manage.sap.sapDelivery.service.dto.SapDeliveryOrderDto;
|
||||
import org.nl.wms.pm_manage.sap.sapDelivery.service.dto.SapDeliveryQuery;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -68,15 +69,17 @@ public class SapDeliveryController {
|
||||
@PostMapping("/confirmReceipt")
|
||||
@Log("SAP交货单收货确认")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> confirmReceipt(@RequestBody List<String> vbelns) {
|
||||
if (CollectionUtils.isEmpty(vbelns)) {
|
||||
public ResponseEntity<Object> confirmReceipt(@RequestBody SapDeliveryConfirmDto dto) {
|
||||
if (dto == null || CollectionUtils.isEmpty(dto.getVbelns())) {
|
||||
throw new BadRequestException("收货确认失败:未选择交货单");
|
||||
}
|
||||
List<String> vbelns = dto.getVbelns();
|
||||
String lgort = dto.getLgort() == null ? null : dto.getLgort().trim();
|
||||
List<String> success = new ArrayList<>();
|
||||
List<String> failed = new ArrayList<>();
|
||||
for (String vbeln : vbelns) {
|
||||
try {
|
||||
sapDeliveryService.confirmReceipt(vbeln);
|
||||
sapDeliveryService.confirmReceipt(vbeln, lgort);
|
||||
success.add(vbeln);
|
||||
} catch (Exception e) {
|
||||
log.error("交货单{}收货确认失败", vbeln, e);
|
||||
|
||||
@@ -18,6 +18,11 @@ public interface SapDeliveryService {
|
||||
|
||||
JSONObject confirmReceipt(String vbeln);
|
||||
|
||||
/**
|
||||
* 收货确认,可指定本次收货统一使用的存储地点(为空则按单据明细原存储地点)
|
||||
*/
|
||||
JSONObject confirmReceipt(String vbeln, String lgort);
|
||||
|
||||
IPage<SapDeliveryOrder> queryPage(SapDeliveryQuery query, PageQuery page);
|
||||
|
||||
SapDeliveryOrderDto getDetail(String vbeln);
|
||||
|
||||
@@ -24,6 +24,9 @@ public class SapDeliveryOrder implements Serializable {
|
||||
|
||||
private String lifnr;
|
||||
|
||||
/** 供应商名称:同步时按供应商编码调 MDG004 获取 */
|
||||
private String lifnr_name;
|
||||
|
||||
private String wadat;
|
||||
|
||||
private String lfdat;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.nl.wms.pm_manage.sap.sapDelivery.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 交货单收货确认入参
|
||||
*/
|
||||
@Data
|
||||
public class SapDeliveryConfirmDto {
|
||||
|
||||
/** 交货单号集合 */
|
||||
private List<String> vbelns;
|
||||
|
||||
/** 批量指定的存储地点,为空则按单据明细原存储地点收货 */
|
||||
private String lgort;
|
||||
}
|
||||
@@ -17,6 +17,9 @@ public class SapDeliveryOrderDto {
|
||||
|
||||
private String lifnr;
|
||||
|
||||
/** 供应商名称(MDG004) */
|
||||
private String lifnr_name;
|
||||
|
||||
private String wadat;
|
||||
|
||||
private String lfdat;
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.wms.pm_manage.sap.sapDelivery.service.impl;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -10,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.ext_manage.sap.enums.SapConstant;
|
||||
import org.nl.wms.ext_manage.sap.service.SapSupplierQueryService;
|
||||
import org.nl.wms.pm_manage.sap.sapDelivery.enums.SapDeliveryStatus;
|
||||
import org.nl.wms.pm_manage.sap.sapDelivery.service.SapDeliveryService;
|
||||
import org.nl.wms.ext_manage.sap.api.dto.*;
|
||||
@@ -50,6 +52,7 @@ public class SapDeliveryServiceImpl implements SapDeliveryService {
|
||||
private final SapDeliveryOrderMapper orderMapper;
|
||||
private final SapDeliveryItemMapper itemMapper;
|
||||
private final SapApi sapApi;
|
||||
private final SapSupplierQueryService supplierQueryService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -75,6 +78,8 @@ public class SapDeliveryServiceImpl implements SapDeliveryService {
|
||||
order.setVbeln(vbeln);
|
||||
order.setBldat(body.getBldat());
|
||||
order.setLifnr(body.getLifnr());
|
||||
// 供应商名称:按供应商编码调 MDG004 获取,取不到留空(不阻断同步)
|
||||
order.setLifnr_name(supplierQueryService.getSupplierName(body.getLifnr()));
|
||||
order.setWadat(body.getWadat());
|
||||
order.setLfdat(body.getLfdat());
|
||||
order.setWadat_ist(body.getWadatIst());
|
||||
@@ -108,6 +113,12 @@ public class SapDeliveryServiceImpl implements SapDeliveryService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject confirmReceipt(String vbeln) {
|
||||
return confirmReceipt(vbeln, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject confirmReceipt(String vbeln, String lgort) {
|
||||
if (StrUtil.isBlank(vbeln)) {
|
||||
throw new BadRequestException("收货确认失败:交货单号为空");
|
||||
}
|
||||
@@ -122,6 +133,20 @@ public class SapDeliveryServiceImpl implements SapDeliveryService {
|
||||
List<SapDeliveryItem> items = itemMapper.selectList(new LambdaQueryWrapper<SapDeliveryItem>()
|
||||
.eq(SapDeliveryItem::getHeader_vbeln, vbeln));
|
||||
|
||||
// 收货确认时可批量指定存储地点:明细一并更新,MM054 与单据保持一致
|
||||
String targetLgort = StrUtil.trim(lgort);
|
||||
if (StrUtil.isNotBlank(targetLgort)) {
|
||||
for (SapDeliveryItem item : items) {
|
||||
if (item.getRspos() == null || item.getRspos() == 0) {
|
||||
item.setLgort(targetLgort);
|
||||
}
|
||||
}
|
||||
itemMapper.update(null, new LambdaUpdateWrapper<SapDeliveryItem>()
|
||||
.set(SapDeliveryItem::getLgort, targetLgort)
|
||||
.eq(SapDeliveryItem::getHeader_vbeln, vbeln)
|
||||
.and(w -> w.isNull(SapDeliveryItem::getRspos).or().eq(SapDeliveryItem::getRspos, 0)));
|
||||
}
|
||||
|
||||
order.setStatus(SapDeliveryStatus.EXECUTING.getCode());
|
||||
orderMapper.updateById(order);
|
||||
|
||||
@@ -153,7 +178,9 @@ public class SapDeliveryServiceImpl implements SapDeliveryService {
|
||||
wrapper.like(SapDeliveryOrder::getVbeln, query.getVbeln().trim());
|
||||
}
|
||||
if (StrUtil.isNotBlank(query.getLifnr())) {
|
||||
wrapper.like(SapDeliveryOrder::getLifnr, query.getLifnr().trim());
|
||||
String lifnr = query.getLifnr().trim();
|
||||
wrapper.and(w -> w.like(SapDeliveryOrder::getLifnr, lifnr)
|
||||
.or().like(SapDeliveryOrder::getLifnr_name, lifnr));
|
||||
}
|
||||
if (StrUtil.isNotBlank(query.getStatus())) {
|
||||
wrapper.eq(SapDeliveryOrder::getStatus, query.getStatus());
|
||||
@@ -161,7 +188,8 @@ public class SapDeliveryServiceImpl implements SapDeliveryService {
|
||||
if (StrUtil.isNotBlank(query.getBlurry())) {
|
||||
String blurry = query.getBlurry().trim();
|
||||
wrapper.and(w -> w.like(SapDeliveryOrder::getVbeln, blurry)
|
||||
.or().like(SapDeliveryOrder::getLifnr, blurry));
|
||||
.or().like(SapDeliveryOrder::getLifnr, blurry)
|
||||
.or().like(SapDeliveryOrder::getLifnr_name, blurry));
|
||||
}
|
||||
if (StrUtil.isNotBlank(query.getStartTime())) {
|
||||
wrapper.ge(SapDeliveryOrder::getCreated_at, query.getStartTime());
|
||||
@@ -408,6 +436,10 @@ public class SapDeliveryServiceImpl implements SapDeliveryService {
|
||||
order.setVbeln(dto.getVbeln().trim());
|
||||
order.setBldat(dto.getBldat());
|
||||
order.setLifnr(dto.getLifnr());
|
||||
// 供应商名称缺失时按供应商编码补查 MDG004
|
||||
order.setLifnr_name(StrUtil.isNotBlank(dto.getLifnr_name())
|
||||
? dto.getLifnr_name()
|
||||
: supplierQueryService.getSupplierName(dto.getLifnr()));
|
||||
order.setWadat(dto.getWadat());
|
||||
order.setLfdat(dto.getLfdat());
|
||||
order.setWadat_ist(dto.getWadat_ist());
|
||||
@@ -466,6 +498,7 @@ public class SapDeliveryServiceImpl implements SapDeliveryService {
|
||||
dto.setVbeln(order.getVbeln());
|
||||
dto.setBldat(order.getBldat());
|
||||
dto.setLifnr(order.getLifnr());
|
||||
dto.setLifnr_name(order.getLifnr_name());
|
||||
dto.setWadat(order.getWadat());
|
||||
dto.setLfdat(order.getLfdat());
|
||||
dto.setWadat_ist(order.getWadat_ist());
|
||||
|
||||
@@ -3,6 +3,7 @@ CREATE TABLE `sap_delivery_order` (
|
||||
`vbeln` varchar(10) NOT NULL COMMENT '交货单号(抬头)',
|
||||
`bldat` varchar(8) DEFAULT NULL COMMENT '凭证日期',
|
||||
`lifnr` varchar(10) DEFAULT NULL COMMENT '供应商科目编号',
|
||||
`lifnr_name` varchar(200) DEFAULT NULL COMMENT '供应商名称(MDG004查询)',
|
||||
`wadat` varchar(8) DEFAULT NULL COMMENT '计划货物移动日期',
|
||||
`lfdat` varchar(8) DEFAULT NULL COMMENT '交货日期',
|
||||
`wadat_ist` varchar(8) DEFAULT NULL COMMENT '实际货物移动日期',
|
||||
|
||||
Reference in New Issue
Block a user