refactor(wms): 优化钢卷计划和材料钢卷服务逻辑
- 在更新钢卷计划时设置创建时间和更新时间 - 添加登录用户信息到钢卷计划的创建者和更新者字段 - 初始化钢卷计划的状态和导出相关字段 - 移除占用仓库的冗余方法实现 - 在材料钢卷服务中同时更新数据类型和排他状态字段
This commit is contained in:
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.exception.ServiceException;
|
||||
import com.klp.common.helper.LoginHelper;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import com.klp.domain.*;
|
||||
import com.klp.domain.bo.WmsFurnacePlanBo;
|
||||
@@ -346,6 +347,15 @@ public class WmsFurnacePlanServiceImpl implements IWmsFurnacePlanService {
|
||||
updateBo.setCoilId(coil.getCoilId());
|
||||
updateBo.setWarehouseId(targetLocation);
|
||||
updateBo.setActualWarehouseId(-1L);
|
||||
updateBo.setCreateTime(new Date());
|
||||
updateBo.setUpdateTime(new Date());
|
||||
updateBo.setExclusiveStatus(0);
|
||||
updateBo.setCreateBy(LoginHelper.getUsername());
|
||||
updateBo.setUpdateBy(LoginHelper.getUsername());
|
||||
updateBo.setNextWarehouseId(null);
|
||||
updateBo.setStatus(0);
|
||||
updateBo.setExportBy(null);
|
||||
updateBo.setExportTime(null);
|
||||
|
||||
materialCoilService.updateByBo(updateBo, "annealing");
|
||||
|
||||
@@ -389,34 +399,6 @@ public class WmsFurnacePlanServiceImpl implements IWmsFurnacePlanService {
|
||||
.set(WmsMaterialCoil::getExclusiveStatus, 2));
|
||||
}
|
||||
|
||||
private void occupyWarehouse(Long planId, Long coilId, Long warehouseId) {
|
||||
if (warehouseId == null) {
|
||||
throw new ServiceException("逻辑库位不能为空");
|
||||
}
|
||||
WmsWarehouse warehouse = warehouseMapper.selectById(warehouseId);
|
||||
if (warehouse == null || warehouse.getDelFlag() != null && warehouse.getDelFlag() == 1) {
|
||||
throw new ServiceException("逻辑库位不存在");
|
||||
}
|
||||
|
||||
// wmsfurnace_plan_coil也要插入这个去向的逻辑库区
|
||||
WmsFurnacePlanCoil wmsFurnacePlanCoil = planCoilMapper.selectOne(Wrappers.<WmsFurnacePlanCoil>lambdaQuery()
|
||||
.eq(WmsFurnacePlanCoil::getPlanId, planId)
|
||||
.eq(WmsFurnacePlanCoil::getCoilId, coilId)
|
||||
//逻辑删除
|
||||
.eq(WmsFurnacePlanCoil::getDelFlag, 0));
|
||||
|
||||
if (wmsFurnacePlanCoil != null && wmsFurnacePlanCoil.getPlanCoilId() != null) {
|
||||
planCoilMapper.update(null, Wrappers.<WmsFurnacePlanCoil>lambdaUpdate()
|
||||
.eq(WmsFurnacePlanCoil::getPlanCoilId, wmsFurnacePlanCoil.getPlanCoilId())
|
||||
.set(WmsFurnacePlanCoil::getLogicWarehouseId, warehouseId));
|
||||
}
|
||||
|
||||
WmsMaterialCoil updateCoil = new WmsMaterialCoil();
|
||||
updateCoil.setCoilId(coilId);
|
||||
updateCoil.setWarehouseId(warehouseId);
|
||||
updateCoil.setExclusiveStatus(0);
|
||||
materialCoilMapper.updateById(updateCoil);
|
||||
}
|
||||
|
||||
private List<Long> parseCoilIds(WmsFurnacePlanCoilBo bo) {
|
||||
List<Long> coilIds = new ArrayList<>();
|
||||
|
||||
@@ -1354,7 +1354,8 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
// 1. 将原钢卷标记为历史数据(dataType = 0)
|
||||
LambdaUpdateWrapper<WmsMaterialCoil> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(WmsMaterialCoil::getCoilId, oldCoil.getCoilId())
|
||||
.set(WmsMaterialCoil::getDataType, 0); // 设置为历史数据
|
||||
.set(WmsMaterialCoil::getDataType, 0) // 设置为历史数据
|
||||
.set(WmsMaterialCoil::getExclusiveStatus, 0);
|
||||
baseMapper.update(null, updateWrapper);
|
||||
|
||||
// 2. 创建新记录
|
||||
|
||||
Reference in New Issue
Block a user