|
|
@ -3,6 +3,8 @@ package com.ruoyi.sales.service.impl; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import com.ruoyi.common.exception.BusinessException; |
|
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
|
import com.ruoyi.sales.domain.SalesEstimateDetail; |
|
|
@ -145,6 +147,10 @@ public class SalesEstimateDetailMaterialServiceImpl implements ISalesEstimateDet |
|
|
|
String loginName = ShiroUtils.getLoginName(); |
|
|
|
List<SalesEstimateDetailMaterial> salesEstimateDetailMaterialList = salesEstimateDetail.getSalesEstimateDetailMaterialList(); |
|
|
|
for (SalesEstimateDetailMaterial salesEstimateDetailMaterial : salesEstimateDetailMaterialList) { |
|
|
|
boolean isUnique = checkMaterialNameUnique(salesEstimateDetailMaterial); |
|
|
|
if (isUnique){ |
|
|
|
throw new BusinessException("物料名:"+salesEstimateDetailMaterial.getMaterialName()+"已存在,请勿重复添加"); |
|
|
|
} |
|
|
|
salesEstimateDetailMaterial.setCreateBy(loginName); |
|
|
|
salesEstimateDetailMaterial.setCreateTime(new Date()); |
|
|
|
salesEstimateDetailMaterial.setEstimateDetailId(salesEstimateDetail.getEstimateDetailId()); |
|
|
@ -152,6 +158,20 @@ public class SalesEstimateDetailMaterialServiceImpl implements ISalesEstimateDet |
|
|
|
return salesEstimateDetailMaterialMapper.insertSalesEstimateDetailMaterialBatch(salesEstimateDetailMaterialList); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 检查物料名称是否唯一 |
|
|
|
* |
|
|
|
* @param salesEstimateDetailMaterial 销售估价详情物料价格 |
|
|
|
* @return 结果 |
|
|
|
*/ |
|
|
|
public boolean checkMaterialNameUnique(SalesEstimateDetailMaterial salesEstimateDetailMaterial) { |
|
|
|
int result = salesEstimateDetailMaterialMapper.checkMaterialNameUnique(salesEstimateDetailMaterial); |
|
|
|
if (result > 0){ |
|
|
|
return true; |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 删除销售估价详情物料价格对象 |
|
|
|