| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.pojo.BaseParam; |
| | | import com.ruoyi.basic.service.BaseParamService; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.production.dto.ProcessRouteItemParamDto; |
| | |
| | | import com.ruoyi.production.pojo.ProcessRouteItemParam; |
| | | import com.ruoyi.production.service.ProcessRouteItemParamService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | @Slf4j |
| | | @Service |
| | | public class ProcessRouteItemParamServiceImpl extends ServiceImpl<ProcessRouteItemParamMapper, ProcessRouteItemParam> implements ProcessRouteItemParamService { |
| | | |
| | | @Autowired |
| | | private BaseParamService baseParamService; |
| | | |
| | | @Override |
| | | public IPage<ProcessRouteItemParamDto> pageList(Page<ProcessRouteItemParam> page, ProcessRouteItemParam param) { |
| | |
| | | if (param == null) { |
| | | throw new ServiceException("新增失败,参数不能为空"); |
| | | } |
| | | if (param.getRouteItemId() == null || param.getParamId() == null) { |
| | | throw new ServiceException("关联工序ID和参数项ID不能为空"); |
| | | if (param.getRouteItemId() == null || param.getParamKey() == null) { |
| | | throw new ServiceException("关联工序ID和参数标识不能为空"); |
| | | } |
| | | |
| | | Long tenantId = SecurityUtils.getLoginUser().getTenantId(); |
| | | Long count = baseMapper.selectCount(Wrappers.<ProcessRouteItemParam>lambdaQuery() |
| | | .eq(ProcessRouteItemParam::getRouteItemId, param.getRouteItemId()) |
| | | .eq(ProcessRouteItemParam::getParamId, param.getParamId()) |
| | | .eq(ProcessRouteItemParam::getParamKey, param.getParamKey()) |
| | | .eq(ProcessRouteItemParam::getTenantId, tenantId)); |
| | | if (count > 0) { |
| | | throw new ServiceException("该工序已存在此参数项,请勿重复添加"); |
| | | } |
| | | |
| | | BaseParam baseParam = baseParamService.getById(param.getParamId()); |
| | | if (baseParam == null) { |
| | | throw new ServiceException("新增失败,该基础参数不存在"); |
| | | throw new ServiceException("该工序已存在参数项,请勿重复添加"); |
| | | } |
| | | |
| | | Integer maxSort = baseMapper.selectMaxSortByRouteItemId(param.getRouteItemId()); |