Compare commits

..

4 Commits

Author SHA1 Message Date
曹鹏飞 981d1f4a96 feat(qrcodemaster): 添加装箱管理控制器实现装箱拆箱换箱功能
- 新增 QrCodeMasterController 控制器提供装箱管理相关接口
- 实现装箱绑码功能支持小码放入大码中
- 实现拆箱删除功能支持从箱中移除物料二维码
- 实现换箱功能支持库存地点内物料箱合并
- 添加扫码接口获取二维码详细信息
- 实现标签导出功能支持ZIP和PDF格式
- 提供包装箱和箱内物料信息查询接口
- 添加批次号一致性校验防止混批操作
- 实现物料匹配验证确保装箱准确性
- 完善状态流转控制防止非法操作
- 添加防重复装箱和跨工厂仓库限制
- 优化库存管理实现出入库自动处理
2026-04-01 20:58:35 +08:00
曹鹏飞 1fc36d7284 Merge remote-tracking branch 'origin/develop' into develop 2026-04-01 19:35:48 +08:00
曹鹏飞 459d6766af Merge remote-tracking branch 'origin/develop' into develop 2026-04-01 19:18:02 +08:00
曹鹏飞 2f614248bb refactor(controller): 重构控制器代码结构和服务层实现
- 移除未使用的 SrmMaterialReceiptScanCodesRepository 注入
- 修复变量名拼写错误 srmMaterialReceiptCanCodesRepository 替换为 srmMaterialReceiptScanCodesRepository
- 将核心业务逻辑抽取到独立的 NormalPGIControllerService 类中
- 删除未使用的 StringUtil 导入并优化代码格式
- 修复包装类型比较运算符的空格问题
- 优化批量操作的集合处理逻辑
- 移除过时的注释标记和冗余的验证注解
2026-04-01 19:17:54 +08:00
5 changed files with 74 additions and 58 deletions

View File

