Browse Source

[feat] 销售管理

销售估价列表页面去掉无物料号添加按钮
销售估价详情物料 新增 通过物料名称查询详情物料的唯一性后端接口
dev
liuxiaoxu 4 months ago
parent
commit
eed637f805
  1. 6
      ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesEstimateDetailMaterialMapper.java
  2. 20
      ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesEstimateDetailMaterialServiceImpl.java
  3. 6
      ruoyi-admin/src/main/resources/mapper/sales/SalesEstimateDetailMaterialMapper.xml
  4. 6
      ruoyi-admin/src/main/resources/templates/sales/estimate/add.html

6
ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesEstimateDetailMaterialMapper.java

@ -108,4 +108,10 @@ public interface SalesEstimateDetailMaterialMapper
*/
List<SalesEstimateDetailMaterial> selectDetailMaterialListByEstimateDetailIds(List<Long> estimateDetailIds);
/**
* 通过物料名称查询详情物料的唯一性
*
* @return 结果
*/
int checkMaterialNameUnique(SalesEstimateDetailMaterial salesEstimateDetailMaterial);
}

20
ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesEstimateDetailMaterialServiceImpl.java

@ -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;
}
/**
* 删除销售估价详情物料价格对象

6
ruoyi-admin/src/main/resources/mapper/sales/SalesEstimateDetailMaterialMapper.xml

@ -58,6 +58,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</select>
<select id="checkMaterialNameUnique" parameterType="SalesEstimateDetailMaterial" resultType="Integer">
select count(1) from sales_estimate_detail_material
where
material_name = #{materialName}
</select>
<insert id="insertSalesEstimateDetailMaterial" parameterType="SalesEstimateDetailMaterial" useGeneratedKeys="true" keyProperty="estimateDetailMaterialId">
insert into sales_estimate_detail_material
<trim prefix="(" suffix=")" suffixOverrides=",">

6
ruoyi-admin/src/main/resources/templates/sales/estimate/add.html

@ -95,9 +95,9 @@
<a class="btn btn-success" onclick="insertMaterialRow()">
<i class="fa fa-plus"></i> 添加物料
</a>
<a class="btn btn-success" onclick="insertNoMaterialRow()">
<i class="fa fa-plus"></i> 添加无料号物料
</a>
<!-- <a class="btn btn-success" onclick="insertNoMaterialRow()">-->
<!-- <i class="fa fa-plus"></i> 添加无料号物料-->
<!-- </a>-->
</div>
</div>
<div class="row">

Loading…
Cancel
Save