|
|
|
@ -1,24 +1,27 @@
|
|
|
|
|
package org.dromara.wms.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.github.yulichang.toolkit.JoinWrappers;
|
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
|
import org.dromara.common.mybatis.core.page.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.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
|
import org.dromara.wms.domain.BaseMaterialCategory;
|
|
|
|
|
import org.dromara.wms.domain.BaseMaterialInfo;
|
|
|
|
|
import org.dromara.wms.domain.bo.BaseMaterialInfoBo;
|
|
|
|
|
import org.dromara.wms.domain.vo.BaseMaterialInfoVo;
|
|
|
|
|
import org.dromara.wms.mapper.BaseMaterialInfoMapper;
|
|
|
|
|
import org.dromara.wms.service.IBaseMaterialInfoService;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 物料信息Service业务层处理
|
|
|
|
@ -32,6 +35,7 @@ public class BaseMaterialInfoServiceImpl implements IBaseMaterialInfoService {
|
|
|
|
|
|
|
|
|
|
private final BaseMaterialInfoMapper baseMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询物料信息
|
|
|
|
|
*
|
|
|
|
@ -52,7 +56,7 @@ public class BaseMaterialInfoServiceImpl implements IBaseMaterialInfoService {
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public TableDataInfo<BaseMaterialInfoVo> queryPageList(BaseMaterialInfoBo bo, PageQuery pageQuery) {
|
|
|
|
|
LambdaQueryWrapper<BaseMaterialInfo> lqw = buildQueryWrapper(bo);
|
|
|
|
|
MPJLambdaWrapper<BaseMaterialInfo> lqw = buildQueryWrapper(bo);
|
|
|
|
|
Page<BaseMaterialInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
|
|
return TableDataInfo.build(result);
|
|
|
|
|
}
|
|
|
|
@ -65,61 +69,82 @@ public class BaseMaterialInfoServiceImpl implements IBaseMaterialInfoService {
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<BaseMaterialInfoVo> queryList(BaseMaterialInfoBo bo) {
|
|
|
|
|
LambdaQueryWrapper<BaseMaterialInfo> lqw = buildQueryWrapper(bo);
|
|
|
|
|
MPJLambdaWrapper<BaseMaterialInfo> lqw = buildQueryWrapper(bo);
|
|
|
|
|
return baseMapper.selectVoList(lqw);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private LambdaQueryWrapper<BaseMaterialInfo> buildQueryWrapper(BaseMaterialInfoBo bo) {
|
|
|
|
|
private MPJLambdaWrapper<BaseMaterialInfo> buildQueryWrapper(BaseMaterialInfoBo bo) {
|
|
|
|
|
Map<String, Object> params = bo.getParams();
|
|
|
|
|
LambdaQueryWrapper<BaseMaterialInfo> lqw = Wrappers.lambdaQuery();
|
|
|
|
|
lqw.eq(bo.getMaterialId() != null, BaseMaterialInfo::getMaterialId, bo.getMaterialId());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getErpId()), BaseMaterialInfo::getErpId, bo.getErpId());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getMaterialCode()), BaseMaterialInfo::getMaterialCode, bo.getMaterialCode());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getOldMaterialCode()), BaseMaterialInfo::getOldMaterialCode, bo.getOldMaterialCode());
|
|
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getMaterialName()), BaseMaterialInfo::getMaterialName, bo.getMaterialName());
|
|
|
|
|
lqw.eq(bo.getMaterialTypeId() != null, BaseMaterialInfo::getMaterialTypeId, bo.getMaterialTypeId());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getMaterialCategoryId()), BaseMaterialInfo::getMaterialCategoryId, bo.getMaterialCategoryId());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getMaterialSubclass()), BaseMaterialInfo::getMaterialSubclass, bo.getMaterialSubclass());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getBatchFlag()), BaseMaterialInfo::getBatchFlag, bo.getBatchFlag());
|
|
|
|
|
lqw.eq(bo.getBatchAmount() != null, BaseMaterialInfo::getBatchAmount, bo.getBatchAmount());
|
|
|
|
|
lqw.eq(bo.getMaterialUnitId() != null, BaseMaterialInfo::getMaterialUnitId, bo.getMaterialUnitId());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getMaterialUnit()), BaseMaterialInfo::getMaterialUnit, bo.getMaterialUnit());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getMaterialMatkl()), BaseMaterialInfo::getMaterialMatkl, bo.getMaterialMatkl());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getMaterialSpec()), BaseMaterialInfo::getMaterialSpec, bo.getMaterialSpec());
|
|
|
|
|
lqw.eq(bo.getNetWeight() != null, BaseMaterialInfo::getNetWeight, bo.getNetWeight());
|
|
|
|
|
lqw.eq(bo.getGrossWeight() != null, BaseMaterialInfo::getGrossWeight, bo.getGrossWeight());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getAlwaysFlag()), BaseMaterialInfo::getAlwaysFlag, bo.getAlwaysFlag());
|
|
|
|
|
lqw.eq(bo.getFactoryId() != null, BaseMaterialInfo::getFactoryId, bo.getFactoryId());
|
|
|
|
|
lqw.eq(bo.getCreateOrgId() != null, BaseMaterialInfo::getCreateOrgId, bo.getCreateOrgId());
|
|
|
|
|
lqw.eq(bo.getUseOrgId() != null, BaseMaterialInfo::getUseOrgId, bo.getUseOrgId());
|
|
|
|
|
lqw.eq(bo.getProdLineId() != null, BaseMaterialInfo::getProdLineId, bo.getProdLineId());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getActiveFlag()), BaseMaterialInfo::getActiveFlag, bo.getActiveFlag());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getDeletedFlag()), BaseMaterialInfo::getDeletedFlag, bo.getDeletedFlag());
|
|
|
|
|
lqw.eq(bo.getPurchasePriceUnitId() != null, BaseMaterialInfo::getPurchasePriceUnitId, bo.getPurchasePriceUnitId());
|
|
|
|
|
lqw.between(params.get("beginApproveDate") != null && params.get("endApproveDate") != null,
|
|
|
|
|
BaseMaterialInfo::getApproveDate ,params.get("beginApproveDate"), params.get("endApproveDate"));
|
|
|
|
|
lqw.eq(bo.getErpModifyDate() != null, BaseMaterialInfo::getErpModifyDate, bo.getErpModifyDate());
|
|
|
|
|
lqw.eq(bo.getMaxStockAmount() != null, BaseMaterialInfo::getMaxStockAmount, bo.getMaxStockAmount());
|
|
|
|
|
lqw.eq(bo.getMinStockAmount() != null, BaseMaterialInfo::getMinStockAmount, bo.getMinStockAmount());
|
|
|
|
|
lqw.eq(bo.getSafeStockAmount() != null, BaseMaterialInfo::getSafeStockAmount, bo.getSafeStockAmount());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getApplyFlag()), BaseMaterialInfo::getApplyFlag, bo.getApplyFlag());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getMaterialClassfication()), BaseMaterialInfo::getMaterialClassfication, bo.getMaterialClassfication());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getAutoOutstockFlag()), BaseMaterialInfo::getAutoOutstockFlag, bo.getAutoOutstockFlag());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getAccessoriesFlag()), BaseMaterialInfo::getAccessoriesFlag, bo.getAccessoriesFlag());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getLowValueConsumableFlag()), BaseMaterialInfo::getLowValueConsumableFlag, bo.getLowValueConsumableFlag());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getBrand()), BaseMaterialInfo::getBrand, bo.getBrand());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getPlyrating()), BaseMaterialInfo::getPlyrating, bo.getPlyrating());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getPattern()), BaseMaterialInfo::getPattern, bo.getPattern());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getSpeedLevel()), BaseMaterialInfo::getSpeedLevel, bo.getSpeedLevel());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getLoad()), BaseMaterialInfo::getLoad, bo.getLoad());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getTireMarkings()), BaseMaterialInfo::getTireMarkings, bo.getTireMarkings());
|
|
|
|
|
lqw.eq(bo.getMinParkingTime() != null, BaseMaterialInfo::getMinParkingTime, bo.getMinParkingTime());
|
|
|
|
|
lqw.eq(bo.getMaxParkingTime() != null, BaseMaterialInfo::getMaxParkingTime, bo.getMaxParkingTime());
|
|
|
|
|
lqw.eq(bo.getStandardWeight() != null, BaseMaterialInfo::getStandardWeight, bo.getStandardWeight());
|
|
|
|
|
lqw.eq(bo.getWeightUpperLimit() != null, BaseMaterialInfo::getWeightUpperLimit, bo.getWeightUpperLimit());
|
|
|
|
|
lqw.eq(bo.getWeightLowerLimit() != null, BaseMaterialInfo::getWeightLowerLimit, bo.getWeightLowerLimit());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getInnerTubeFlag()), BaseMaterialInfo::getInnerTubeFlag, bo.getInnerTubeFlag());
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getSaleType()), BaseMaterialInfo::getSaleType, bo.getSaleType());
|
|
|
|
|
MPJLambdaWrapper<BaseMaterialInfo> lqw = JoinWrappers.lambda(BaseMaterialInfo.class)
|
|
|
|
|
.selectAll(BaseMaterialInfo.class)
|
|
|
|
|
|
|
|
|
|
// // 关联查询工厂信息
|
|
|
|
|
// .select(ProdBaseFactoryInfo::getFactoryName)
|
|
|
|
|
// .leftJoin(ProdBaseFactoryInfo.class, ProdBaseFactoryInfo::getFactoryId, BaseMaterialInfo::getFactoryId)
|
|
|
|
|
//
|
|
|
|
|
// //关联查询物料类型名称
|
|
|
|
|
// .select(BaseMaterialType::getMatrialTypeName)
|
|
|
|
|
// //注意"e":BaseMaterialType实体类中为matrialTypeId,BaseMaterialInfo实体类中为materialTypeId
|
|
|
|
|
// .leftJoin(BaseMaterialType.class, BaseMaterialType::getMatrialTypeId, BaseMaterialInfo::getMaterialTypeId)
|
|
|
|
|
|
|
|
|
|
/* //关联计量单位信息
|
|
|
|
|
.select(BaseMeasurementUnitInfo::getUnitName)
|
|
|
|
|
.leftJoin(BaseMeasurementUnitInfo.class, BaseMeasurementUnitInfo::getUnitId, BaseMaterialInfo::getMaterialUnitId)*/
|
|
|
|
|
|
|
|
|
|
//关联物料大类信息(物料大类从字典改为了数据库表)
|
|
|
|
|
.select(BaseMaterialCategory::getMaterialCategoryName)
|
|
|
|
|
.leftJoin(BaseMaterialCategory.class, BaseMaterialCategory::getMaterialCategoryId, BaseMaterialInfo::getMaterialCategoryId)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.eq(bo.getMaterialId() != null, BaseMaterialInfo::getMaterialId, bo.getMaterialId())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getErpId()), BaseMaterialInfo::getErpId, bo.getErpId())
|
|
|
|
|
.like(StringUtils.isNotBlank(bo.getMaterialCode()), BaseMaterialInfo::getMaterialCode, bo.getMaterialCode())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getOldMaterialCode()), BaseMaterialInfo::getOldMaterialCode, bo.getOldMaterialCode())
|
|
|
|
|
.like(StringUtils.isNotBlank(bo.getMaterialName()), BaseMaterialInfo::getMaterialName, bo.getMaterialName())
|
|
|
|
|
.eq(bo.getMaterialTypeId() != null, BaseMaterialInfo::getMaterialTypeId, bo.getMaterialTypeId())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getMaterialCategoryId()), BaseMaterialInfo::getMaterialCategoryId, bo.getMaterialCategoryId())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getMaterialSubclass()), BaseMaterialInfo::getMaterialSubclass, bo.getMaterialSubclass())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getBatchFlag()), BaseMaterialInfo::getBatchFlag, bo.getBatchFlag())
|
|
|
|
|
.eq(bo.getBatchAmount() != null, BaseMaterialInfo::getBatchAmount, bo.getBatchAmount())
|
|
|
|
|
.eq(bo.getMaterialUnitId() != null, BaseMaterialInfo::getMaterialUnitId, bo.getMaterialUnitId())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getMaterialUnit()), BaseMaterialInfo::getMaterialUnit, bo.getMaterialUnit())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getMaterialMatkl()), BaseMaterialInfo::getMaterialMatkl, bo.getMaterialMatkl())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getMaterialSpec()), BaseMaterialInfo::getMaterialSpec, bo.getMaterialSpec())
|
|
|
|
|
.eq(bo.getNetWeight() != null, BaseMaterialInfo::getNetWeight, bo.getNetWeight())
|
|
|
|
|
.eq(bo.getGrossWeight() != null, BaseMaterialInfo::getGrossWeight, bo.getGrossWeight())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getAlwaysFlag()), BaseMaterialInfo::getAlwaysFlag, bo.getAlwaysFlag())
|
|
|
|
|
.eq(bo.getFactoryId() != null, BaseMaterialInfo::getFactoryId, bo.getFactoryId())
|
|
|
|
|
.eq(bo.getCreateOrgId() != null, BaseMaterialInfo::getCreateOrgId, bo.getCreateOrgId())
|
|
|
|
|
.eq(bo.getUseOrgId() != null, BaseMaterialInfo::getUseOrgId, bo.getUseOrgId())
|
|
|
|
|
.eq(bo.getProdLineId() != null, BaseMaterialInfo::getProdLineId, bo.getProdLineId())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), BaseMaterialInfo::getActiveFlag, bo.getActiveFlag())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getDeletedFlag()), BaseMaterialInfo::getDeletedFlag, bo.getDeletedFlag())
|
|
|
|
|
.eq(bo.getPurchasePriceUnitId() != null, BaseMaterialInfo::getPurchasePriceUnitId, bo.getPurchasePriceUnitId())
|
|
|
|
|
.between(params.get("beginApproveDate") != null && params.get("endApproveDate") != null,
|
|
|
|
|
BaseMaterialInfo::getApproveDate ,params.get("beginApproveDate"), params.get("endApproveDate"))
|
|
|
|
|
.eq(bo.getErpModifyDate() != null, BaseMaterialInfo::getErpModifyDate, bo.getErpModifyDate())
|
|
|
|
|
.eq(bo.getMaxStockAmount() != null, BaseMaterialInfo::getMaxStockAmount, bo.getMaxStockAmount())
|
|
|
|
|
.eq(bo.getMinStockAmount() != null, BaseMaterialInfo::getMinStockAmount, bo.getMinStockAmount())
|
|
|
|
|
.eq(bo.getSafeStockAmount() != null, BaseMaterialInfo::getSafeStockAmount, bo.getSafeStockAmount())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getApplyFlag()), BaseMaterialInfo::getApplyFlag, bo.getApplyFlag())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getMaterialClassfication()), BaseMaterialInfo::getMaterialClassfication, bo.getMaterialClassfication())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getAutoOutstockFlag()), BaseMaterialInfo::getAutoOutstockFlag, bo.getAutoOutstockFlag())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getAccessoriesFlag()), BaseMaterialInfo::getAccessoriesFlag, bo.getAccessoriesFlag())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getLowValueConsumableFlag()), BaseMaterialInfo::getLowValueConsumableFlag, bo.getLowValueConsumableFlag())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getBrand()), BaseMaterialInfo::getBrand, bo.getBrand())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getPlyrating()), BaseMaterialInfo::getPlyrating, bo.getPlyrating())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getPattern()), BaseMaterialInfo::getPattern, bo.getPattern())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getSpeedLevel()), BaseMaterialInfo::getSpeedLevel, bo.getSpeedLevel())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getLoad()), BaseMaterialInfo::getLoad, bo.getLoad())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getTireMarkings()), BaseMaterialInfo::getTireMarkings, bo.getTireMarkings())
|
|
|
|
|
.eq(bo.getMinParkingTime() != null, BaseMaterialInfo::getMinParkingTime, bo.getMinParkingTime())
|
|
|
|
|
.eq(bo.getMaxParkingTime() != null, BaseMaterialInfo::getMaxParkingTime, bo.getMaxParkingTime())
|
|
|
|
|
.eq(bo.getStandardWeight() != null, BaseMaterialInfo::getStandardWeight, bo.getStandardWeight())
|
|
|
|
|
.eq(bo.getWeightUpperLimit() != null, BaseMaterialInfo::getWeightUpperLimit, bo.getWeightUpperLimit())
|
|
|
|
|
.eq(bo.getWeightLowerLimit() != null, BaseMaterialInfo::getWeightLowerLimit, bo.getWeightLowerLimit())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getInnerTubeFlag()), BaseMaterialInfo::getInnerTubeFlag, bo.getInnerTubeFlag())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getSaleType()), BaseMaterialInfo::getSaleType, bo.getSaleType())
|
|
|
|
|
.orderByDesc(BaseMaterialInfo::getCreateTime);
|
|
|
|
|
return lqw;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -133,7 +158,11 @@ public class BaseMaterialInfoServiceImpl implements IBaseMaterialInfoService {
|
|
|
|
|
public Boolean insertByBo(BaseMaterialInfoBo bo) {
|
|
|
|
|
BaseMaterialInfo add = MapstructUtils.convert(bo, BaseMaterialInfo.class);
|
|
|
|
|
validEntityBeforeSave(add);
|
|
|
|
|
return true;
|
|
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
|
|
if (flag) {
|
|
|
|
|
bo.setMaterialId(add.getMaterialId());
|
|
|
|
|
}
|
|
|
|
|
return flag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -146,7 +175,22 @@ public class BaseMaterialInfoServiceImpl implements IBaseMaterialInfoService {
|
|
|
|
|
public Boolean updateByBo(BaseMaterialInfoBo bo) {
|
|
|
|
|
BaseMaterialInfo update = MapstructUtils.convert(bo, BaseMaterialInfo.class);
|
|
|
|
|
validEntityBeforeSave(update);
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
//物料上的物料类型修改时 校验原类型是否关联的BOM
|
|
|
|
|
Long materialTypeId = bo.getMaterialTypeId();//修改后的物料类型id
|
|
|
|
|
//要修改的物料
|
|
|
|
|
Long materialId = bo.getMaterialId();
|
|
|
|
|
BaseMaterialInfoVo baseMaterialInfoVo = baseMapper.selectVoById(materialId);
|
|
|
|
|
//物料绑定的BOM
|
|
|
|
|
// MPJLambdaWrapper<ProdMaterialBom> bom = new MPJLambdaWrapper<>();
|
|
|
|
|
// bom.eq(ProdMaterialBom::getMaterialId, materialId);
|
|
|
|
|
// List<ProdMaterialBom> boms = prodMaterialBomMapper.selectList(bom);
|
|
|
|
|
// if ( !materialTypeId.equals(baseMaterialInfoVo.getMaterialTypeId())
|
|
|
|
|
// && !ObjectUtils.isEmpty(boms)) {
|
|
|
|
|
// throw new ServiceException("已绑定物料BOM,请勿更改物料类型");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
return baseMapper.updateById(update) > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -154,15 +198,34 @@ public class BaseMaterialInfoServiceImpl implements IBaseMaterialInfoService {
|
|
|
|
|
*/
|
|
|
|
|
private void validEntityBeforeSave(BaseMaterialInfo entity){
|
|
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<BaseMaterialInfoVo> materialList(BaseMaterialInfo materialInfo) {
|
|
|
|
|
LambdaQueryWrapper<BaseMaterialInfo> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
if (materialInfo.getMaterialCategoryId()!=null){
|
|
|
|
|
wrapper.eq(BaseMaterialInfo::getMaterialCategoryId,materialInfo.getMaterialCategoryId());
|
|
|
|
|
//编码校验
|
|
|
|
|
if (StringUtils.isNotBlank(entity.getMaterialCode())) {
|
|
|
|
|
BaseMaterialInfoBo query = new BaseMaterialInfoBo();
|
|
|
|
|
query.setMaterialCode(entity.getMaterialCode());
|
|
|
|
|
MPJLambdaWrapper<BaseMaterialInfo> lqw = buildQueryWrapper(query);
|
|
|
|
|
BaseMaterialInfo baseMaterialInfo = baseMapper.selectOne(lqw);
|
|
|
|
|
if (!ObjectUtils.isEmpty(baseMaterialInfo)
|
|
|
|
|
&& !baseMaterialInfo.getMaterialId().equals(entity.getMaterialId())) {
|
|
|
|
|
throw new ServiceException("编码已存在");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return baseMapper.selectVoList(wrapper);
|
|
|
|
|
|
|
|
|
|
//名称校验
|
|
|
|
|
if (StringUtils.isNotBlank(entity.getMaterialName())) {
|
|
|
|
|
BaseMaterialInfoBo query = new BaseMaterialInfoBo();
|
|
|
|
|
query.setMaterialName(entity.getMaterialName());
|
|
|
|
|
MPJLambdaWrapper<BaseMaterialInfo> lqw = JoinWrappers.lambda(BaseMaterialInfo.class)
|
|
|
|
|
.selectAll(BaseMaterialInfo.class)
|
|
|
|
|
//buildQueryWrapper中getMaterialName是like,相似搜索
|
|
|
|
|
.eq(StringUtils.isNotBlank(query.getMaterialName()), BaseMaterialInfo::getMaterialName, query.getMaterialName());
|
|
|
|
|
BaseMaterialInfo baseMaterialInfo = baseMapper.selectOne(lqw);
|
|
|
|
|
if ( !ObjectUtils.isEmpty(baseMaterialInfo)
|
|
|
|
|
&& !baseMaterialInfo.getMaterialId().equals(entity.getMaterialId())) {
|
|
|
|
|
throw new ServiceException("名称已存在");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -177,6 +240,16 @@ public class BaseMaterialInfoServiceImpl implements IBaseMaterialInfoService {
|
|
|
|
|
if(isValid){
|
|
|
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
return baseMapper.deleteByIds(ids) > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<BaseMaterialInfoVo> materialList(BaseMaterialInfo materialInfo) {
|
|
|
|
|
LambdaQueryWrapper<BaseMaterialInfo> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
if (materialInfo.getMaterialCategoryId()!=null){
|
|
|
|
|
wrapper.eq(BaseMaterialInfo::getMaterialCategoryId,materialInfo.getMaterialCategoryId());
|
|
|
|
|
}
|
|
|
|
|
return baseMapper.selectVoList(wrapper);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|