Merge branch '0.8.X' of https://gitee.com/hdka/klp-oa into 0.8.X
This commit is contained in:
@@ -4,6 +4,8 @@ import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.klp.common.core.domain.AjaxResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
@@ -206,4 +208,20 @@ public class WmsActualWarehouseController extends BaseController {
|
||||
vo.setLevelThreeSort(l3Sort);
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 释放实际库区/库位
|
||||
*
|
||||
* @param actualWarehouseId 库区ID
|
||||
*/
|
||||
@Log(title = "释放实际库区/库位", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/release/{actualWarehouseId}")
|
||||
public AjaxResult release(@PathVariable Long actualWarehouseId) {
|
||||
try {
|
||||
iWmsActualWarehouseService.releaseActualWarehouse(actualWarehouseId);
|
||||
return AjaxResult.success("库区释放成功");
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("库区释放失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,4 +77,11 @@ public interface IWmsActualWarehouseService {
|
||||
* 将已拆分的库位合并回一个大库位
|
||||
*/
|
||||
void mergeLocations(WmsActualWarehouseSplitBo bo);
|
||||
|
||||
/**
|
||||
* 释放实际库区/库位:
|
||||
* - 将该库区设置为未被占用(isEnabled=1)
|
||||
* - 清空钢卷表中绑定此库区且为现存(data_type=1)、未删除(del_flag=0)的记录的 actual_warehouse_id
|
||||
*/
|
||||
void releaseActualWarehouse(Long actualWarehouseId);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.klp.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.exception.ServiceException;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
@@ -46,6 +47,38 @@ public class WmsActualWarehouseServiceImpl implements IWmsActualWarehouseService
|
||||
return baseMapper.selectVoById(actualWarehouseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 释放实际库区/库位:
|
||||
* 1) 将该库区设置为未被占用(isEnabled=1)
|
||||
* 2) 清空钢卷表中绑定此库区且为现存(data_type=1)、未删除(del_flag=0)的记录的 actual_warehouse_id
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void releaseActualWarehouse(Long actualWarehouseId) {
|
||||
if (actualWarehouseId == null || actualWarehouseId <= 0) {
|
||||
throw new ServiceException("参数actualWarehouseId不合法");
|
||||
}
|
||||
|
||||
// 1) 设置库区为启用(未被占用)
|
||||
WmsActualWarehouse update = new WmsActualWarehouse();
|
||||
update.setActualWarehouseId(actualWarehouseId);
|
||||
update.setIsEnabled(1);
|
||||
int affected = baseMapper.updateById(update);
|
||||
if (affected <= 0) {
|
||||
// 不存在也提示
|
||||
throw new ServiceException("实际库区不存在或更新失败: " + actualWarehouseId);
|
||||
}
|
||||
|
||||
// 2) 清空钢卷绑定(仅现存且未删除)- 使用UpdateWrapper进行更新
|
||||
UpdateWrapper<WmsMaterialCoil> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("actual_warehouse_id", actualWarehouseId)
|
||||
.eq("data_type", 1)
|
||||
.eq("del_flag", 0)
|
||||
.set("actual_warehouse_id", null);
|
||||
|
||||
wmsMaterialCoilMapper.update(null, updateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int batchGenerateLocations(WmsActualWarehouseBatchGenerateBo bo) {
|
||||
|
||||
Reference in New Issue
Block a user