From 1d0f4c032806d66b0912813d5c82d78fec8e128e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Fri, 6 Feb 2026 17:49:13 +0800 Subject: [PATCH] =?UTF-8?q?feat(packaging):=20=E6=96=B0=E5=A2=9E=E6=8B=86?= =?UTF-8?q?=E7=AE=B1=E5=88=A0=E9=99=A4=E7=89=A9=E6=96=99=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=B9=B6=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加unpackDel接口实现PDA拆箱删除物料功能 - 在ShipmentMaterialCodeQRVO中新增deviceNo和customerName字段 - 修改数据库查询语句增加机台编号和客户名称关联查询 - 注释掉原有的materialQRIdsForDel参数相关代码 - 统一状态判断逻辑从等于2改为大于等于2 - 修复序列号生成方法中的空字符串参数格式问题 - 优化代码中的空格和流式操作格式化问题 --- .../common/pojo/qo/ShipmentUnpackingQO.java | 11 +- .../pojo/vo/ShipmentMaterialCodeQRVO.java | 10 ++ .../WmsShipmentPackagingCodeItemMapper.xml | 5 +- .../controller/PackagingCodeController.java | 100 ++++++++++++------ 4 files changed, 85 insertions(+), 41 deletions(-) diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/ShipmentUnpackingQO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/ShipmentUnpackingQO.java index 38853337..9fe8a0ef 100644 --- a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/ShipmentUnpackingQO.java +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/ShipmentUnpackingQO.java @@ -1,6 +1,5 @@ package com.nflg.wms.common.pojo.qo; -import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; import lombok.Data; @@ -20,9 +19,9 @@ public class ShipmentUnpackingQO { */ private List materialQRIdsForAdd; - /** - * 要删除的物料二维码ID列表 - */ - @NotEmpty - private List materialQRIdsForDel; +// /** +// * 要删除的物料二维码ID列表 +// */ +// @NotEmpty +// private List materialQRIdsForDel; } diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/vo/ShipmentMaterialCodeQRVO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/vo/ShipmentMaterialCodeQRVO.java index 81f9d8d9..39a3d07f 100644 --- a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/vo/ShipmentMaterialCodeQRVO.java +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/vo/ShipmentMaterialCodeQRVO.java @@ -49,4 +49,14 @@ public class ShipmentMaterialCodeQRVO { */ private Integer status; + /** + * 机台编号 + */ + private String deviceNo; + + /** + * 客户名称 + */ + private String customerName; + } diff --git a/nflg-wms-repository/src/main/resources/mapper/WmsShipmentPackagingCodeItemMapper.xml b/nflg-wms-repository/src/main/resources/mapper/WmsShipmentPackagingCodeItemMapper.xml index 67268aa4..1b850dca 100644 --- a/nflg-wms-repository/src/main/resources/mapper/WmsShipmentPackagingCodeItemMapper.xml +++ b/nflg-wms-repository/src/main/resources/mapper/WmsShipmentPackagingCodeItemMapper.xml @@ -3,10 +3,13 @@ diff --git a/nflg-wms-shipment/src/main/java/com/nflg/wms/shipment/controller/PackagingCodeController.java b/nflg-wms-shipment/src/main/java/com/nflg/wms/shipment/controller/PackagingCodeController.java index 655fa0dc..36a66b53 100644 --- a/nflg-wms-shipment/src/main/java/com/nflg/wms/shipment/controller/PackagingCodeController.java +++ b/nflg-wms-shipment/src/main/java/com/nflg/wms/shipment/controller/PackagingCodeController.java @@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.*; import java.time.LocalDateTime; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -66,7 +67,7 @@ public class PackagingCodeController extends BaseController { List datas = new ArrayList<>(); IntStream.range(0, count).forEach(i -> { WmsShipmentPackagingCode packagingCode = new WmsShipmentPackagingCode(); - packagingCode.setNo(serialNumberControllerService.generateSerialNumber(28,"",3)); + packagingCode.setNo(serialNumberControllerService.generateSerialNumber(28, "", 3)); packagingCode.setCreateBy(UserUtil.getUserName()); packagingCode.setCreateTime(LocalDateTime.now()); datas.add(packagingCode); @@ -122,8 +123,8 @@ public class PackagingCodeController extends BaseController { @PostMapping("search") public ApiResult> search(@Valid @RequestBody PackagingCodeSearchQO request) { List types = dictionaryItemService.getListByDictionaryCode("PackagingType"); - IPage datas= packagingCodeService.lambdaQuery() - .in(CollectionUtil.isNotEmpty(request.getStatus()),WmsShipmentPackagingCode::getStatus, request.getStatus()) + IPage datas = packagingCodeService.lambdaQuery() + .in(CollectionUtil.isNotEmpty(request.getStatus()), WmsShipmentPackagingCode::getStatus, request.getStatus()) .ge(Objects.nonNull(request.getStartDate()), WmsShipmentPackagingCode::getCreateTime, request.getStartDate()) .le(Objects.nonNull(request.getEndDate()), WmsShipmentPackagingCode::getCreateTime, request.getEndDate()) .like(StrUtil.isNotBlank(request.getNo()), WmsShipmentPackagingCode::getNo, request.getNo()) @@ -136,16 +137,16 @@ public class PackagingCodeController extends BaseController { .setPage(request.getPage()) .setPageSize(request.getPageSize()) .setTotal((int) datas.getTotal()) - .setItems(datas.getRecords().stream().map(data->{ - ShipmentPackagingCodeVO vo= Convert.convert(ShipmentPackagingCodeVO.class, data); + .setItems(datas.getRecords().stream().map(data -> { + ShipmentPackagingCodeVO vo = Convert.convert(ShipmentPackagingCodeVO.class, data); vo.setTypeName(types.stream() - .filter(type->type.getId().equals(data.getType())) + .filter(type -> type.getId().equals(data.getType())) .map(DictionaryItem::getName) .findFirst() .orElse("") ); return vo; - }).toList() + }).toList() ) ); } @@ -211,6 +212,37 @@ public class PackagingCodeController extends BaseController { return ApiResult.success(packagingCodeItemService.getPackList(packagingCodeId)); } + /** + * 拆箱-删除物料(PDA使用) + */ + @PostMapping("unpackDel") + public ApiResult unpackDel(@RequestBody Long id) { + WmsShipmentPackagingCodeItem item = packagingCodeItemService.lambdaQuery() + .eq(WmsShipmentPackagingCodeItem::getId, id) + .one(); + if (Objects.nonNull(item)) { + WmsShipmentPackagingCode info = packagingCodeService.getById(item.getPackagingCodeId()); + VUtil.trueThrowBusinessError(Objects.isNull(info)).throwMessage("包装箱不存在"); + VUtil.trueThrowBusinessError(info.getStatus() >= 2).throwMessage("该箱已装车"); + packagingCodeItemService.removeById(id); + WmsShipmentMaterialCodeItemQr qr = materialCodeItemQrService.lambdaQuery() + .eq(WmsShipmentMaterialCodeItemQr::getStatus, 1) + .eq(WmsShipmentMaterialCodeItemQr::getId, item.getMaterialCodeItemQrId()) + .one(); + if (Objects.nonNull(qr)) { + materialCodeItemQrService.lambdaUpdate() + .set(WmsShipmentMaterialCodeItemQr::getStatus, 0) + .set(WmsShipmentMaterialCodeItemQr::getUpdateBy, UserUtil.getUserName()) + .set(WmsShipmentMaterialCodeItemQr::getUpdateTime, LocalDateTime.now()) + .eq(WmsShipmentMaterialCodeItemQr::getStatus, 1) + .in(WmsShipmentMaterialCodeItemQr::getId, item.getMaterialCodeItemQrId()) + .update(); + materialCodeItemService.updatePackingNum(Collections.singleton(qr.getItemId())); + } + } + return ApiResult.success(); + } + /** * 拆箱&添加物料(PDA使用) */ @@ -219,7 +251,7 @@ public class PackagingCodeController extends BaseController { public ApiResult unpack(@Valid @RequestBody ShipmentUnpackingQO qo) { WmsShipmentPackagingCode info = packagingCodeService.getById(qo.getPackagingCodeId()); VUtil.trueThrowBusinessError(Objects.isNull(info)).throwMessage("包装箱不存在"); - VUtil.trueThrowBusinessError(info.getStatus() == 2).throwMessage("该箱已发车"); + VUtil.trueThrowBusinessError(info.getStatus() >= 2).throwMessage("该箱已装车"); if (CollectionUtil.isNotEmpty(qo.getMaterialQRIdsForAdd())) { List qrs = materialCodeItemQrService.lambdaQuery() .eq(WmsShipmentMaterialCodeItemQr::getStatus, 0) @@ -252,32 +284,32 @@ public class PackagingCodeController extends BaseController { materialCodeItemService.updatePackingNum(qrs.stream().map(WmsShipmentMaterialCodeItemQr::getItemId).collect(Collectors.toSet())); } } - if (CollectionUtil.isNotEmpty(qo.getMaterialQRIdsForDel())) { - List items = packagingCodeItemService.lambdaQuery() - .eq(WmsShipmentPackagingCodeItem::getPackagingCodeId, qo.getPackagingCodeId()) - .in(WmsShipmentPackagingCodeItem::getId, qo.getMaterialQRIdsForDel()) - .list(); - if (CollectionUtil.isNotEmpty(items)) { - packagingCodeItemService.lambdaUpdate() - .eq(WmsShipmentPackagingCodeItem::getPackagingCodeId, qo.getPackagingCodeId()) - .in(WmsShipmentPackagingCodeItem::getId, qo.getMaterialQRIdsForDel()) - .remove(); - List qrs = materialCodeItemQrService.lambdaQuery() - .eq(WmsShipmentMaterialCodeItemQr::getStatus, 1) - .in(WmsShipmentMaterialCodeItemQr::getId, items.stream().map(WmsShipmentPackagingCodeItem::getMaterialCodeItemQrId).toList()) - .list(); - if (CollectionUtil.isNotEmpty(qrs)) { - materialCodeItemQrService.lambdaUpdate() - .set(WmsShipmentMaterialCodeItemQr::getStatus, 0) - .set(WmsShipmentMaterialCodeItemQr::getUpdateBy, UserUtil.getUserName()) - .set(WmsShipmentMaterialCodeItemQr::getUpdateTime, LocalDateTime.now()) - .eq(WmsShipmentMaterialCodeItemQr::getStatus, 1) - .in(WmsShipmentMaterialCodeItemQr::getId, items.stream().map(WmsShipmentPackagingCodeItem::getMaterialCodeItemQrId).toList()) - .update(); - materialCodeItemService.updatePackingNum(qrs.stream().map(WmsShipmentMaterialCodeItemQr::getItemId).collect(Collectors.toSet())); - } - } - } +// if (CollectionUtil.isNotEmpty(qo.getMaterialQRIdsForDel())) { +// List items = packagingCodeItemService.lambdaQuery() +// .eq(WmsShipmentPackagingCodeItem::getPackagingCodeId, qo.getPackagingCodeId()) +// .in(WmsShipmentPackagingCodeItem::getId, qo.getMaterialQRIdsForDel()) +// .list(); +// if (CollectionUtil.isNotEmpty(items)) { +// packagingCodeItemService.lambdaUpdate() +// .eq(WmsShipmentPackagingCodeItem::getPackagingCodeId, qo.getPackagingCodeId()) +// .in(WmsShipmentPackagingCodeItem::getId, qo.getMaterialQRIdsForDel()) +// .remove(); +// List qrs = materialCodeItemQrService.lambdaQuery() +// .eq(WmsShipmentMaterialCodeItemQr::getStatus, 1) +// .in(WmsShipmentMaterialCodeItemQr::getId, items.stream().map(WmsShipmentPackagingCodeItem::getMaterialCodeItemQrId).toList()) +// .list(); +// if (CollectionUtil.isNotEmpty(qrs)) { +// materialCodeItemQrService.lambdaUpdate() +// .set(WmsShipmentMaterialCodeItemQr::getStatus, 0) +// .set(WmsShipmentMaterialCodeItemQr::getUpdateBy, UserUtil.getUserName()) +// .set(WmsShipmentMaterialCodeItemQr::getUpdateTime, LocalDateTime.now()) +// .eq(WmsShipmentMaterialCodeItemQr::getStatus, 1) +// .in(WmsShipmentMaterialCodeItemQr::getId, items.stream().map(WmsShipmentPackagingCodeItem::getMaterialCodeItemQrId).toList()) +// .update(); +// materialCodeItemService.updatePackingNum(qrs.stream().map(WmsShipmentMaterialCodeItemQr::getItemId).collect(Collectors.toSet())); +// } +// } +// } packagingCodeService.updateStatus(qo.getPackagingCodeId()); return ApiResult.success(); }