feat(wms): 添加钢卷发货状态批量更新功能
- 在 IWmsMaterialCoilService 接口中新增 batchUpdateDeliveryStatus 方法 - 在 WmsMaterialCoilController 中添加批量更新接口 /batchUpdateDeliveryStatus - 实现 WmsMaterialCoilServiceImpl 中的批量更新逻辑 - 支持将钢卷状态更新为在库、在途或已出库 - 更新在途状态时自动设置出库时间 - 添加参数校验和异常处理机制
This commit is contained in:
@@ -1834,4 +1834,35 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
|
||||
return lqw;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量更新钢卷发货状态
|
||||
*
|
||||
* @param coilIds 钢卷ID列表
|
||||
* @param status 目标状态 (0=在库, 1=在途, 2=已出库)
|
||||
* @return 是否更新成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean batchUpdateDeliveryStatus(List<Long> coilIds, Integer status) {
|
||||
if (coilIds == null || coilIds.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (status == null || status < 0 || status > 2) {
|
||||
throw new RuntimeException("无效的状态值,状态必须在0-2之间");
|
||||
}
|
||||
|
||||
// 构造更新条件
|
||||
LambdaUpdateWrapper<WmsMaterialCoil> updateWrapper = Wrappers.lambdaUpdate();
|
||||
updateWrapper.in(WmsMaterialCoil::getCoilId, coilIds);
|
||||
updateWrapper.set(WmsMaterialCoil::getStatus, status);
|
||||
|
||||
// 如果是设置为已出库状态,同时更新出库时间
|
||||
if (status == 1) {
|
||||
updateWrapper.set(WmsMaterialCoil::getExportTime, new Date());
|
||||
}
|
||||
|
||||
return baseMapper.update(null, updateWrapper) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user