feat(packaging): 新增拆箱删除物料功能并优化查询接口
- 添加unpackDel接口实现PDA拆箱删除物料功能 - 在ShipmentMaterialCodeQRVO中新增deviceNo和customerName字段 - 修改数据库查询语句增加机台编号和客户名称关联查询 - 注释掉原有的materialQRIdsForDel参数相关代码 - 统一状态判断逻辑从等于2改为大于等于2 - 修复序列号生成方法中的空字符串参数格式问题 - 优化代码中的空格和流式操作格式化问题
This commit is contained in:
parent
7ac9f182ed
commit
1d0f4c0328
|
|
@ -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<Long> materialQRIdsForAdd;
|
||||
|
||||
/**
|
||||
* 要删除的物料二维码ID列表
|
||||
*/
|
||||
@NotEmpty
|
||||
private List<Long> materialQRIdsForDel;
|
||||
// /**
|
||||
// * 要删除的物料二维码ID列表
|
||||
// */
|
||||
// @NotEmpty
|
||||
// private List<Long> materialQRIdsForDel;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,4 +49,14 @@ public class ShipmentMaterialCodeQRVO {
|
|||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 机台编号
|
||||
*/
|
||||
private String deviceNo;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String customerName;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,13 @@
|
|||
<mapper namespace="com.nflg.wms.repository.mapper.WmsShipmentPackagingCodeItemMapper">
|
||||
|
||||
<select id="getPackList" resultType="com.nflg.wms.common.pojo.vo.ShipmentMaterialCodeQRVO">
|
||||
SELECT ROW_NUMBER() OVER () AS "index",it."id",qr.no,cit.material_no,cit.material_describe,cit.num,qr.num as actualNum,cit.unit
|
||||
SELECT ROW_NUMBER() OVER () AS "index",it."id",qr.no,cit.material_no,cit.material_describe,cit.num
|
||||
,qr.num as actualNum,cit.unit,d.device_no,d.customer_name
|
||||
FROM wms_shipment_packaging_code_item it
|
||||
INNER JOIN wms_shipment_material_code_item_qr qr ON it.material_code_item_qr_id=qr."id"
|
||||
INNER JOIN wms_shipment_material_code_item cit ON qr.item_id=cit."id"
|
||||
LEFT JOIN wms_shipment_delivery_item di ON di.packaging_code_id=it.packaging_code_id
|
||||
LEFT JOIN wms_shipment_delivery d ON di.delivery_id=d."id"
|
||||
where it.packaging_code_id=#{packagingCodeId}
|
||||
order by cit.id
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -211,6 +212,37 @@ public class PackagingCodeController extends BaseController {
|
|||
return ApiResult.success(packagingCodeItemService.getPackList(packagingCodeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 拆箱-删除物料(PDA使用)
|
||||
*/
|
||||
@PostMapping("unpackDel")
|
||||
public ApiResult<Void> 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<Void> 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<WmsShipmentMaterialCodeItemQr> 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<WmsShipmentPackagingCodeItem> 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<WmsShipmentMaterialCodeItemQr> 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<WmsShipmentPackagingCodeItem> 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<WmsShipmentMaterialCodeItemQr> 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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue