|
@@ -2,10 +2,8 @@ package com.abi.qms.platform.service.impl;
|
|
|
|
|
|
import com.abi.qms.platform.dao.entity.BaseMaterial;
|
|
|
import com.abi.qms.platform.dao.entity.BaseSku;
|
|
|
-import com.abi.qms.platform.dao.enums.FactoryTypeEnum;
|
|
|
import com.abi.qms.platform.dao.enums.MaterialTypeEnum;
|
|
|
import com.abi.qms.platform.dao.enums.ValidEnum;
|
|
|
-import com.abi.qms.platform.dao.mapper.BaseBrandMapper;
|
|
|
import com.abi.qms.platform.dao.mapper.BaseMaterialMapper;
|
|
|
import com.abi.qms.platform.dao.mapper.BaseSkuMapper;
|
|
|
import com.abi.qms.platform.dao.vo.result.MaterialVO;
|
|
@@ -23,16 +21,12 @@ import com.abi.task.common.excel.preperties.MaterialProperty;
|
|
|
import com.abi.task.common.utils.PojoConverterUtils;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import com.fasterxml.jackson.databind.util.JSONPObject;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -59,6 +53,7 @@ public class MaterialServiceImpl implements MaterialService {
|
|
|
//查询是否存在相同名称的物料
|
|
|
QueryWrapper<BaseMaterial> materialQw = new QueryWrapper<>();
|
|
|
materialQw.eq("material_name",req.getMaterialName());
|
|
|
+ materialQw.eq("is_delete", 0);
|
|
|
List<BaseMaterial> materialList = baseMaterialMapper.selectList(materialQw);
|
|
|
if(CollectionUtils.isNotEmpty(materialList)){
|
|
|
throw new BusinessException("物料"+req.getMaterialName()+"已存在,请勿重复创建");
|
|
@@ -66,6 +61,7 @@ public class MaterialServiceImpl implements MaterialService {
|
|
|
//查询是否存在物料号
|
|
|
materialQw = new QueryWrapper<>();
|
|
|
materialQw.eq("material_code",req.getMaterialCode());
|
|
|
+ materialQw.eq("is_delete", 0);
|
|
|
materialList = baseMaterialMapper.selectList(materialQw);
|
|
|
if(CollectionUtils.isNotEmpty(materialList)){
|
|
|
throw new BusinessException("物料号"+req.getMaterialCode()+"已存在,请勿重复创建");
|
|
@@ -92,8 +88,21 @@ public class MaterialServiceImpl implements MaterialService {
|
|
|
BaseMaterial material = baseMaterialMapper.selectById(req.getId());
|
|
|
AssertUtil.isNull(material,"物料不存在");
|
|
|
|
|
|
+ //校验物料名称
|
|
|
+ if(Objects.nonNull(req.getMaterialName())){
|
|
|
+ if(!material.getMaterialName().equals(req.getMaterialName())){
|
|
|
+ QueryWrapper<BaseMaterial> materialQw = new QueryWrapper<>();
|
|
|
+ materialQw.eq("material_name",req.getMaterialName());
|
|
|
+ materialQw.eq("is_delete", 0);
|
|
|
+ List<BaseMaterial> materialList = baseMaterialMapper.selectList(materialQw);
|
|
|
+ if(CollectionUtils.isNotEmpty(materialList)){
|
|
|
+ throw new BusinessException("物料"+req.getMaterialName()+"已存在,请勿重复创建");
|
|
|
+ }
|
|
|
+ material.setMaterialName(req.getMaterialName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//2-修改物料
|
|
|
- material.setMaterialName(req.getMaterialName());
|
|
|
material.setMaterialType(req.getMaterialType());
|
|
|
material.setDescription(req.getDescription());
|
|
|
material.setValid(req.getValid());
|