fix(wms/coil): 为镀铬操作类型豁免分卷净重与规格厚度校验
在钢卷分卷和批量分卷的业务逻辑中,当操作类型为501(镀铬)时,豁免以下校验: 1. 子卷净重不超过母卷净重的校验 2. 子卷规格厚度不超过母卷规格厚度的校验 3. 批量分卷时所有子卷总重不超过母卷净重的校验 调整前,所有分卷操作均强制进行净重和规格厚度校验;调整后,镀铬操作类型(501)可跳过这些校验,以适应镀铬产线的特殊业务场景。
This commit is contained in:
@@ -4994,21 +4994,22 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
if (childCoilBo.getActualWarehouseId() != null) {
|
||||
validateActualWarehouseForAssign(childCoilBo.getActualWarehouseId(), null);
|
||||
}
|
||||
|
||||
// 校验子卷净重不超过母卷
|
||||
if (childCoilBo.getNetWeight() != null && parentCoil.getNetWeight() != null) {
|
||||
if (childCoilBo.getNetWeight().compareTo(parentCoil.getNetWeight()) > 0) {
|
||||
throw new RuntimeException("子卷净重[" + childCoilBo.getNetWeight() + "]不能超过母卷净重[" + parentCoil.getNetWeight() + "]");
|
||||
if (pendingAction.getActionType() != 501 && childCoilBo.getActionType() != null) {
|
||||
// 校验子卷净重不超过母卷
|
||||
if (childCoilBo.getNetWeight() != null && parentCoil.getNetWeight() != null) {
|
||||
if (childCoilBo.getNetWeight().compareTo(parentCoil.getNetWeight()) > 0) {
|
||||
throw new RuntimeException("子卷净重[" + childCoilBo.getNetWeight() + "]不能超过母卷净重[" + parentCoil.getNetWeight() + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 校验子卷规格厚度不超过母卷
|
||||
String childItemType = StringUtils.isNotBlank(childCoilBo.getItemType()) ? childCoilBo.getItemType() : parentCoil.getItemType();
|
||||
Long childItemId = childCoilBo.getItemId() != null ? childCoilBo.getItemId() : parentCoil.getItemId();
|
||||
BigDecimal parentSpecThickness = getSpecThickness(parentCoil.getItemType(), parentCoil.getItemId());
|
||||
BigDecimal childSpecThickness = getSpecThickness(childItemType, childItemId);
|
||||
if (parentSpecThickness != null && childSpecThickness != null) {
|
||||
if (childSpecThickness.compareTo(parentSpecThickness) > 0) {
|
||||
throw new RuntimeException("子卷规格厚度[" + childSpecThickness + "]不能超过母卷规格厚度[" + parentSpecThickness + "]");
|
||||
// 校验子卷规格厚度不超过母卷
|
||||
String childItemType = StringUtils.isNotBlank(childCoilBo.getItemType()) ? childCoilBo.getItemType() : parentCoil.getItemType();
|
||||
Long childItemId = childCoilBo.getItemId() != null ? childCoilBo.getItemId() : parentCoil.getItemId();
|
||||
BigDecimal parentSpecThickness = getSpecThickness(parentCoil.getItemType(), parentCoil.getItemId());
|
||||
BigDecimal childSpecThickness = getSpecThickness(childItemType, childItemId);
|
||||
if (parentSpecThickness != null && childSpecThickness != null) {
|
||||
if (childSpecThickness.compareTo(parentSpecThickness) > 0) {
|
||||
throw new RuntimeException("子卷规格厚度[" + childSpecThickness + "]不能超过母卷规格厚度[" + parentSpecThickness + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5129,14 +5130,16 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
.map(WmsMaterialCoil::getCurrentCoilNo)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 校验所有子卷总重不超过母卷净重
|
||||
if (parentCoil.getNetWeight() != null) {
|
||||
BigDecimal totalChildWeight = childCoils.stream()
|
||||
.map(WmsMaterialCoil::getNetWeight)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
if (totalChildWeight.compareTo(parentCoil.getNetWeight()) > 0) {
|
||||
throw new RuntimeException("所有子卷总重[" + totalChildWeight + "]不能超过母卷净重[" + parentCoil.getNetWeight() + "]");
|
||||
if (pendingAction.getActionType() != 501) {
|
||||
// 校验所有子卷总重不超过母卷净重
|
||||
if (parentCoil.getNetWeight() != null) {
|
||||
BigDecimal totalChildWeight = childCoils.stream()
|
||||
.map(WmsMaterialCoil::getNetWeight)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
if (totalChildWeight.compareTo(parentCoil.getNetWeight()) > 0) {
|
||||
throw new RuntimeException("所有子卷总重[" + totalChildWeight + "]不能超过母卷净重[" + parentCoil.getNetWeight() + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user