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;
|
package com.nflg.wms.common.pojo.qo;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -20,9 +19,9 @@ public class ShipmentUnpackingQO {
|
||||||
*/
|
*/
|
||||||
private List<Long> materialQRIdsForAdd;
|
private List<Long> materialQRIdsForAdd;
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 要删除的物料二维码ID列表
|
// * 要删除的物料二维码ID列表
|
||||||
*/
|
// */
|
||||||
@NotEmpty
|
// @NotEmpty
|
||||||
private List<Long> materialQRIdsForDel;
|
// private List<Long> materialQRIdsForDel;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,4 +49,14 @@ public class ShipmentMaterialCodeQRVO {
|
||||||
*/
|
*/
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机台编号
|
||||||
|
*/
|
||||||
|
private String deviceNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户名称
|
||||||
|
*/
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,13 @@
|
||||||
<mapper namespace="com.nflg.wms.repository.mapper.WmsShipmentPackagingCodeItemMapper">
|
<mapper namespace="com.nflg.wms.repository.mapper.WmsShipmentPackagingCodeItemMapper">
|
||||||
|
|
||||||
<select id="getPackList" resultType="com.nflg.wms.common.pojo.vo.ShipmentMaterialCodeQRVO">
|
<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
|
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_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"
|
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}
|
where it.packaging_code_id=#{packagingCodeId}
|
||||||
order by cit.id
|
order by cit.id
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
@ -66,7 +67,7 @@ public class PackagingCodeController extends BaseController {
|
||||||
List<WmsShipmentPackagingCode> datas = new ArrayList<>();
|
List<WmsShipmentPackagingCode> datas = new ArrayList<>();
|
||||||
IntStream.range(0, count).forEach(i -> {
|
IntStream.range(0, count).forEach(i -> {
|
||||||
WmsShipmentPackagingCode packagingCode = new WmsShipmentPackagingCode();
|
WmsShipmentPackagingCode packagingCode = new WmsShipmentPackagingCode();
|
||||||
packagingCode.setNo(serialNumberControllerService.generateSerialNumber(28,"",3));
|
packagingCode.setNo(serialNumberControllerService.generateSerialNumber(28, "", 3));
|
||||||
packagingCode.setCreateBy(UserUtil.getUserName());
|
packagingCode.setCreateBy(UserUtil.getUserName());
|
||||||
packagingCode.setCreateTime(LocalDateTime.now());
|
packagingCode.setCreateTime(LocalDateTime.now());
|
||||||
datas.add(packagingCode);
|
datas.add(packagingCode);
|
||||||
|
|
@ -122,8 +123,8 @@ public class PackagingCodeController extends BaseController {
|
||||||
@PostMapping("search")
|
@PostMapping("search")
|
||||||
public ApiResult<PageData<ShipmentPackagingCodeVO>> search(@Valid @RequestBody PackagingCodeSearchQO request) {
|
public ApiResult<PageData<ShipmentPackagingCodeVO>> search(@Valid @RequestBody PackagingCodeSearchQO request) {
|
||||||
List<DictionaryItem> types = dictionaryItemService.getListByDictionaryCode("PackagingType");
|
List<DictionaryItem> types = dictionaryItemService.getListByDictionaryCode("PackagingType");
|
||||||
IPage<WmsShipmentPackagingCode> datas= packagingCodeService.lambdaQuery()
|
IPage<WmsShipmentPackagingCode> datas = packagingCodeService.lambdaQuery()
|
||||||
.in(CollectionUtil.isNotEmpty(request.getStatus()),WmsShipmentPackagingCode::getStatus, request.getStatus())
|
.in(CollectionUtil.isNotEmpty(request.getStatus()), WmsShipmentPackagingCode::getStatus, request.getStatus())
|
||||||
.ge(Objects.nonNull(request.getStartDate()), WmsShipmentPackagingCode::getCreateTime, request.getStartDate())
|
.ge(Objects.nonNull(request.getStartDate()), WmsShipmentPackagingCode::getCreateTime, request.getStartDate())
|
||||||
.le(Objects.nonNull(request.getEndDate()), WmsShipmentPackagingCode::getCreateTime, request.getEndDate())
|
.le(Objects.nonNull(request.getEndDate()), WmsShipmentPackagingCode::getCreateTime, request.getEndDate())
|
||||||
.like(StrUtil.isNotBlank(request.getNo()), WmsShipmentPackagingCode::getNo, request.getNo())
|
.like(StrUtil.isNotBlank(request.getNo()), WmsShipmentPackagingCode::getNo, request.getNo())
|
||||||
|
|
@ -136,10 +137,10 @@ public class PackagingCodeController extends BaseController {
|
||||||
.setPage(request.getPage())
|
.setPage(request.getPage())
|
||||||
.setPageSize(request.getPageSize())
|
.setPageSize(request.getPageSize())
|
||||||
.setTotal((int) datas.getTotal())
|
.setTotal((int) datas.getTotal())
|
||||||
.setItems(datas.getRecords().stream().map(data->{
|
.setItems(datas.getRecords().stream().map(data -> {
|
||||||
ShipmentPackagingCodeVO vo= Convert.convert(ShipmentPackagingCodeVO.class, data);
|
ShipmentPackagingCodeVO vo = Convert.convert(ShipmentPackagingCodeVO.class, data);
|
||||||
vo.setTypeName(types.stream()
|
vo.setTypeName(types.stream()
|
||||||
.filter(type->type.getId().equals(data.getType()))
|
.filter(type -> type.getId().equals(data.getType()))
|
||||||
.map(DictionaryItem::getName)
|
.map(DictionaryItem::getName)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse("")
|
.orElse("")
|
||||||
|
|
@ -211,6 +212,37 @@ public class PackagingCodeController extends BaseController {
|
||||||
return ApiResult.success(packagingCodeItemService.getPackList(packagingCodeId));
|
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使用)
|
* 拆箱&添加物料(PDA使用)
|
||||||
*/
|
*/
|
||||||
|
|
@ -219,7 +251,7 @@ public class PackagingCodeController extends BaseController {
|
||||||
public ApiResult<Void> unpack(@Valid @RequestBody ShipmentUnpackingQO qo) {
|
public ApiResult<Void> unpack(@Valid @RequestBody ShipmentUnpackingQO qo) {
|
||||||
WmsShipmentPackagingCode info = packagingCodeService.getById(qo.getPackagingCodeId());
|
WmsShipmentPackagingCode info = packagingCodeService.getById(qo.getPackagingCodeId());
|
||||||
VUtil.trueThrowBusinessError(Objects.isNull(info)).throwMessage("包装箱不存在");
|
VUtil.trueThrowBusinessError(Objects.isNull(info)).throwMessage("包装箱不存在");
|
||||||
VUtil.trueThrowBusinessError(info.getStatus() == 2).throwMessage("该箱已发车");
|
VUtil.trueThrowBusinessError(info.getStatus() >= 2).throwMessage("该箱已装车");
|
||||||
if (CollectionUtil.isNotEmpty(qo.getMaterialQRIdsForAdd())) {
|
if (CollectionUtil.isNotEmpty(qo.getMaterialQRIdsForAdd())) {
|
||||||
List<WmsShipmentMaterialCodeItemQr> qrs = materialCodeItemQrService.lambdaQuery()
|
List<WmsShipmentMaterialCodeItemQr> qrs = materialCodeItemQrService.lambdaQuery()
|
||||||
.eq(WmsShipmentMaterialCodeItemQr::getStatus, 0)
|
.eq(WmsShipmentMaterialCodeItemQr::getStatus, 0)
|
||||||
|
|
@ -252,32 +284,32 @@ public class PackagingCodeController extends BaseController {
|
||||||
materialCodeItemService.updatePackingNum(qrs.stream().map(WmsShipmentMaterialCodeItemQr::getItemId).collect(Collectors.toSet()));
|
materialCodeItemService.updatePackingNum(qrs.stream().map(WmsShipmentMaterialCodeItemQr::getItemId).collect(Collectors.toSet()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(qo.getMaterialQRIdsForDel())) {
|
// if (CollectionUtil.isNotEmpty(qo.getMaterialQRIdsForDel())) {
|
||||||
List<WmsShipmentPackagingCodeItem> items = packagingCodeItemService.lambdaQuery()
|
// List<WmsShipmentPackagingCodeItem> items = packagingCodeItemService.lambdaQuery()
|
||||||
.eq(WmsShipmentPackagingCodeItem::getPackagingCodeId, qo.getPackagingCodeId())
|
// .eq(WmsShipmentPackagingCodeItem::getPackagingCodeId, qo.getPackagingCodeId())
|
||||||
.in(WmsShipmentPackagingCodeItem::getId, qo.getMaterialQRIdsForDel())
|
// .in(WmsShipmentPackagingCodeItem::getId, qo.getMaterialQRIdsForDel())
|
||||||
.list();
|
// .list();
|
||||||
if (CollectionUtil.isNotEmpty(items)) {
|
// if (CollectionUtil.isNotEmpty(items)) {
|
||||||
packagingCodeItemService.lambdaUpdate()
|
// packagingCodeItemService.lambdaUpdate()
|
||||||
.eq(WmsShipmentPackagingCodeItem::getPackagingCodeId, qo.getPackagingCodeId())
|
// .eq(WmsShipmentPackagingCodeItem::getPackagingCodeId, qo.getPackagingCodeId())
|
||||||
.in(WmsShipmentPackagingCodeItem::getId, qo.getMaterialQRIdsForDel())
|
// .in(WmsShipmentPackagingCodeItem::getId, qo.getMaterialQRIdsForDel())
|
||||||
.remove();
|
// .remove();
|
||||||
List<WmsShipmentMaterialCodeItemQr> qrs = materialCodeItemQrService.lambdaQuery()
|
// List<WmsShipmentMaterialCodeItemQr> qrs = materialCodeItemQrService.lambdaQuery()
|
||||||
.eq(WmsShipmentMaterialCodeItemQr::getStatus, 1)
|
// .eq(WmsShipmentMaterialCodeItemQr::getStatus, 1)
|
||||||
.in(WmsShipmentMaterialCodeItemQr::getId, items.stream().map(WmsShipmentPackagingCodeItem::getMaterialCodeItemQrId).toList())
|
// .in(WmsShipmentMaterialCodeItemQr::getId, items.stream().map(WmsShipmentPackagingCodeItem::getMaterialCodeItemQrId).toList())
|
||||||
.list();
|
// .list();
|
||||||
if (CollectionUtil.isNotEmpty(qrs)) {
|
// if (CollectionUtil.isNotEmpty(qrs)) {
|
||||||
materialCodeItemQrService.lambdaUpdate()
|
// materialCodeItemQrService.lambdaUpdate()
|
||||||
.set(WmsShipmentMaterialCodeItemQr::getStatus, 0)
|
// .set(WmsShipmentMaterialCodeItemQr::getStatus, 0)
|
||||||
.set(WmsShipmentMaterialCodeItemQr::getUpdateBy, UserUtil.getUserName())
|
// .set(WmsShipmentMaterialCodeItemQr::getUpdateBy, UserUtil.getUserName())
|
||||||
.set(WmsShipmentMaterialCodeItemQr::getUpdateTime, LocalDateTime.now())
|
// .set(WmsShipmentMaterialCodeItemQr::getUpdateTime, LocalDateTime.now())
|
||||||
.eq(WmsShipmentMaterialCodeItemQr::getStatus, 1)
|
// .eq(WmsShipmentMaterialCodeItemQr::getStatus, 1)
|
||||||
.in(WmsShipmentMaterialCodeItemQr::getId, items.stream().map(WmsShipmentPackagingCodeItem::getMaterialCodeItemQrId).toList())
|
// .in(WmsShipmentMaterialCodeItemQr::getId, items.stream().map(WmsShipmentPackagingCodeItem::getMaterialCodeItemQrId).toList())
|
||||||
.update();
|
// .update();
|
||||||
materialCodeItemService.updatePackingNum(qrs.stream().map(WmsShipmentMaterialCodeItemQr::getItemId).collect(Collectors.toSet()));
|
// materialCodeItemService.updatePackingNum(qrs.stream().map(WmsShipmentMaterialCodeItemQr::getItemId).collect(Collectors.toSet()));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
packagingCodeService.updateStatus(qo.getPackagingCodeId());
|
packagingCodeService.updateStatus(qo.getPackagingCodeId());
|
||||||
return ApiResult.success();
|
return ApiResult.success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue