|
|
@ -32,6 +32,7 @@ public class PartSupplierRelationServiceImpl extends ServiceImpl<PartSupplierRel |
|
|
public void saveModel(PartSupplierRelation model){ |
|
|
public void saveModel(PartSupplierRelation model){ |
|
|
//供应商编号唯一 |
|
|
//供应商编号唯一 |
|
|
PartSupplierRelation query = new PartSupplierRelation(); |
|
|
PartSupplierRelation query = new PartSupplierRelation(); |
|
|
|
|
|
query.setSite(model.getSite()); |
|
|
query.setSupplierCode(model.getSupplierCode()); |
|
|
query.setSupplierCode(model.getSupplierCode()); |
|
|
PartSupplierRelationVo exsitModel = get(query); |
|
|
PartSupplierRelationVo exsitModel = get(query); |
|
|
if(exsitModel != null && exsitModel.getId() != model.getId()){ |
|
|
if(exsitModel != null && exsitModel.getId() != model.getId()){ |
|
|
@ -40,9 +41,10 @@ public class PartSupplierRelationServiceImpl extends ServiceImpl<PartSupplierRel |
|
|
//物料中只允许一个主供应商 |
|
|
//物料中只允许一个主供应商 |
|
|
PartSupplierRelation isExistMainPart = new PartSupplierRelation(); |
|
|
PartSupplierRelation isExistMainPart = new PartSupplierRelation(); |
|
|
isExistMainPart.setIsMainSupplier("Y"); |
|
|
isExistMainPart.setIsMainSupplier("Y"); |
|
|
|
|
|
isExistMainPart.setSite(model.getSite()); |
|
|
PartSupplierRelationVo existMainPart = get(isExistMainPart); |
|
|
PartSupplierRelationVo existMainPart = get(isExistMainPart); |
|
|
if(existMainPart != null && !existMainPart.getId().equals(model.getId())){ |
|
|
if(existMainPart != null && !existMainPart.getId().equals(model.getId())){ |
|
|
throw new RuntimeException("该料号已存在主供应商"); |
|
|
|
|
|
|
|
|
throw new RuntimeException("该产品已存在主供应商"); |
|
|
} |
|
|
} |
|
|
if(model.getId() != null){ |
|
|
if(model.getId() != null){ |
|
|
baseMapper.updateById(model); |
|
|
baseMapper.updateById(model); |
|
|
|