feat(wms): 添加成本中心退货单功能
- 新增 BasdeSerialNumber 实体类和相关 Mapper - 实现退货单号生成逻辑 - 添加退货单保存功能 - 优化 SAP 退货信息查询接口
This commit is contained in:
parent
1afd869099
commit
57377c33c5
|
|
@ -25,12 +25,14 @@ public class CeneterOutboundControlelr {
|
|||
@ApiMark(moduleName = "中心领料单管理", apiName = "领料单列表")
|
||||
public ApiResult<PageData<C_MaterialOutboundVO>> search(@Valid @RequestBody C_MaterialOutboundSearchQO request) {
|
||||
// return ApiResult.success(wmsSrmOrderService.search(request));
|
||||
return null;
|
||||
}
|
||||
|
||||
//收货单详情
|
||||
@GetMapping("getOrderItem")
|
||||
@ApiMark(moduleName = "中心领料单管理", apiName = "领料单详情")
|
||||
public ApiResult<C_MaterialOutboundItemQO> getOrderItem(@RequestParam Long orderId) {
|
||||
return null;
|
||||
// return ApiResult.success(wmsSrmOrderItemService.getOrderItem(orderId));
|
||||
}
|
||||
|
||||
|
|
@ -46,6 +48,7 @@ public class CeneterOutboundControlelr {
|
|||
@GetMapping("getScanCodes")
|
||||
@ApiMark(moduleName = "中心领料单管理", apiName = "条码详情")
|
||||
public List<ScanCodeVO> getScanCodes(@RequestParam String orderItemId) {
|
||||
return null;
|
||||
// return wmsSrmOrderItemService.getScanCodes(orderItemId);
|
||||
}
|
||||
// 获取物料出库的推荐批次(根据物料编号+仓库+工厂+数量 按照有效期和批次号进行升序排序)
|
||||
|
|
|
|||
|
|
@ -2,9 +2,14 @@ package com.nflg.wms.admin.controller;
|
|||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.nflg.wms.admin.service.CenterReturnControllerService;
|
||||
import com.nflg.wms.admin.service.SapService;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.PageData;
|
||||
import com.nflg.wms.common.pojo.dto.C_MaterialReturnQueryDTO;
|
||||
import com.nflg.wms.common.pojo.qo.C_MaterialReturnQO;
|
||||
import com.nflg.wms.common.pojo.qo.C_MaterialReturnSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.MaterialAddQO;
|
||||
import com.nflg.wms.common.pojo.vo.*;
|
||||
import com.nflg.wms.common.util.PageUtil;
|
||||
import com.nflg.wms.repository.entity.WmsCenterReturnItem;
|
||||
|
|
@ -13,6 +18,7 @@ import com.nflg.wms.repository.service.IWmsCenterReturnItemService;
|
|||
import com.nflg.wms.repository.service.IWmsCenterReturnScanService;
|
||||
import com.nflg.wms.repository.service.IWmsCenterReturnService;
|
||||
import com.nflg.wms.starter.annotation.ApiMark;
|
||||
import com.sap.conn.jco.JCoException;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
|
@ -38,18 +44,28 @@ public class CenterReturnController {
|
|||
|
||||
@Resource
|
||||
private IWmsCenterReturnScanService wmsCenterReturnScanService;
|
||||
@Autowired
|
||||
|
||||
@Resource
|
||||
private IWmsCenterReturnItemService iWmsCenterReturnItemService;
|
||||
|
||||
@Resource
|
||||
private CenterReturnControllerService centerReturnControllerService;
|
||||
|
||||
/**
|
||||
* 查询退库单列表
|
||||
*
|
||||
* @param request 退库单搜索条件参数对象,包含分页信息和搜索条件
|
||||
* @return 返回分页的退库单数据,包含退库单列表和分页信息
|
||||
*/
|
||||
@PostMapping("search")
|
||||
@ApiMark(moduleName = "中心物料退库管理", apiName = "退库单列表")
|
||||
public ApiResult<PageData<C_MaterialReturnVO>> search(@Valid @RequestBody C_MaterialReturnSearchQO request) {
|
||||
// 调用服务层查询退库单数据,并转换为前端需要的VO对象格式
|
||||
PageData<C_MaterialReturnVO> pageData = PageUtil.convert(wmsCenterReturnService.searchDictionary(request), d -> Convert.convert(C_MaterialReturnVO.class, d));
|
||||
return ApiResult.success(pageData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取退库单详情
|
||||
*
|
||||
|
|
@ -101,6 +117,7 @@ public class CenterReturnController {
|
|||
* @return 返回扫码信息列表的API结果
|
||||
*/
|
||||
@GetMapping("getScanCodes")
|
||||
@ApiMark(moduleName = "中心物料退库管理", apiName = "获取退库扫码详情")
|
||||
public ApiResult<List<ScanCodeVO>> getScanCodes(@RequestParam @NotNull Long orderItemId) {
|
||||
// 查询指定订单项ID的扫码记录
|
||||
List<WmsCenterReturnScan> wmsCenterReturnScans = wmsCenterReturnScanService.lambdaQuery()
|
||||
|
|
@ -118,7 +135,6 @@ public class CenterReturnController {
|
|||
return ApiResult.success(scanCodeVOS);
|
||||
}
|
||||
|
||||
|
||||
private ScanCodeVO convertToScanCodeVO(WmsCenterReturnScan wmsCenterReturnScan) {
|
||||
ScanCodeVO scanCodeVO = new ScanCodeVO();
|
||||
scanCodeVO.setCodeId(wmsCenterReturnScan.getCodeId());
|
||||
|
|
@ -129,11 +145,40 @@ public class CenterReturnController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据预留单号查询退货信息
|
||||
* @param reservedNumber 预留单号
|
||||
* @return ApiResult<C_SAPMaterialReturnVO> 退货信息结果封装
|
||||
* @throws JCoException SAP连接异常
|
||||
*/
|
||||
@GetMapping("getReturnInfo")
|
||||
@ApiMark(moduleName = "中心物料退库管理", apiName = "根据预留单号从SAP查询退货信息")
|
||||
public ApiResult<C_SAPMaterialReturnVO> getReturnInfo(@RequestParam String reservedNumber) throws JCoException {
|
||||
C_SAPMaterialReturnVO sapMaterialReturnVO = new C_SAPMaterialReturnVO();
|
||||
// 从SAP获取物料退货明细信息
|
||||
List<C_SAPMaterialReturnItemVO> sapItems = centerReturnControllerService.getSapCMaterialReturnItems(reservedNumber);
|
||||
// 检查是否找到对应的退货信息
|
||||
if (CollectionUtil.isEmpty(sapItems)) {
|
||||
return ApiResult.error("无法找到预留单");
|
||||
}
|
||||
|
||||
// 根据预留单号查询退货信息
|
||||
sapMaterialReturnVO.setReservedNumber(reservedNumber);
|
||||
sapMaterialReturnVO.setItems(sapItems);
|
||||
return ApiResult.success(sapMaterialReturnVO);
|
||||
}
|
||||
|
||||
//用户确认退货
|
||||
|
||||
/**
|
||||
* 提交退货信息
|
||||
*
|
||||
* @param request 退货申请参数对象,包含退货物料的相关信息
|
||||
* @return ApiResult<Void> 统一返回结果,成功时返回空值
|
||||
*/
|
||||
@PostMapping("save")
|
||||
@ApiMark(moduleName = "中心物料退库管理", apiName = "提交退货信息")
|
||||
public ApiResult<Void> save(@Valid @RequestBody C_MaterialReturnQO request) {
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.nflg.wms.admin.controller;
|
|||
|
||||
import com.nflg.wms.admin.pojo.dto.LdapDepartmentDTO;
|
||||
import com.nflg.wms.admin.pojo.dto.LdapUserDTO;
|
||||
import com.nflg.wms.admin.service.BasdeSerialNumberControllerService;
|
||||
import com.nflg.wms.admin.service.SapService;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.qo.C_MaterialReturnItemQO;
|
||||
|
|
@ -29,6 +30,8 @@ public class TestController extends BaseController {
|
|||
@Resource
|
||||
private ILanguageService languageService;
|
||||
|
||||
@Resource
|
||||
private BasdeSerialNumberControllerService basdeSerialNumberControllerService;
|
||||
// @Resource
|
||||
// private LdapService ldapService;
|
||||
|
||||
|
|
@ -37,6 +40,7 @@ public class TestController extends BaseController {
|
|||
private SapService sapService;
|
||||
@GetMapping("/add")
|
||||
public void add() throws JCoException {
|
||||
|
||||
// try {
|
||||
sapService.zwm00_MB017("1309976");
|
||||
// }
|
||||
|
|
@ -46,25 +50,6 @@ public class TestController extends BaseController {
|
|||
// }
|
||||
|
||||
|
||||
List<C_MaterialReturnItemQO>items=new ArrayList<>();
|
||||
C_MaterialReturnItemQO item=new C_MaterialReturnItemQO()
|
||||
.setBatchNumber("1")
|
||||
.setSerialNumber("2222")
|
||||
.setResbMatnr("2147854512")
|
||||
.setResbWerks("1020")
|
||||
.setMsebErfmg(new BigDecimal(1.2));
|
||||
|
||||
|
||||
items.add( item);
|
||||
|
||||
C_MaterialReturnItemQO item1=new C_MaterialReturnItemQO()
|
||||
.setBatchNumber("12333")
|
||||
.setSerialNumber("222112")
|
||||
.setResbMatnr("2147854512")
|
||||
.setResbWerks("1020")
|
||||
.setMsebErfmg(new BigDecimal(1.8));
|
||||
items.add( item1);
|
||||
|
||||
// Language language = new Language()
|
||||
// .setCode("test1")
|
||||
// .setName("测试1")
|
||||
|
|
@ -89,4 +74,10 @@ public class TestController extends BaseController {
|
|||
public ApiResult<List<LdapUserDTO>> syncUsers() {
|
||||
return ApiResult.success(Collections.emptyList());
|
||||
}
|
||||
|
||||
@GetMapping("/ad/string")
|
||||
public ApiResult<String> getString() {
|
||||
String ids=basdeSerialNumberControllerService.generateSerialNumber(0);
|
||||
return ApiResult.success(ids);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.nflg.wms.admin.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.nflg.wms.repository.entity.BasdeSerialNumber;
|
||||
import com.nflg.wms.repository.service.IBasdeSerialNumberService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.retry.annotation.Backoff;
|
||||
import org.springframework.retry.annotation.Retryable;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
|
||||
@Component
|
||||
public class BasdeSerialNumberControllerService {
|
||||
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
private static final int MAX_RETRY = 5; // 最大重试次数
|
||||
|
||||
@Resource
|
||||
private IBasdeSerialNumberService basdeSerialNumberService;
|
||||
|
||||
@Retryable(
|
||||
maxAttempts = 5, // 最大重试次数(包括第一次调用)
|
||||
backoff = @Backoff(delay = 1000) // 重试间隔1秒
|
||||
)
|
||||
public String generateSerialNumber(Integer businessType) {
|
||||
String currentDate = LocalDate.now().format(DATE_FORMATTER);
|
||||
int retryCount = 0;
|
||||
LambdaQueryWrapper<BasdeSerialNumber> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BasdeSerialNumber::getBusinessType, businessType)
|
||||
.eq(BasdeSerialNumber::getCurrentDateStr, currentDate);
|
||||
|
||||
BasdeSerialNumber serialNumber = basdeSerialNumberService.lambdaQuery()
|
||||
.eq(BasdeSerialNumber::getBusinessType, businessType)
|
||||
.eq(BasdeSerialNumber::getCurrentDateStr, currentDate)
|
||||
.one();
|
||||
|
||||
if (Objects.isNull(serialNumber)) {
|
||||
return null;
|
||||
}
|
||||
int nextSerial = serialNumber.getMaxSerial() + 1;
|
||||
serialNumber.setMaxSerial(nextSerial);
|
||||
serialNumber.setCurrentDateStr(currentDate);
|
||||
basdeSerialNumberService.updateById(serialNumber);
|
||||
// 格式化为4位数字,不足补零
|
||||
return serialNumber.getBusinessPrefixNumber() + currentDate + String.format("%04d", nextSerial);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
package com.nflg.wms.admin.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.dto.C_MaterialReturnDTO;
|
||||
import com.nflg.wms.common.pojo.dto.C_MaterialReturnQueryDTO;
|
||||
import com.nflg.wms.common.pojo.dto.SAPSyncFromDTO;
|
||||
import com.nflg.wms.common.pojo.qo.C_MaterialReturnQO;
|
||||
import com.nflg.wms.common.pojo.vo.C_SAPMaterialReturnItemVO;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.repository.entity.WmsCenterReturn;
|
||||
import com.nflg.wms.repository.entity.WmsCenterReturnItem;
|
||||
import com.nflg.wms.repository.entity.WmsCenterReturnScan;
|
||||
import com.nflg.wms.repository.service.IWmsCenterReturnService;
|
||||
import com.sap.conn.jco.JCoException;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class CenterReturnControllerService {
|
||||
|
||||
@Resource
|
||||
private SapService sapService;
|
||||
|
||||
@Resource
|
||||
private IWmsCenterReturnService wmsCenterReturnService;
|
||||
|
||||
@Resource
|
||||
private BasdeSerialNumberControllerService basdeSerialNumberControllerService;
|
||||
|
||||
/**
|
||||
* 根据预留号获取SAP物料退货项列表。
|
||||
* <p>
|
||||
* 该方法首先通过预留号调用SAP服务获取物料退货查询数据,然后根据工厂(Werks)去重,
|
||||
* 分别查询每个工厂下的仓库信息,并构建缓存以提高匹配效率,最终将原始数据与仓库信息
|
||||
* 合并生成返回的VO对象列表。
|
||||
*
|
||||
* @param reservedNumber 预留号,用于查询相关的物料退货信息
|
||||
* @return 物料退货项VO列表,如果无数据则返回空列表
|
||||
* @throws JCoException 调用SAP接口时可能抛出的异常
|
||||
*/
|
||||
public List<C_SAPMaterialReturnItemVO> getSapCMaterialReturnItems(String reservedNumber) throws JCoException {
|
||||
// 调用SAP服务获取原始物料退货数据
|
||||
List<C_MaterialReturnQueryDTO> sapItems = sapService.zwm00_MB017(reservedNumber);
|
||||
if (CollectionUtil.isEmpty(sapItems)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 提取并去重所有不为空的工厂编码(ResbWerks)
|
||||
List<String> distinctResbWerks = sapItems.stream()
|
||||
.map(C_MaterialReturnQueryDTO::getResbWerks)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
// 存储所有工厂对应的仓库信息
|
||||
List<SAPSyncFromDTO> allWarehouse = new ArrayList<>();
|
||||
|
||||
// 遍历每个工厂,获取其对应的仓库和物料信息
|
||||
for (String werks : distinctResbWerks) {
|
||||
// 筛选出当前工厂的所有物料退货项
|
||||
List<C_MaterialReturnQueryDTO> filteredItems = sapItems.stream()
|
||||
.filter(item -> werks.equals(item.getResbWerks()))
|
||||
.toList();
|
||||
|
||||
// 收集当前工厂下所有的仓库编号和物料编号
|
||||
List<String> warehouseNos = new ArrayList<>();
|
||||
List<String> materialNos = new ArrayList<>();
|
||||
|
||||
for (C_MaterialReturnQueryDTO item : filteredItems) {
|
||||
if (item.getResbLgort() != null) {
|
||||
warehouseNos.add(item.getResbLgort());
|
||||
}
|
||||
if (item.getResbMatnr() != null) {
|
||||
materialNos.add(item.getResbMatnr());
|
||||
}
|
||||
}
|
||||
|
||||
// 调用SAP服务获取仓库详细信息
|
||||
List<SAPSyncFromDTO> warehouseList = sapService.zwm3a01(werks, warehouseNos, materialNos, null, null);
|
||||
if (CollectionUtil.isNotEmpty(warehouseList)) {
|
||||
allWarehouse.addAll(warehouseList);
|
||||
}
|
||||
}
|
||||
|
||||
// 构建缓存 Map 提高查找效率
|
||||
Map<String, SAPSyncFromDTO> warehouseMap = allWarehouse.stream()
|
||||
.collect(Collectors.toMap(
|
||||
w -> w.getFactoryNo() + "_" + w.getMaterialNo() + "_" + w.getWarehouseNo(),
|
||||
Function.identity(),
|
||||
(existing, replacement) -> existing
|
||||
));
|
||||
|
||||
// 将原始数据与仓库信息合并,生成最终的VO对象列表
|
||||
return sapItems.stream()
|
||||
.map(item -> {
|
||||
String key = item.getResbWerks() + "_" + item.getResbMatnr() + "_" + item.getResbLgort();
|
||||
SAPSyncFromDTO warehouse = warehouseMap.get(key);
|
||||
|
||||
return new C_SAPMaterialReturnItemVO()
|
||||
.setReservedNumberId(item.getResbRspos())
|
||||
.setMaterialNo(item.getResbMatnr())
|
||||
.setMaterialDesc(item.getMaktx())
|
||||
.setUnit(item.getResbMeins())
|
||||
.setFactory(item.getResbWerks())
|
||||
.setReturnQty(new BigDecimal(item.getResbBdmng()))
|
||||
.setBinNos(warehouse != null ? warehouse.getBinNos() : null)
|
||||
.setWarehouseNumber(item.getResbLgort());
|
||||
})
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
||||
public String saveCMaterialReturn(C_MaterialReturnQO request) throws JCoException {
|
||||
Long returnId = IdUtil.getSnowflakeNextId();
|
||||
WmsCenterReturn wmsCenterReturn = new WmsCenterReturn();
|
||||
String orderNumber = basdeSerialNumberControllerService.generateSerialNumber(0);
|
||||
wmsCenterReturn.setCreateTime(LocalDateTime.now())
|
||||
.setId(returnId)
|
||||
.setOrderNumber(orderNumber)
|
||||
.setReservedNumber(request.getResbRsNum())
|
||||
.setCreateTime(LocalDateTime.now())
|
||||
.setCreateUserName(UserUtil.getUserName())
|
||||
.setCreateUserId(UserUtil.getUserId());
|
||||
|
||||
List<WmsCenterReturnItem> wmsCenterReturnItems = new ArrayList<>();
|
||||
List<WmsCenterReturnScan> wmsCenterReturnScans = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(request.getItems())) {
|
||||
request.getItems().forEach(item -> {
|
||||
Long itemId = IdUtil.getSnowflakeNextId();
|
||||
WmsCenterReturnItem wmsCenterReturnItem = new WmsCenterReturnItem()
|
||||
.setId(itemId)
|
||||
.setOrderId(returnId)
|
||||
.setReservedNumberId(item.getResbRspos())
|
||||
.setMaterialNo(item.getResbMatnr())
|
||||
.setMaterialDesc(item.getMaktx())
|
||||
.setUnit(item.getResbMeins())
|
||||
.setFactory(item.getResbWerks())
|
||||
.setReturnQty(item.getErfmg())
|
||||
.setWarehouseNumber(item.getResbLgort());
|
||||
wmsCenterReturnItems.add(wmsCenterReturnItem);
|
||||
if (CollectionUtil.isNotEmpty(item.getScanCodes())) {
|
||||
item.getScanCodes().forEach(scanCode -> {
|
||||
WmsCenterReturnScan wmsCenterReturnScan = new WmsCenterReturnScan()
|
||||
.setId(IdUtil.getSnowflakeNextId())
|
||||
.setItemId(itemId)
|
||||
.setCodeId(scanCode.getCodeId())
|
||||
.setCodeNum(scanCode.getCodeNum())
|
||||
.setBatchNumber(scanCode.getBatchNumber())
|
||||
.setSerialNumber(scanCode.getSerialNumber())
|
||||
.setCodeContent(scanCode.getCodeContent());
|
||||
wmsCenterReturnScans.add(wmsCenterReturnScan);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
//保存中心退货单,同步到SAP
|
||||
C_MaterialReturnDTO sapReturn = sapService.zwm00_MB112(request);
|
||||
if (!sapReturn.isSapSync()) {
|
||||
return sapReturn.getSapMsg();
|
||||
}
|
||||
wmsCenterReturn.setSapMsg(sapReturn.getSapMsg())
|
||||
.setSapStatus(sapReturn.isSapSync())
|
||||
.setMaterialDoc(sapReturn.getEMblnr())
|
||||
.setMaterialDocYear(sapReturn.getEMJahr());
|
||||
|
||||
wmsCenterReturnService.saveReturns(wmsCenterReturn, wmsCenterReturnItems, wmsCenterReturnScans);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ import com.nflg.wms.common.pojo.qo.C_MaterialOutboundQO;
|
|||
import com.nflg.wms.common.pojo.qo.C_MaterialReturnItemQO;
|
||||
import com.nflg.wms.common.pojo.qo.C_MaterialReturnQO;
|
||||
import com.nflg.wms.common.pojo.qo.ScanCodeQO;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.sap.conn.jco.*;
|
||||
import jakarta.annotation.Resource;
|
||||
|
|
@ -299,10 +300,10 @@ public class SapService {
|
|||
}
|
||||
|
||||
// 成本中心退库确认
|
||||
private C_MaterialReturnDTO zwm00_MB112(C_MaterialReturnQO request) throws JCoException {
|
||||
public C_MaterialReturnDTO zwm00_MB112(C_MaterialReturnQO request) throws JCoException {
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("I_RSNUM", request.getResbRsNum());
|
||||
parameters.put("I_USNAM", request.getResbRsNum());
|
||||
parameters.put("I_USNAM", UserUtil.getUserName());
|
||||
List<C_MaterialReturnItemDTO> t_list1 = new ArrayList<>();
|
||||
List<C_MaterialReturnSerialItemDTO> t_list2 = new ArrayList<>();
|
||||
for (C_MaterialReturnItemQO item : request.getItems()) {
|
||||
|
|
@ -344,8 +345,7 @@ public class SapService {
|
|||
|
||||
C_MaterialReturnDTO result = new C_MaterialReturnDTO()
|
||||
.setEMblnr(tOut.getString("E_MBLNR"))
|
||||
.setEMJahr(tOut.getString("E_MJAHR"))
|
||||
.setRequestQO(request);
|
||||
.setEMJahr(tOut.getString("E_MJAHR"));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ public class C_MaterialReturnDTO {
|
|||
//物料凭证年度
|
||||
private String eMJahr;
|
||||
|
||||
//中心退库的物料详情信息
|
||||
private C_MaterialReturnQO requestQO;
|
||||
//同步到SAP的状态
|
||||
private boolean isSapSync;
|
||||
|
||||
//同步SAP错误的信息
|
||||
private String sapMsg;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class C_MaterialReturnItemQO {
|
|||
private String resbMeins;
|
||||
|
||||
// 退库数量
|
||||
private String erfmg;
|
||||
private BigDecimal erfmg;
|
||||
|
||||
//扫码信息
|
||||
private List<ScanCodeQO> scanCodes;
|
||||
|
|
|
|||
|
|
@ -11,9 +11,6 @@ public class C_MaterialReturnQO {
|
|||
//预留号
|
||||
private String resbRsNum;
|
||||
|
||||
//PDA操作员
|
||||
private String pdaOperator;
|
||||
|
||||
// 预留单退料详情信息
|
||||
private List<C_MaterialReturnItemQO> items;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class C_SAPMaterialReturnItemVO {
|
||||
|
||||
/**
|
||||
* 预留单行号
|
||||
*/
|
||||
private String reservedNumberId;
|
||||
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
private String materialNo;
|
||||
|
||||
/**
|
||||
* 物料描述
|
||||
*/
|
||||
private String materialDesc;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 工厂
|
||||
*/
|
||||
private String factory;
|
||||
|
||||
/**
|
||||
* 退货数量
|
||||
*/
|
||||
private BigDecimal returnQty;
|
||||
|
||||
/**
|
||||
* 默认仓库
|
||||
*/
|
||||
private String warehouseNumber;
|
||||
|
||||
/**
|
||||
* 货位编号
|
||||
*/
|
||||
private String binNos;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class C_SAPMaterialReturnVO {
|
||||
/**
|
||||
* 预留单号
|
||||
*/
|
||||
private String reservedNumber;
|
||||
|
||||
// 物料退料项
|
||||
private List<C_SAPMaterialReturnItemVO> items;
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.nflg.wms.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
@TableName("basde_serial_number")
|
||||
public class BasdeSerialNumber implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 业务类型 0 成本中心退货单;1 成本中心领料单
|
||||
*/
|
||||
private Short businessType;
|
||||
|
||||
/**
|
||||
* 当前时间 YYYYMMDD
|
||||
*/
|
||||
private String currentDateStr;
|
||||
|
||||
/**
|
||||
* 当前最大流水号
|
||||
*/
|
||||
private Integer maxSerial;
|
||||
|
||||
/**
|
||||
* 乐观锁版本号
|
||||
*/
|
||||
@NotNull
|
||||
@Version
|
||||
private Integer version;
|
||||
|
||||
/**
|
||||
* 业务单号的前缀
|
||||
*/
|
||||
private String businessPrefixNumber;
|
||||
}
|
||||
|
|
@ -76,8 +76,4 @@ public class WmsCenterReturn implements Serializable {
|
|||
*/
|
||||
private String sapMsg;
|
||||
|
||||
/**
|
||||
* 流水号
|
||||
*/
|
||||
private Integer serialNumber;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package com.nflg.wms.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nflg.wms.repository.entity.BasdeSerialNumber;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
public interface BasdeSerialNumberMapper extends BaseMapper<BasdeSerialNumber> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.nflg.wms.repository.service;
|
||||
|
||||
import com.nflg.wms.repository.entity.BasdeSerialNumber;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
public interface IBasdeSerialNumberService extends IService<BasdeSerialNumber> {
|
||||
}
|
||||
|
|
@ -4,8 +4,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.nflg.wms.common.pojo.qo.C_MaterialReturnSearchQO;
|
||||
import com.nflg.wms.repository.entity.WmsCenterReturn;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nflg.wms.repository.entity.WmsCenterReturnItem;
|
||||
import com.nflg.wms.repository.entity.WmsCenterReturnScan;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
|
|
@ -17,4 +21,6 @@ import jakarta.validation.Valid;
|
|||
public interface IWmsCenterReturnService extends IService<WmsCenterReturn> {
|
||||
|
||||
IPage<WmsCenterReturn> searchDictionary(@Valid C_MaterialReturnSearchQO request);
|
||||
|
||||
void saveReturns(WmsCenterReturn wmsCenterReturn, List<WmsCenterReturnItem> wmsCenterReturnItems, List<WmsCenterReturnScan> wmsCenterReturnScans);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
package com.nflg.wms.repository.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.nflg.wms.repository.entity.BasdeSerialNumber;
|
||||
import com.nflg.wms.repository.entity.WmsCenterReturn;
|
||||
import com.nflg.wms.repository.mapper.BasdeSerialNumberMapper;
|
||||
import com.nflg.wms.repository.service.IBasdeSerialNumberService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
@Service
|
||||
public class BasdeSerialNumberServiceImpl extends ServiceImpl<BasdeSerialNumberMapper, BasdeSerialNumber> implements IBasdeSerialNumberService {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -6,10 +6,19 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.wms.common.pojo.qo.C_MaterialReturnSearchQO;
|
||||
import com.nflg.wms.repository.entity.WmsCenterReturn;
|
||||
import com.nflg.wms.repository.entity.WmsCenterReturnItem;
|
||||
import com.nflg.wms.repository.entity.WmsCenterReturnScan;
|
||||
import com.nflg.wms.repository.mapper.WmsCenterReturnMapper;
|
||||
import com.nflg.wms.repository.service.IWmsCenterReturnItemService;
|
||||
import com.nflg.wms.repository.service.IWmsCenterReturnScanService;
|
||||
import com.nflg.wms.repository.service.IWmsCenterReturnService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
|
@ -21,6 +30,11 @@ import org.springframework.stereotype.Service;
|
|||
*/
|
||||
@Service
|
||||
public class WmsCenterReturnServiceImpl extends ServiceImpl<WmsCenterReturnMapper, WmsCenterReturn> implements IWmsCenterReturnService {
|
||||
@Resource
|
||||
private IWmsCenterReturnScanService wmsCenterReturnScanService;
|
||||
|
||||
@Resource
|
||||
private IWmsCenterReturnItemService wmsCenterReturnItemService;
|
||||
|
||||
/**
|
||||
* 根据搜索条件分页查询退货单信息
|
||||
|
|
@ -59,5 +73,20 @@ public class WmsCenterReturnServiceImpl extends ServiceImpl<WmsCenterReturnMappe
|
|||
return baseMapper.selectPage(new Page<>(page, pageSize), queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveReturns(WmsCenterReturn wmsCenterReturn, List<WmsCenterReturnItem> wmsCenterReturnItems, List<WmsCenterReturnScan> wmsCenterReturnScans) {
|
||||
if (this.save(wmsCenterReturn)) {
|
||||
if (wmsCenterReturnItemService.saveBatch(wmsCenterReturnItems)) {
|
||||
if (wmsCenterReturnScanService.saveBatch(wmsCenterReturnScans)) {
|
||||
// 更新库存
|
||||
/// TODO 更新库存
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nflg.wms.repository.mapper.BasdeSerialNumberMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -33,7 +33,7 @@ public class CodeGeneratorTest {
|
|||
)
|
||||
.strategyConfig(builder -> {
|
||||
builder
|
||||
.addInclude("wms_outbound_recommendation") //只生成指定表
|
||||
.addInclude("basde_serial_number") //只生成指定表
|
||||
.entityBuilder().idType(IdType.ASSIGN_ID)
|
||||
.enableLombok()
|
||||
.enableChainModel()
|
||||
|
|
|
|||
Loading…
Reference in New Issue