Browse Source

[feat]

工程管理 bom信息
service及其接口新增保存编辑bom信息后启动审批流程的方法;
[fix]
修改更新bom信息方法,更改传参类型为ErpBom类;
修改添加bom信息子组件更新方法,先按父id删除记录后再插入要更新的数据;
dev
王晓迪 4 months ago
parent
commit
cfbe873cb5
  1. 7
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java
  2. 52
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java

7
ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java

@ -61,10 +61,10 @@ public interface IErpBomService
/**
* 修改bom
*
* @param erpBomVo bom
* @param erpBom bom
* @return 结果
*/
public int updateErpBom(ErpBomVo erpBomVo);
public int updateErpBom(ErpBom erpBom);
/**
* 批量删除bom
@ -118,6 +118,9 @@ public interface IErpBomService
public ProcessInstance submitApply(ErpBom erpBom);
@Transactional(rollbackFor = Exception.class)
ProcessInstance submitUpdateApply(ErpBom erpBom);
ErpBom selectErpBomByOneMaterialNo(String materialNo);
List<ErpBomVo> selectSubBomsByParentMaterialNo(Map<String, Object> params);

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

@ -345,22 +345,24 @@ private ISysAttachService attachService;
/**
* 修改bom
*
* @param erpBomVo bom
* @param erpBom bom
* @return 结果
*/
@Override
public int updateErpBom(ErpBomVo erpBomVo)
public int updateErpBom(ErpBom erpBom)
{
String loginName = ShiroUtils.getLoginName();
erpBomVo.setUpdateBy(loginName);
erpBomVo.setEngineer(loginName);
erpBomVo.setUpdateTime(DateUtils.getNowDate());
int editFlag = erpBomMapper.updateErpBom(erpBomVo);
Long id = erpBomVo.getId();
erpBom.setUpdateBy(loginName);
erpBom.setEngineer(loginName);
erpBom.setUpdateTime(DateUtils.getNowDate());
int editFlag = erpBomMapper.updateErpBom(erpBom);
Long id = erpBom.getId();
try {
//todo 添加bom信息子组件列表
List<ErpBom> erpBomSubList = erpBomVo.getErpBomList();
List<ErpBom> erpBomSubList = erpBom.getErpBomList();
if (CollectionUtils.isNotEmpty(erpBomSubList)) {
erpBomMapper.deleteErpBomByParentId(id);
for (int i = 0; i < erpBomSubList.size(); i++) {
ErpBom erpBom1 = erpBomSubList.get(i);
erpBom1.setId(null);
@ -368,7 +370,7 @@ private ISysAttachService attachService;
erpBom1.setParentId(id);
erpBom1.setCreateBy(ShiroUtils.getLoginName());
erpBom1.setCreateTime(DateUtils.getNowDate());
erpBomMapper.updateErpBom(erpBom1);
erpBomMapper.insertErpBom(erpBom1);
}
}
@ -703,6 +705,38 @@ private ISysAttachService attachService;
return processInstance;
}
/**
* 提交更新申请
* @param erpBom
* @return
*/
@Transactional(rollbackFor = Exception.class)
@Override
public ProcessInstance submitUpdateApply(ErpBom erpBom) {
SysUser user = ShiroUtils.getSysUser();
erpBom.setApplyUser(user.getLoginName());
erpBom.setApplyTime(DateUtils.getNowDate());
//获取插入的Bom列表的id
updateErpBom(erpBom);
// 启动流程
String applyTitle = user.getUserName()+"发起了物料BOM信息提交审批-"+DateUtils.dateTimeNow();
String instanceType = "submit";
ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,erpBom, user);
String processInstanceId = processInstance.getProcessInstanceId();
// 提交实例id
erpBom.setSubmitInstanceId(processInstanceId);
// 存在提交完就流程结束的情况
boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId);
if(processIsFinish){
// 审核状态-审核通过
erpBom.setAuditStatus("1");
// 使用状态-是
erpBom.setUseStatus("1");
}
erpBomMapper.updateErpBom(erpBom);
return processInstance;
}
@Override
public ErpBom selectErpBomByOneMaterialNo(String materialNo) {
return erpBomMapper.selectErpBomByOneMaterialNo(materialNo);

Loading…
Cancel
Save