feat(wms): 新增钢卷发货撤回功能

- 在 IWmsMaterialCoilService 中添加 withdrawExportCoil 方法
- 实现 WmsMaterialCoilController 的 withdrawExport 接口
- 添加 WmsMaterialCoilMapper 的 updateForWithdrawExport 方法
- 创建 XML 映射文件中的 updateForWithdrawExport SQL 更新语句
- 完成 WmsMaterialCoilServiceImpl 中的 withdrawExportCoil 业务逻辑实现
- 添加参数校验、存在性检查和状态验证逻辑
This commit is contained in:
2026-01-11 17:42:15 +08:00
parent 5c0b1793f0
commit e4df713ffb
5 changed files with 59 additions and 0 deletions

View File

@@ -81,6 +81,18 @@ public class WmsMaterialCoilController extends BaseController {
return toAjax(iWmsMaterialCoilService.exportCoil(coilId));
}
/**
* 钢卷发货撤回,将钢卷状态更新为未发货,且清空发货时间
*
* @param coilId 主键
*/
@Log(title = "钢卷物料表", businessType = BusinessType.UPDATE)
@GetMapping("/withdrawExportCoil/{coilId}")
public R<Void> withdrawExport(@NotNull(message = "主键不能为空")
@PathVariable("coilId") Long coilId) {
return toAjax(iWmsMaterialCoilService.withdrawExportCoil(coilId));
}
/**
* 获取钢卷物料表详细信息
*

View File

@@ -53,5 +53,15 @@ public interface WmsMaterialCoilMapper extends BaseMapperPlus<WmsMaterialCoilMap
* @return 导出数据列表
*/
List<com.klp.domain.vo.WmsMaterialCoilExportVo> selectExportList(@Param("ew")QueryWrapper<WmsMaterialCoil> lqw);
/**
* 更新钢卷发货撤回:将发货时间置空,状态改为指定值
*
* @param coilId 钢卷ID
* @param status 目标状态
* @return 影响行数
*/
int updateForWithdrawExport(@Param("coilId") Long coilId, @Param("status") Integer status);
}

View File

@@ -6,6 +6,7 @@ import com.klp.common.core.page.TableDataInfo;
import com.klp.common.core.domain.PageQuery;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -111,5 +112,6 @@ public interface IWmsMaterialCoilService {
*/
Map<Long, String> getUpdatedCoilIdsByOldCoilIds(List<Long> oldCoilIds);
int withdrawExportCoil(@NotNull(message = "主键不能为空") Long coilId);
}

View File

@@ -1853,6 +1853,34 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
return baseMapper.updateById(BeanUtil.toBean(wmsMaterialCoilVo,WmsMaterialCoil.class));
}
/**
* 钢卷发货撤回
* @param coilId
* @return
*/
@Override
@Transactional
public int withdrawExportCoil(Long coilId) {
// 参数校验
if (coilId == null) {
throw new IllegalArgumentException("钢卷ID不能为空");
}
WmsMaterialCoilVo wmsMaterialCoilVo = queryById(coilId);
if (wmsMaterialCoilVo == null) {
throw new RuntimeException("钢卷不存在");
}
// 检查当前状态是否为已发货状态
if (wmsMaterialCoilVo.getStatus() != 1) {
throw new RuntimeException("该钢卷并没有发货,无法撤回");
}
// 调用自定义的Mapper方法只更新发货时间和状态字段
return baseMapper.updateForWithdrawExport(coilId, 0);
}
/**
* 构建查询条件
*/