@ -72,8 +72,8 @@ public class NormalPGIController extends BaseController {
@Resource
private NormalPGIControllerService normalPGIControllerService;
@Resource
private SrmMaterialReceiptScanCodesRepository srmMaterialReceiptCanCodesRepository;
// @Resource
// private SrmMaterialReceiptScanCodesRepository srmMaterialReceiptCanCodesRepository;
@Resource
private SAPCommonService sapCommonService;
@ -165,7 +165,7 @@ public class NormalPGIController extends BaseController {
@GetMapping("getScanCodes")
@ApiMark(moduleName = "送货单管理", apiName = "获取扫码的详情信息")
public ApiResult<List<PDAScanCodeVO>> getScanCodes(@RequestParam Long orderItemId) {
List<SrmMaterialReceiptScanCodes> scanCodes = srmMaterialReceiptCanCodesRepository.findByOrderItemId(orderItemId);
List<SrmMaterialReceiptScanCodes> scanCodes = srmMaterialReceiptScanCodesRepository.findByOrderItemId(orderItemId);
List<PDAScanCodeVO> pdas = Convert.toList(PDAScanCodeVO.class, scanCodes);
return ApiResult.success(pdas);
}

View File

@ -20,7 +20,6 @@ import com.nflg.wms.common.pojo.vo.QrCodeItemVO;
import com.nflg.wms.common.pojo.vo.QrCodeVO;
import com.nflg.wms.common.pojo.vo.StrappingVO;
import com.nflg.wms.common.util.NumberUtil;
import com.nflg.wms.common.util.StringUtil;
import com.nflg.wms.common.util.UserUtil;
import com.nflg.wms.common.util.VUtil;
import com.nflg.wms.repository.entity.WmsPackageItem;
@ -55,6 +54,7 @@ import java.util.zip.ZipOutputStream;
/**
* 装箱管理
*
* @author: nflg
* @date: 2022/3/17
* @description:
@ -97,7 +97,7 @@ public class QrCodeMasterController extends BaseController {
.eq(WmsQrCodeMaster::getBarcodeCode, request.getBarcodeCode())
.one();
VUtil.trueThrowBusinessError(ObjectUtil.isNull(qrCodeMaster)).throwMessage("无效码");
VUtil.trueThrowBusinessError(qrCodeMaster.getPackagingType()!=1).throwMessage("此码不属于箱码");
VUtil.trueThrowBusinessError(qrCodeMaster.getPackagingType() != 1).throwMessage("此码不属于箱码");
VUtil.trueThrowBusinessError(qrCodeMaster.getProcessStage() != BarCodeProcessStage.Unpackaged.getState())
.throwMessage("此箱码已处于【" + BarCodeProcessStage.findByValue(qrCodeMaster.getProcessStage()).getDescription() + "】状态,不可以操作");
List<WmsQrCodeMaster> smallQrCodeMasters = qrCodeMasterService.lambdaQuery()
@ -134,16 +134,18 @@ public class QrCodeMasterController extends BaseController {
@ApiMark(moduleName = "包装箱编码获取获取包装箱信息", apiName = "包装箱编码获取获取包装箱信息")
public ApiResult<List<PackageInfoVO>> getPackageInfos(@Valid @RequestBody PackageQO request) {
List<WmsPackageItem> wmsPackageItems = wmsPackageItemService.lambdaQuery()
.eq(WmsPackageItem::getPackageId,request.getPackageId())
.eq(WmsPackageItem::getPackageId, request.getPackageId())
.list();
if (CollectionUtil.isEmpty(wmsPackageItems)) {
return ApiResult.success(Collections.emptyList());
}
List<String> barcodeCodes = wmsPackageItems.stream()
.map(WmsPackageItem::getBarcodeCode)
.filter(Objects::nonNull)
.toList();
List<WmsQrCodeMaster> qrCodeMasterList = qrCodeMasterService.lambdaQuery()
.in(WmsQrCodeMaster::getBarcodeCode, barcodeCodes)
.list();
List<PackageInfoVO> packageInfoVOS = Convert.toList(PackageInfoVO.class,qrCodeMasterList);
List<PackageInfoVO> packageInfoVOS = Convert.toList(PackageInfoVO.class, qrCodeMasterList);
packageInfoVOS.forEach(vo -> {
WmsPackageItem item = wmsPackageItems.stream()
.filter(p -> StrUtil.equals(p.getBarcodeCode(), vo.getBarcodeCode()))
@ -165,7 +167,8 @@ public class QrCodeMasterController extends BaseController {
*/
private void smallBarcodeValidation(WmsQrCodeMaster qrCodeMaster,
List<WmsQrCodeMaster> smallQrCodeMasters,
BarCodeProcessStage processStage) {
BarCodeProcessStage processStage,
boolean equals) {
boolean hasDuplicates = smallQrCodeMasters.stream()
.map(WmsQrCodeMaster::getBarcodeCode)
.collect(Collectors.toSet())
@ -183,16 +186,25 @@ public class QrCodeMasterController extends BaseController {
VUtil.trueThrowBusinessError(materialCodes.size() > 1).throwMessage("此箱码中包含多中物料");
VUtil.trueThrowBusinessError(!materialCodes.get(0).equals(qrCodeMaster.getMaterialCode())).throwMessage("物料不匹配");
//判断小码中是否又被使用过了
Integer count = qrCodeMasterService.lambdaQuery()
.in(WmsQrCodeMaster::getBarcodeCode, barcodeCodes)
.eq(WmsQrCodeMaster::getProcessStage, processStage.getState())
.count().intValue();
VUtil.trueThrowBusinessError(count > 0).throwMessage("此箱码中包含已使用的物料二维码");
Integer count1 = qrCodeMasterService.lambdaQuery()
if (equals) {
VUtil.trueThrowBusinessError(
qrCodeMasterService.lambdaQuery()
.in(WmsQrCodeMaster::getBarcodeCode, barcodeCodes)
.ne(WmsQrCodeMaster::getProcessStage, processStage.getState())
.exists()
).throwMessage("此箱码中包含非【" + processStage.getDescription() + "】的物料二维码");
} else {
VUtil.trueThrowBusinessError(
qrCodeMasterService.lambdaQuery()
.in(WmsQrCodeMaster::getBarcodeCode, barcodeCodes)
.eq(WmsQrCodeMaster::getProcessStage, processStage.getState())
.exists()
).throwMessage("此箱码中包含【" + processStage.getDescription() + "】的物料二维码");
}
VUtil.trueThrowBusinessError(qrCodeMasterService.lambdaQuery()
.eq(WmsQrCodeMaster::getPackagingType, 1)
.in(WmsQrCodeMaster::getBarcodeCode, barcodeCodes)
.count().intValue();
VUtil.trueThrowBusinessError(count1 > 0).throwMessage("存在箱子码(中码)");
.in(WmsQrCodeMaster::getBarcodeCode, barcodeCodes).exists()
).throwMessage("存在箱子码(中码)");
}
/**
@ -226,10 +238,10 @@ public class QrCodeMasterController extends BaseController {
}
}
VUtil.trueThrowBusinessError(CollectionUtil.isNotEmpty(differentBatchNos))
.throwMessage("批次号不一致,不一致的物料条码号为:" + differentBatchNos);
.throwMessage("批次号不一致,不一致的物料条码号为:" + StrUtil.join(",", differentBatchNos));
// 判断箱子的物料信息是否OK
smallBarcodeValidation(qrCodeMaster, smallQrCodeMasters, BarCodeProcessStage.Packaged);
smallBarcodeValidation(qrCodeMaster, smallQrCodeMasters, BarCodeProcessStage.Packaged, false);
// 修改小码的所属关系
for (WmsQrCodeMaster smallQrCodeMaster : smallQrCodeMasters) {
smallQrCodeMaster.setParentBarcodeId(qrCodeMaster.getId());
@ -282,6 +294,7 @@ public class QrCodeMasterController extends BaseController {
/**
* 换箱
* 针对库存地点内的物料箱合并修改物料的箱属性和库存
*
* @param request
* @return
*/
@ -306,7 +319,7 @@ public class QrCodeMasterController extends BaseController {
.in(WmsQrCodeMaster::getBarcodeCode, request.getItems())
.list();
// 判断箱子的物料信息是否OK
smallBarcodeValidation(qrCodeMaster, smallQrCodeMasters, BarCodeProcessStage.InBound);
smallBarcodeValidation(qrCodeMaster, smallQrCodeMasters, BarCodeProcessStage.InBound, true);
//校验批次号是否一致
String masterbatchNo = qrCodeMaster.getBatchNo();
Set<String> differentBatchNos = new HashSet<>();
@ -320,11 +333,18 @@ public class QrCodeMasterController extends BaseController {
.throwMessage("批次号不一致,不一致的物料条码号为:" + differentBatchNos);
// 只有同一个工厂的同一个库存地点的可以进行换箱
Integer count1 = qrCodeMasterService.lambdaQuery()
.eq(WmsQrCodeMaster::getFactoryCode, request.getFactoryCode())
.eq(WmsQrCodeMaster::getStorageLocation, request.getStorageLocation())
.count().intValue();
VUtil.trueThrowBusinessError(count1 > 0).throwMessage("换箱只可以在相同的库存地点下进行");
// Integer count1 = qrCodeMasterService.lambdaQuery()
// .eq(WmsQrCodeMaster::getFactoryCode, request.getFactoryCode())
// .eq(WmsQrCodeMaster::getStorageLocation, request.getStorageLocation())
// .count().intValue();
// VUtil.trueThrowBusinessError(count1 > 0).throwMessage("换箱只可以在相同的库存地点下进行");
Set<String> factory = smallQrCodeMasters.stream().map(WmsQrCodeMaster::getFactoryCode).collect(Collectors.toSet());
VUtil.trueThrowBusinessError(factory.size() > 1).throwMessage("换箱只可以在同一个工厂的库存地点下进行");
Set<String> warehouse = smallQrCodeMasters.stream().map(WmsQrCodeMaster::getStorageLocation).collect(Collectors.toSet());
VUtil.trueThrowBusinessError(warehouse.size() > 1).throwMessage("换箱只可以在同一个库存地点下进行");
VUtil.trueThrowBusinessError(!StrUtil.equals(factory.iterator().next(), request.getFactoryCode())
|| !StrUtil.equals(warehouse.iterator().next(), request.getStorageLocation())
).throwMessage("物料所在仓库地点与选择的仓库地点不一致");
// 区分状态
// 1新箱的状态没有入过库;直接将明细物料退库重新绑定
if (processStage.equals(BarCodeProcessStage.Unpackaged)) {
@ -384,9 +404,9 @@ public class QrCodeMasterController extends BaseController {
* 物料出入库统一扫码接口
*
* @param request
* @return
* @author
* */
* @return
* @author
**/
@PostMapping("pda/scan")
@ApiMark(moduleName = "扫码", apiName = "扫码获取扫码信息")
public ApiResult<QrCodeVO> scan(@Valid @RequestBody QRCodeSearchQO request) {
@ -419,9 +439,10 @@ public class QrCodeMasterController extends BaseController {
* 换箱扫码接口
*
* @param request
* @return
* @author
* */
* @return
* @author
*
*/
@PostMapping("pda/changeScan")
@ApiMark(moduleName = "换箱扫码", apiName = "扫码换箱箱子扫码信息")
public ApiResult<QrCodeVO> changeScan(@Valid @RequestBody QRCodeSearchQO request) {
@ -448,6 +469,7 @@ public class QrCodeMasterController extends BaseController {
/**
* 导出标签图片为ZIP
*
* @param datas 二维码列表
*/
@PostMapping(value = "exportToZip", produces = "application/zip")
@ -477,6 +499,7 @@ public class QrCodeMasterController extends BaseController {
/**
* 导出标签图片为PDF
*
* @param datas 二维码列表
*/
@PostMapping("exportToPdf")

View File

@ -9,7 +9,6 @@ import com.nflg.wms.admin.pojo.dto.QCMaterialSyncDTO;
import com.nflg.wms.admin.pojo.dto.ZWM3A17DTO;
import com.nflg.wms.admin.repository.SrmMaterialReceiptNoScanCodesRepository;
import com.nflg.wms.admin.repository.SrmMaterialReceiptScanCodesRepository;
import com.nflg.wms.common.constant.BarCodeProcessStage;
import com.nflg.wms.common.pojo.document.SrmMaterialReceiptNoScanCodes;
import com.nflg.wms.common.pojo.document.SrmMaterialReceiptScanCodes;
import com.nflg.wms.common.pojo.dto.*;

View File

@ -2,7 +2,6 @@ package com.nflg.wms.common.pojo.qo;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;
@ -14,7 +13,6 @@ public class StrappingAddQO {
/**
* 待装箱的二维码编号
*/
@NotNull
@NotBlank
private String barcodeCode;
@ -36,7 +34,6 @@ public class StrappingAddQO {
/**
* 待换箱的物料二维码
*/
@NotNull
@NotEmpty
private List<String> items;
}

View File

@ -3,20 +3,18 @@ package com.nflg.wms.repository.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nflg.wms.common.constant.BarCodeProcessStage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.wms.common.exception.NflgException;
import com.nflg.wms.common.pojo.dto.InventoryInDTO;
import com.nflg.wms.common.pojo.dto.InventoryOutDTO;
import com.nflg.wms.common.pojo.qo.FilterIdSearchQO;
import com.nflg.wms.common.pojo.qo.QrCodeItemSearchQO;
import com.nflg.wms.common.pojo.vo.QrCodeItemVO;
import com.nflg.wms.common.util.UserUtil;
import com.nflg.wms.repository.entity.WmsQrCodeMaster;
import com.nflg.wms.repository.entity.WmsTransferOrders;
import com.nflg.wms.repository.mapper.WmsQrCodeMasterMapper;
import com.nflg.wms.repository.service.IWmsInventoryService;
import com.nflg.wms.repository.service.IWmsQrCodeMasterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.wms.repository.service.IWmsTransferOrdersService;
import jakarta.annotation.Resource;
import org.springframework.retry.annotation.Backoff;
@ -24,7 +22,6 @@ import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
/**
@ -100,24 +97,24 @@ public class WmsQrCodeMasterServiceImpl extends ServiceImpl<WmsQrCodeMasterMappe
if (CollectionUtil.isNotEmpty(inBoundInventory)) {
inventoryService.in(inBoundInventory);
}
if (CollectionUtil.isNotEmpty(changeBeforeParentBarcodeCodes)) {
changeBeforeParentBarcodeCodes.forEach(code -> {
WmsQrCodeMaster qrCodeMaster = lambdaQuery()
.eq(WmsQrCodeMaster::getId, code)
.one();
if (qrCodeMaster != null) {
List<WmsQrCodeMaster> smallQcodeMasters = lambdaQuery()
.eq(WmsQrCodeMaster::getParentBarcodeId, code)
.ne(WmsQrCodeMaster::getProcessStage, BarCodeProcessStage.InBound.getState())
.list();
if (CollectionUtil.isEmpty(smallQcodeMasters)) {
qrCodeMaster.setProcessStage(BarCodeProcessStage.OutBound.getState());
smallQrCodeMasters.add(qrCodeMaster);
}
}
});
}
// if (CollectionUtil.isNotEmpty(changeBeforeParentBarcodeCodes)) {
// changeBeforeParentBarcodeCodes.forEach(code -> {
// WmsQrCodeMaster qrCodeMaster = lambdaQuery()
// .eq(WmsQrCodeMaster::getId, code)
// .one();
//
// if (qrCodeMaster != null) {
// List<WmsQrCodeMaster> smallQcodeMasters = lambdaQuery()
// .eq(WmsQrCodeMaster::getParentBarcodeId, code)
// .ne(WmsQrCodeMaster::getProcessStage, BarCodeProcessStage.InBound.getState())
// .list();
// if (CollectionUtil.isEmpty(smallQcodeMasters)) {
// qrCodeMaster.setProcessStage(BarCodeProcessStage.OutBound.getState());
// smallQrCodeMasters.add(qrCodeMaster);
// }
// }
// });
// }
//修改状态
updateBarCode(smallQrCodeMasters);
}