feat(delivery): 新增钢卷绑定信息查询功能并优化发货单明细校验
- 在 WmsDeliveryWaybillDetailMapper 中新增按钢卷ID批量查询和单个查询绑定来源信息的方法 - 在 Mapper XML 文件中新增 WmsCoilBindInfoResult 结果映射和两个查询SQL - 在 WmsDeliveryWaybillDetailServiceImpl 的数据校验方法中实现钢卷重复绑定检查 - 新增 WmsCoilBindInfoVo 类用于封装钢卷绑定信息 - 在 WmsMaterialCoilBo 中新增 excludeBound 和 includeBindInfo 参数控制绑定逻辑 - 在 WmsMaterialCoilServiceImpl 中实现钢卷列表的绑定信息查询和排除逻辑 - 在 WmsMaterialCoilVo 中新增绑定相关字段用于前端显示 - 优化发货单明细保存前的数据校验,防止钢卷重复绑定并提供详细的绑定来源提示
This commit is contained in:
@@ -7,11 +7,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import com.klp.common.exception.ServiceException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.domain.bo.WmsDeliveryWaybillDetailBo;
|
||||
import com.klp.domain.vo.WmsDeliveryWaybillDetailVo;
|
||||
import com.klp.domain.WmsDeliveryWaybillDetail;
|
||||
import com.klp.domain.vo.WmsCoilBindInfoVo;
|
||||
import com.klp.mapper.WmsDeliveryWaybillDetailMapper;
|
||||
import com.klp.service.IWmsDeliveryWaybillDetailService;
|
||||
|
||||
@@ -105,7 +107,32 @@ public class WmsDeliveryWaybillDetailServiceImpl implements IWmsDeliveryWaybillD
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsDeliveryWaybillDetail entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
if (entity == null || entity.getCoilId() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 同一个钢卷只能被一个发货单明细绑定(排除当前记录)
|
||||
LambdaQueryWrapper<WmsDeliveryWaybillDetail> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(WmsDeliveryWaybillDetail::getCoilId, entity.getCoilId());
|
||||
lqw.eq(WmsDeliveryWaybillDetail::getDelFlag, 0);
|
||||
lqw.ne(entity.getDetailId() != null, WmsDeliveryWaybillDetail::getDetailId, entity.getDetailId());
|
||||
lqw.last("LIMIT 1");
|
||||
WmsDeliveryWaybillDetail exists = baseMapper.selectOne(lqw);
|
||||
if (exists == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 拼接提示:在哪个计划/发货单下已被绑定
|
||||
WmsCoilBindInfoVo bindInfo = baseMapper.selectBindInfoByCoilId(entity.getCoilId());
|
||||
if (bindInfo != null) {
|
||||
throw new ServiceException(
|
||||
"该钢卷已被绑定,不能重复选择;" +
|
||||
"发货计划:" + bindInfo.getPlanName() +
|
||||
",发货单:" + bindInfo.getWaybillNo() +
|
||||
"(" + bindInfo.getWaybillName() + ")"
|
||||
);
|
||||
}
|
||||
throw new ServiceException("该钢卷已被绑定,不能重复选择");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user