- 在退火计划表格中添加合同号选择功能,支持远程搜索和下拉选择 - 更新数据库表结构,在wms_furnace_plan_coil表中新增contract_id字段 - 修改后端实体类将contractNo改为contractId,并更新相关映射配置 - 调整前端页面布局,将左右两列比例从12:12调整为10:14 - 优化退火完成验证逻辑,要求所有钢卷必须绑定合同后才能完成操作 - 修复材料网格布局样式,改为固定2列显示 - 添加订单列表加载和搜索功能,支持按关键词过滤 - 更新完成退火对话框提示文案,明确合同绑定要求
126 lines
4.4 KiB
Java
126 lines
4.4 KiB
Java
package com.klp.service.impl;
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import com.klp.common.core.page.TableDataInfo;
|
|
import com.klp.common.core.domain.PageQuery;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.stereotype.Service;
|
|
import com.klp.domain.bo.WmsFurnacePlanCoilBo;
|
|
import com.klp.domain.vo.WmsFurnacePlanCoilVo;
|
|
import com.klp.domain.WmsFurnacePlanCoil;
|
|
import com.klp.mapper.WmsFurnacePlanCoilMapper;
|
|
import com.klp.service.IWmsFurnacePlanCoilService;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Collection;
|
|
|
|
/**
|
|
* 退火计划钢卷关系Service业务层处理
|
|
*
|
|
* @author klp
|
|
* @date 2026-03-17
|
|
*/
|
|
@RequiredArgsConstructor
|
|
@Service
|
|
public class WmsFurnacePlanCoilServiceImpl implements IWmsFurnacePlanCoilService {
|
|
|
|
private final WmsFurnacePlanCoilMapper baseMapper;
|
|
|
|
/**
|
|
* 查询退火计划钢卷关系
|
|
*/
|
|
@Override
|
|
public WmsFurnacePlanCoilVo queryById(Long planCoilId){
|
|
return baseMapper.selectVoById(planCoilId);
|
|
}
|
|
|
|
/**
|
|
* 查询退火计划钢卷关系列表
|
|
*/
|
|
@Override
|
|
public TableDataInfo<WmsFurnacePlanCoilVo> queryPageList(WmsFurnacePlanCoilBo bo, PageQuery pageQuery) {
|
|
LambdaQueryWrapper<WmsFurnacePlanCoil> lqw = buildQueryWrapper(bo);
|
|
Page<WmsFurnacePlanCoilVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
return TableDataInfo.build(result);
|
|
}
|
|
|
|
/**
|
|
* 查询退火计划钢卷关系列表
|
|
*/
|
|
@Override
|
|
public List<WmsFurnacePlanCoilVo> queryList(WmsFurnacePlanCoilBo bo) {
|
|
LambdaQueryWrapper<WmsFurnacePlanCoil> lqw = buildQueryWrapper(bo);
|
|
return baseMapper.selectVoList(lqw);
|
|
}
|
|
|
|
private LambdaQueryWrapper<WmsFurnacePlanCoil> buildQueryWrapper(WmsFurnacePlanCoilBo bo) {
|
|
Map<String, Object> params = bo.getParams();
|
|
LambdaQueryWrapper<WmsFurnacePlanCoil> lqw = Wrappers.lambdaQuery();
|
|
lqw.eq(bo.getPlanId() != null, WmsFurnacePlanCoil::getPlanId, bo.getPlanId());
|
|
lqw.eq(bo.getCoilId() != null, WmsFurnacePlanCoil::getCoilId, bo.getCoilId());
|
|
lqw.eq(bo.getLogicWarehouseId() != null, WmsFurnacePlanCoil::getLogicWarehouseId, bo.getLogicWarehouseId());
|
|
lqw.eq(bo.getFurnaceLevel() != null, WmsFurnacePlanCoil::getFurnaceLevel, bo.getFurnaceLevel());
|
|
lqw.eq(bo.getContractId() != null, WmsFurnacePlanCoil::getContractId, bo.getContractId());
|
|
return lqw;
|
|
}
|
|
|
|
/**
|
|
* 新增退火计划钢卷关系
|
|
*/
|
|
@Override
|
|
public Boolean insertByBo(WmsFurnacePlanCoilBo bo) {
|
|
WmsFurnacePlanCoil add = BeanUtil.toBean(bo, WmsFurnacePlanCoil.class);
|
|
validEntityBeforeSave(add);
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
if (flag) {
|
|
bo.setPlanCoilId(add.getPlanCoilId());
|
|
}
|
|
return flag;
|
|
}
|
|
|
|
/**
|
|
* 修改退火计划钢卷关系
|
|
*/
|
|
@Override
|
|
public Boolean updateByBo(WmsFurnacePlanCoilBo bo) {
|
|
WmsFurnacePlanCoil update = BeanUtil.toBean(bo, WmsFurnacePlanCoil.class);
|
|
validEntityBeforeSave(update);
|
|
return baseMapper.updateById(update) > 0;
|
|
}
|
|
|
|
/**
|
|
* 保存前的数据校验
|
|
*/
|
|
private void validEntityBeforeSave(WmsFurnacePlanCoil entity){
|
|
// 检查是否已存在相同的planId和coilId组合
|
|
LambdaQueryWrapper<WmsFurnacePlanCoil> queryWrapper = Wrappers.lambdaQuery();
|
|
queryWrapper.eq(WmsFurnacePlanCoil::getPlanId, entity.getPlanId())
|
|
.eq(WmsFurnacePlanCoil::getCoilId, entity.getCoilId());
|
|
|
|
// 如果是更新操作,需要排除当前记录
|
|
if (entity.getPlanCoilId() != null) {
|
|
queryWrapper.ne(WmsFurnacePlanCoil::getPlanCoilId, entity.getPlanCoilId());
|
|
}
|
|
|
|
long count = baseMapper.selectCount(queryWrapper);
|
|
if (count > 0) {
|
|
throw new RuntimeException("该计划下已存在此钢卷,不能重复添加");
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 批量删除退火计划钢卷关系
|
|
*/
|
|
@Override
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
if(isValid){
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
}
|
|
return baseMapper.deleteBatchIds(ids) > 0;
|
|
}
|
|
}
|