装箱打包增加pc端版本方法
This commit is contained in:
parent
7b7ce757e0
commit
e82c429e50
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.nflg.wms.common.pojo.qo;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ShipmentPCPackingQO {
|
||||||
|
/**
|
||||||
|
* 包装箱ID
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
private Long packagingCodeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料条码号
|
||||||
|
*/
|
||||||
|
@NotEmpty
|
||||||
|
private List<String> codes;
|
||||||
|
}
|
||||||
|
|
@ -211,6 +211,58 @@ public class PackagingCodeController extends BaseController {
|
||||||
return ApiResult.success();
|
return ApiResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装箱打包(PC使用)
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
@PostMapping("pcPack")
|
||||||
|
public ApiResult<Void> pcPack(@Valid @RequestBody ShipmentPCPackingQO shipmentPCPackingQO){
|
||||||
|
List<Long> ids = shipmentPCPackingQO.getCodes().stream()
|
||||||
|
.map(code -> materialCodeItemQrService.getInfoByQRCode(code))
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.map(ShipmentMaterialCodeQRVO::getId)
|
||||||
|
.toList();
|
||||||
|
List<WmsShipmentMaterialCodeItemQr> items = materialCodeItemQrService.lambdaQuery()
|
||||||
|
.in(WmsShipmentMaterialCodeItemQr::getId, ids)
|
||||||
|
.list();
|
||||||
|
VUtil.trueThrowBusinessError(items.size() != ids.size()).throwMessage("数据有变动,请重新扫码");
|
||||||
|
items.removeIf(item -> item.getStatus() == 1);
|
||||||
|
if (CollectionUtil.isEmpty(items)) {
|
||||||
|
return ApiResult.success();
|
||||||
|
}
|
||||||
|
WmsShipmentPackagingCode info = packagingCodeService.getById(shipmentPCPackingQO.getPackagingCodeId());
|
||||||
|
VUtil.trueThrowBusinessError(Objects.isNull(info)).throwMessage("包装箱不存在");
|
||||||
|
VUtil.trueThrowBusinessError(info.getStatus() == 2).throwMessage("该箱已发车");
|
||||||
|
if (info.getStatus() == 0) {
|
||||||
|
packagingCodeService.lambdaUpdate()
|
||||||
|
.set(WmsShipmentPackagingCode::getStatus, 1)
|
||||||
|
.set(WmsShipmentPackagingCode::getUpdateBy, UserUtil.getUserName())
|
||||||
|
.set(WmsShipmentPackagingCode::getUpdateTime, LocalDateTime.now())
|
||||||
|
.eq(WmsShipmentPackagingCode::getId, shipmentPCPackingQO.getPackagingCodeId())
|
||||||
|
.eq(WmsShipmentPackagingCode::getStatus, 0)
|
||||||
|
.update();
|
||||||
|
}
|
||||||
|
items.forEach(item -> {
|
||||||
|
item.setStatus(1);
|
||||||
|
item.setUpdateBy(UserUtil.getUserName());
|
||||||
|
item.setUpdateTime(LocalDateTime.now());
|
||||||
|
});
|
||||||
|
packagingCodeItemService.saveBatch(
|
||||||
|
items.stream().map(it -> new WmsShipmentPackagingCodeItem()
|
||||||
|
.setPackagingCodeId(shipmentPCPackingQO.getPackagingCodeId())
|
||||||
|
.setMaterialCodeItemQrId(it.getId())
|
||||||
|
.setCreateBy(UserUtil.getUserName())
|
||||||
|
.setCreateTime(LocalDateTime.now())
|
||||||
|
).toList()
|
||||||
|
);
|
||||||
|
materialCodeItemQrService.updateBatchById(items);
|
||||||
|
materialCodeItemService.updatePackingNum(items.stream()
|
||||||
|
.map(WmsShipmentMaterialCodeItemQr::getItemId)
|
||||||
|
.collect(Collectors.toSet())
|
||||||
|
);
|
||||||
|
return ApiResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取包装已打包的物料列表(PDA使用)
|
* 获取包装已打包的物料列表(PDA使用)
|
||||||
* @param packagingCodeId 包装箱ID
|
* @param packagingCodeId 包装箱ID
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue