Browse Source

[fix] 工程管理

新增 通过bom父节点id查询bom子节点
修改bom添加后端接口,去掉更新关联bom的物料的操作,防止破坏bom的唯一性
dev
liuxiaoxu 2 months ago
parent
commit
ccb9c93e3e
  1. 5
      ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java
  2. 26
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java
  3. 5
      ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml

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

@ -159,4 +159,9 @@ public interface ErpBomMapper
* 检查bom是否引用了物料
* */
int checkMaterialIsReferencedByBom(String materialNo);
/**
* 通过bom父节点id查询bom子节点
* */
List<ErpBom> selectSubBomsByParentId(Long id);
}

26
ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java

@ -6,6 +6,7 @@ import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.service.ICommonService;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
@ -171,6 +172,9 @@ private ISysAttachService attachService;
@Override
public List<ErpBom> selectErpBomSubList(ErpBom erpBom) {
// erpBom.setAuditStatus("1");
// erpBom.setUseStatus("1");
return erpBomMapper.selectErpBomSubList(erpBom);
}
@ -371,16 +375,18 @@ private ISysAttachService attachService;
Long id = erpBom.getId();
insertErpBomSub(erpBom);
ErpMaterial erpMaterial = materialMapper.selectErpMaterialByMaterialNo(erpBom.getMaterialNo());
if (!Objects.isNull(erpMaterial)) {
ErpMaterial erpMaterial1 = new ErpMaterial();
erpMaterial1.setMaterialNo(erpBom.getMaterialNo());
erpMaterial1.setBomNo(erpBom.getBomNo());
materialMapper.updateMaterialBomNo(erpMaterial1);
}
// if (!Objects.isNull(erpMaterial)) {
// ErpMaterial erpMaterial1 = new ErpMaterial();
// erpMaterial1.setMaterialNo(erpBom.getMaterialNo());
// erpMaterial1.setBomNo(erpBom.getBomNo());
// materialMapper.updateMaterialBomNo(erpMaterial1);
// }
//添加物料关联的bom信息
return result;
}
/**
* 修改bom
*
@ -702,10 +708,15 @@ private ISysAttachService attachService;
erpBom1.setParentId(id);
erpBom1.setCreateBy(ShiroUtils.getLoginName());
erpBom1.setCreateTime(DateUtils.getNowDate());
// 新添加,理论上,刚添加的一阶物料默认审核通过,使用状态为是
// erpBom1.setAuditStatus("1");
// erpBom1.setUseStatus("1");
erpBomMapper.insertErpBom(erpBom1);
}
}
}
public List<ErpBom> selectErpBomList1(){
List<ErpBom> bomList = erpBomMapper.selectErpBomList1();
return bomList;
@ -872,6 +883,9 @@ private ISysAttachService attachService;
if(roleKeys.contains("gcwyRole")){
variables.put("authority",1);
}
// else if(roleKeys.contains("yfzjRole") || roleKeys.contains("admin")) {
// variables.put("authority",4);
// }
// else if(roleKeys.contains("gczgRole")){
// variables.put("authority",3);
// }else if(roleKeys.contains("gcjlRole")){

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

@ -600,5 +600,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select count(1) from erp_bom where material_no = #{materialNo}
</select>
<select id="selectSubBomsByParentId" parameterType="Long" resultMap="ErpBomResult">
<include refid="selectErpBomVo"/>
where parent_id = #{parentId}
</select>
</mapper>
Loading…
Cancel
Save