fix(logic): 修复齐套物料处理逻辑并优化空值处理
- 在多个控制器中添加useChildren字段判断条件,防止扫码子项时的错误验证
- 将findFirst().get()替换为map().orElse("")模式,避免潜在的NoSuchElementException异常
- 在OutProduceSubmitItemQO中新增useChildren字段用于标识是否扫码子项
- 修复代码中的空行和格式问题,提升代码可读性
This commit is contained in:
parent
6983786067
commit
51b2f3b9a3
|
|
@ -408,8 +408,8 @@ public class ComponentOutboundController extends BaseController {
|
||||||
.setBinLocation(qrCodeMasters.stream()
|
.setBinLocation(qrCodeMasters.stream()
|
||||||
.filter(qr -> StrUtil.equals(qr.getBarcodeCode(), list.get(0).getUniqNo()))
|
.filter(qr -> StrUtil.equals(qr.getBarcodeCode(), list.get(0).getUniqNo()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.get()
|
.map(WmsQrCodeMaster::getBinLocation)
|
||||||
.getBinLocation()
|
.orElse("")
|
||||||
)
|
)
|
||||||
.setNum(list.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
.setNum(list.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
||||||
).toList()
|
).toList()
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,7 @@ public class OutAssistanceController extends BaseController {
|
||||||
ticketItems.add(ti);
|
ticketItems.add(ti);
|
||||||
return ti;
|
return ti;
|
||||||
});
|
});
|
||||||
if (qitem.isQiTao()) {
|
if (qitem.isQiTao() && !qitem.isUseChildren()) {
|
||||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getBatchs()))
|
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getBatchs()))
|
||||||
.throwMessage("齐套物料需要提供批次信息");
|
.throwMessage("齐套物料需要提供批次信息");
|
||||||
qitem.getBatchs()
|
qitem.getBatchs()
|
||||||
|
|
@ -380,8 +380,8 @@ public class OutAssistanceController extends BaseController {
|
||||||
.setBinLocation(qrCodeMasters.stream()
|
.setBinLocation(qrCodeMasters.stream()
|
||||||
.filter(qr -> StrUtil.equals(qr.getBarcodeCode(), list.get(0).getUniqNo()))
|
.filter(qr -> StrUtil.equals(qr.getBarcodeCode(), list.get(0).getUniqNo()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.get()
|
.map(WmsQrCodeMaster::getBinLocation)
|
||||||
.getBinLocation()
|
.orElse("")
|
||||||
)
|
)
|
||||||
.setNum(list.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
.setNum(list.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
||||||
).toList()
|
).toList()
|
||||||
|
|
|
||||||
|
|
@ -243,7 +243,7 @@ public class OutCostCenterController extends BaseController {
|
||||||
ticketItems.add(ti);
|
ticketItems.add(ti);
|
||||||
return ti;
|
return ti;
|
||||||
});
|
});
|
||||||
if (qitem.isQiTao()) {
|
if (qitem.isQiTao() && !qitem.isUseChildren()) {
|
||||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getBatchs()))
|
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getBatchs()))
|
||||||
.throwMessage("齐套物料需要提供批次信息");
|
.throwMessage("齐套物料需要提供批次信息");
|
||||||
qitem.getBatchs()
|
qitem.getBatchs()
|
||||||
|
|
@ -371,8 +371,8 @@ public class OutCostCenterController extends BaseController {
|
||||||
.setBinLocation(qrCodeMasters.stream()
|
.setBinLocation(qrCodeMasters.stream()
|
||||||
.filter(qr -> StrUtil.equals(qr.getBarcodeCode(), list.get(0).getUniqNo()))
|
.filter(qr -> StrUtil.equals(qr.getBarcodeCode(), list.get(0).getUniqNo()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.get()
|
.map(WmsQrCodeMaster::getBinLocation)
|
||||||
.getBinLocation()
|
.orElse("")
|
||||||
)
|
)
|
||||||
.setNum(list.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
.setNum(list.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
||||||
).toList()
|
).toList()
|
||||||
|
|
|
||||||
|
|
@ -357,7 +357,7 @@ public class OutProduceController extends BaseController {
|
||||||
ticketItems.add(ti);
|
ticketItems.add(ti);
|
||||||
return ti;
|
return ti;
|
||||||
});
|
});
|
||||||
if (qitem.isQiTao()) {
|
if (qitem.isQiTao() && !qitem.isUseChildren()) {
|
||||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getBatchs()))
|
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getBatchs()))
|
||||||
.throwMessage("齐套物料需要提供批次信息");
|
.throwMessage("齐套物料需要提供批次信息");
|
||||||
qitem.getBatchs()
|
qitem.getBatchs()
|
||||||
|
|
@ -495,8 +495,8 @@ public class OutProduceController extends BaseController {
|
||||||
.setBinLocation(qrCodeMasters.stream()
|
.setBinLocation(qrCodeMasters.stream()
|
||||||
.filter(qr -> StrUtil.equals(qr.getBarcodeCode(), list.get(0).getUniqNo()))
|
.filter(qr -> StrUtil.equals(qr.getBarcodeCode(), list.get(0).getUniqNo()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.get()
|
.map(WmsQrCodeMaster::getBinLocation)
|
||||||
.getBinLocation()
|
.orElse("")
|
||||||
)
|
)
|
||||||
.setNum(list.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
.setNum(list.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
||||||
).toList()
|
).toList()
|
||||||
|
|
|
||||||
|
|
@ -283,8 +283,8 @@ public class OutPurchaseController extends BaseController {
|
||||||
.setBinLocation(qrCodeMasters.stream()
|
.setBinLocation(qrCodeMasters.stream()
|
||||||
.filter(qr -> StrUtil.equals(qr.getBarcodeCode(), list.get(0).getUniqNo()))
|
.filter(qr -> StrUtil.equals(qr.getBarcodeCode(), list.get(0).getUniqNo()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.get()
|
.map(WmsQrCodeMaster::getBinLocation)
|
||||||
.getBinLocation()
|
.orElse("")
|
||||||
)
|
)
|
||||||
.setNum(list.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
.setNum(list.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
||||||
).toList()
|
).toList()
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@ public class TransferCompanyController extends BaseController {
|
||||||
ticketItems.add(ti);
|
ticketItems.add(ti);
|
||||||
return ti;
|
return ti;
|
||||||
});
|
});
|
||||||
if (qitem.isQiTao()) {
|
if (qitem.isQiTao() && !qitem.isUseChildren()) {
|
||||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getBatchs()))
|
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getBatchs()))
|
||||||
.throwMessage("齐套物料需要提供批次信息");
|
.throwMessage("齐套物料需要提供批次信息");
|
||||||
qitem.getBatchs()
|
qitem.getBatchs()
|
||||||
|
|
@ -416,8 +416,8 @@ public class TransferCompanyController extends BaseController {
|
||||||
.setBinLocation(qrCodeMasters.stream()
|
.setBinLocation(qrCodeMasters.stream()
|
||||||
.filter(qr -> StrUtil.equals(qr.getBarcodeCode(), list.get(0).getUniqNo()))
|
.filter(qr -> StrUtil.equals(qr.getBarcodeCode(), list.get(0).getUniqNo()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.get()
|
.map(WmsQrCodeMaster::getBinLocation)
|
||||||
.getBinLocation()
|
.orElse("")
|
||||||
)
|
)
|
||||||
.setNum(list.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
.setNum(list.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
||||||
).toList()
|
).toList()
|
||||||
|
|
|
||||||
|
|
@ -275,7 +275,6 @@ public class TransferFactoryController extends BaseController {
|
||||||
.list();
|
.list();
|
||||||
qrCodeMasters.addAll(tempList);
|
qrCodeMasters.addAll(tempList);
|
||||||
}
|
}
|
||||||
|
|
||||||
request.getItems().forEach(qitem -> {
|
request.getItems().forEach(qitem -> {
|
||||||
WmsTransferFactoryItem item = datas.stream().filter(d -> Objects.equals(d.getId(), qitem.getItemId())).findFirst().orElse(null);
|
WmsTransferFactoryItem item = datas.stream().filter(d -> Objects.equals(d.getId(), qitem.getItemId())).findFirst().orElse(null);
|
||||||
VUtil.trueThrowBusinessError(Objects.isNull(item)).throwMessage("物料" + qitem.getMaterialNo() + "不需要出库");
|
VUtil.trueThrowBusinessError(Objects.isNull(item)).throwMessage("物料" + qitem.getMaterialNo() + "不需要出库");
|
||||||
|
|
@ -292,7 +291,7 @@ public class TransferFactoryController extends BaseController {
|
||||||
ticketItems.add(ti);
|
ticketItems.add(ti);
|
||||||
return ti;
|
return ti;
|
||||||
});
|
});
|
||||||
if (qitem.isQiTao()) {
|
if (qitem.isQiTao() && !qitem.isUseChildren()) {
|
||||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getBatchs()))
|
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getBatchs()))
|
||||||
.throwMessage("齐套物料需要提供批次信息");
|
.throwMessage("齐套物料需要提供批次信息");
|
||||||
qitem.getBatchs()
|
qitem.getBatchs()
|
||||||
|
|
@ -408,8 +407,8 @@ public class TransferFactoryController extends BaseController {
|
||||||
.setBinLocation(qrCodeMasters.stream()
|
.setBinLocation(qrCodeMasters.stream()
|
||||||
.filter(qr -> StrUtil.equals(qr.getBarcodeCode(), list.get(0).getUniqNo()))
|
.filter(qr -> StrUtil.equals(qr.getBarcodeCode(), list.get(0).getUniqNo()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.get()
|
.map(WmsQrCodeMaster::getBinLocation)
|
||||||
.getBinLocation()
|
.orElse("")
|
||||||
)
|
)
|
||||||
.setNum(list.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
.setNum(list.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
||||||
).toList()
|
).toList()
|
||||||
|
|
@ -500,8 +499,8 @@ public class TransferFactoryController extends BaseController {
|
||||||
.setBinLocation(qrCodeMasters.stream()
|
.setBinLocation(qrCodeMasters.stream()
|
||||||
.filter(qr -> StrUtil.equals(qr.getBarcodeCode(), list.get(0).getUniqNo()))
|
.filter(qr -> StrUtil.equals(qr.getBarcodeCode(), list.get(0).getUniqNo()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.get()
|
.map(WmsQrCodeMaster::getBinLocation)
|
||||||
.getBinLocation()
|
.orElse("")
|
||||||
)
|
)
|
||||||
.setNum(list.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
.setNum(list.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
||||||
).toList()
|
).toList()
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,11 @@ public class OutProduceSubmitItemQO {
|
||||||
@JsonProperty("isQiTao")
|
@JsonProperty("isQiTao")
|
||||||
private boolean isQiTao;
|
private boolean isQiTao;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否扫码子项
|
||||||
|
*/
|
||||||
|
private boolean useChildren;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批次列表
|
* 批次列表
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue