Browse Source

[fix] 工程管理

修改物料作废后端接口:新增作废前判断,是否被bom引用判断,有就进行提示;是否被销售订单引用,有就进行提示;是否被客户报价引用,有就进行提示;是否被销售估价引用,有就进行提示;是否被开发修改单引用,有就进行提示;
bom Mapper新增 检查bom是否引用了物料后端接口
开发修改单子表Mapper 新增 检查开发修改单子表是否引用了物料后端接口
销售估价详情Mapper新增 检查销售估价子表是否引用了物料后端接口
客户报价子表Mapper新增 检查客户报价子表是否引用了物料后端接口
销售订单子表Mapper新增 检查销售订单子表是否引用了物料后端接口
dev
liuxiaoxu 2 months ago
parent
commit
f4ebd44770
  1. 6
      ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java
  2. 5
      ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpDevelopModifyorderDetailMapper.java
  3. 54
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java
  4. 5
      ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesEstimateDetailMapper.java
  5. 4
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerQuoteChildMapper.java
  6. 5
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderChildMapper.java
  7. 7
      ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml
  8. 4
      ruoyi-admin/src/main/resources/mapper/erp/ErpDevelopModifyorderDetailMapper.xml
  9. 4
      ruoyi-admin/src/main/resources/mapper/sales/SalesEstimateDetailMapper.xml
  10. 6
      ruoyi-admin/src/main/resources/mapper/system/SysCustomerQuoteChildMapper.xml
  11. 4
      ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml

6
ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java

@ -153,4 +153,10 @@ public interface ErpBomMapper
* @return bom集合
*/
public List<ErpBomVo> selectErpBomListByBomNos(String[] bomNos);
/**
* 检查bom是否引用了物料
* */
int checkMaterialIsReferencedByBom(String materialNo);
}

5
ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpDevelopModifyorderDetailMapper.java

@ -84,4 +84,9 @@ public interface ErpDevelopModifyorderDetailMapper
* 根据bomId和开发修改单查询开发修改单详情物料信息
* */
ErpDevelopModifyorderDetail selectModifyorderDetailByCodeAndId(ErpDevelopModifyorderDetail modifyorderDetail);
/**
* 检查开发修改单子表是否引用了物料
* */
int checkMaterialIsReferencedByDevelopModifyorderDetail(String materialNo);
}

54
ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java

@ -14,6 +14,8 @@ import com.ruoyi.erp.domain.ErpMaterial;
import com.ruoyi.erp.domain.ErpMaterialVo;
import com.ruoyi.erp.domain.vo.ErpMaterialPurchaseHistoryVo;
import com.ruoyi.erp.domain.vo.ErpMaterialSalesHistoryVo;
import com.ruoyi.erp.mapper.ErpBomMapper;
import com.ruoyi.erp.mapper.ErpDevelopModifyorderDetailMapper;
import com.ruoyi.erp.mapper.ErpMaterialMapper;
import com.ruoyi.erp.service.IErpMaterialService;
import com.ruoyi.process.general.service.IProcessService;
@ -23,12 +25,10 @@ import com.ruoyi.purchase.domain.PurchaseOrderChild;
import com.ruoyi.purchase.mapper.PurchaseOrderChildMapper;
import com.ruoyi.purchase.mapper.PurchaseOrderMapper;
import com.ruoyi.purchase.mapper.PurchasePlanChildMapper;
import com.ruoyi.sales.mapper.SalesEstimateDetailMapper;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.domain.Vo.ExportCustomerQuoteChildVo;
import com.ruoyi.system.mapper.OutsourceMaterialMapper;
import com.ruoyi.system.mapper.SysSalesOrderChildMapper;
import com.ruoyi.system.mapper.SysSalesOrderMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.mapper.*;
import com.ruoyi.system.service.*;
import com.ruoyi.warehouse.domain.WarehouseInventoryInquiry;
import com.ruoyi.warehouse.mapper.WarehouseInventoryInquiryMapper;
@ -58,6 +58,14 @@ public class ErpMaterialServiceImpl implements IErpMaterialService
{
@Autowired
private ErpMaterialMapper erpMaterialMapper;
@Autowired
private ErpBomMapper erpBomMapper;
@Autowired
private ErpDevelopModifyorderDetailMapper developModifyorderDetailMapper;
@Autowired
private WarehouseInventoryInquiryMapper inventoryInquiryMapper;
@ -106,6 +114,13 @@ public class ErpMaterialServiceImpl implements IErpMaterialService
@Autowired
private OutsourceMaterialMapper outsourceMaterialMapper;
@Autowired
private SysCustomerQuoteChildMapper customerQuoteChildMapper;
@Autowired
private SalesEstimateDetailMapper estimateDetailMapper;
private final static String RMB = "1"; //RMB
/**
@ -473,6 +488,37 @@ public class ErpMaterialServiceImpl implements IErpMaterialService
ErpMaterialVo erpMaterialVo = erpMaterialMapper.selectErpMaterialById(erpMaterial.getId());
//作废前判断该物料是否被其他模块引用
//是否被bom引用
int countBom = erpBomMapper.checkMaterialIsReferencedByBom(erpMaterialVo.getMaterialNo());
if(countBom>0){
throw new BusinessException("该物料信息被bom引用,无法作废!");
}
//是否被销售订单引用
int countSalesOrderChild = sysSalesOrderChildMapper.checkMaterialIsReferencedBySalesOrderChild(erpMaterialVo.getMaterialNo());
if(countSalesOrderChild>0){
throw new BusinessException("该物料信息被销售订单引用,无法作废!");
}
//是否被客户报价引用
int countCustomerQuoteChild = customerQuoteChildMapper.checkMaterialIsReferencedByCustomerQuoteChild(erpMaterialVo.getMaterialNo());
if(countCustomerQuoteChild>0){
throw new BusinessException("该物料信息被客户报价引用,无法作废!");
}
//是否被销售估价引用
int countEstimateDetail = estimateDetailMapper.checkMaterialIsReferencedByEstimateDetail(erpMaterialVo.getMaterialNo());
if(countEstimateDetail>0){
throw new BusinessException("该物料信息被销售估价引用,无法作废!");
}
//是否被开发修改单引用
int countDevelopModifyorderDetail = developModifyorderDetailMapper.checkMaterialIsReferencedByDevelopModifyorderDetail(erpMaterialVo.getMaterialNo());
if(countDevelopModifyorderDetail>0){
throw new BusinessException("该物料信息被开发修改单引用,无法作废!");
}
SysUser sysUser = ShiroUtils.getSysUser();
List<SysPost> sysPostsList = sysPostService.selectPostsByUserId(sysUser.getUserId());
String operPeople = sysUser.getDept().getDeptName() + "/" + sysPostsList.get(0).getPostName()+"/" + sysUser.getUserName();

5
ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesEstimateDetailMapper.java

@ -90,4 +90,9 @@ public interface SalesEstimateDetailMapper
* @return
*/
List<SalesEstimateDetail> selectEstimateDetailListByCode(String salesEstimateCode);
/**
* 检查销售估价子表是否引用了物料
* */
int checkMaterialIsReferencedByEstimateDetail(String materialNo);
}

4
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerQuoteChildMapper.java

@ -20,4 +20,8 @@ public interface SysCustomerQuoteChildMapper {
/*删除ids中的quoteId的所有子项*/
int deleteSysCustomerQuoteChildByQuoteIds(String[] ids);
/**
* 检查客户报价子表是否引用了物料
* */
int checkMaterialIsReferencedByCustomerQuoteChild(String materialNo);
}

5
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderChildMapper.java

@ -52,4 +52,9 @@ public interface SysSalesOrderChildMapper {
* 根据物料号查询销售订单子表
* */
List<SysSalesOrderChild> selectOrderChildListByMaterialNo(String materialNo);
/**
* 检查销售订单子表是否引用了物料
* */
int checkMaterialIsReferencedBySalesOrderChild(String materialNo);
}

7
ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml

@ -594,4 +594,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{bomNo}
</foreach>
</select>
<select id="checkMaterialIsReferencedByBom" parameterType="String" resultType="integer">
select count(1) from erp_bom where material_no = #{materialNo}
</select>
</mapper>

4
ruoyi-admin/src/main/resources/mapper/erp/ErpDevelopModifyorderDetailMapper.xml

@ -53,6 +53,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and bom_id = #{bomId}
</select>
<select id="checkMaterialIsReferencedByDevelopModifyorderDetail" parameterType="String" resultType="Integer">
select count(1) from erp_develop_modifyorder_detail where material_no = #{materialNo}
</select>
<insert id="insertErpDevelopModifyorderDetail" parameterType="ErpDevelopModifyorderDetail" useGeneratedKeys="true" keyProperty="developOrderDetailId">
insert into erp_develop_modifyorder_detail
<trim prefix="(" suffix=")" suffixOverrides=",">

4
ruoyi-admin/src/main/resources/mapper/sales/SalesEstimateDetailMapper.xml

@ -64,6 +64,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where sales_estimate_code = #{salesEstimateCode}
</select>
<select id="checkMaterialIsReferencedByEstimateDetail" parameterType="String" resultType="Integer">
select count(1) from sales_estimate_detail where material_no = #{materialNo}
</select>
<insert id="insertSalesEstimateDetail" parameterType="SalesEstimateDetail" useGeneratedKeys="true" keyProperty="estimateDetailId">
insert into sales_estimate_detail
<trim prefix="(" suffix=")" suffixOverrides=",">

6
ruoyi-admin/src/main/resources/mapper/system/SysCustomerQuoteChildMapper.xml

@ -59,6 +59,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectSysCustomerQuoteChildVo"/>
where quoteId = #{quoteId}
</select>
<select id="checkMaterialIsReferencedByCustomerQuoteChild" parameterType="String" resultType="integer">
select count(1) from sys_customer_quotechild where materialCode = #{materialCode}
</select>
<insert id="insertSysCustomerQuoteChild" parameterType="SysCustomerQuoteChild" useGeneratedKeys="true" keyProperty="id">
insert into sys_customer_quotechild
<trim prefix="(" suffix=")" suffixOverrides=",">

4
ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml

@ -120,6 +120,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where a.materialCode = #{materialCode}
</select>
<select id="checkMaterialIsReferencedBySalesOrderChild" parameterType="String" resultType="integer">
select count(1) from sys_sales_order_child where materialCode = #{materialCode}
</select>
<insert id="insertSysSalesOrderChild" parameterType="SysSalesOrderChild" useGeneratedKeys="true" keyProperty="id">
insert into sys_sales_order_child

Loading…
Cancel
Save