完善流程新增修改

pull/1/head
wangziyangyang 2020-03-17 16:17:16 +08:00
parent 685a9c5867
commit 5635edd630
6 changed files with 37 additions and 15 deletions

View File

@ -109,7 +109,7 @@ public class SpFlowOperRelationController extends BaseController {
* @param spFlowDto DTO
* @return
*/
@ApiOperation("主数据表头修改")
@ApiOperation("流程与工序关系管理新增+修改")
@PostMapping("/add-or-update")
@ResponseBody
public Result addOrUpdate(@RequestBody SpFlowDto spFlowDto) throws Exception {

View File

@ -18,9 +18,15 @@ import java.util.List;
public interface SpFlowOperRelationMapper extends BaseMapper<SpFlowOperRelation> {
/**
* ID
*
* @param flowId ID
* @return
*/
List<SpOperVo> queryOperRelationByFlowId(@Param("flowId") String flowId);
/**
*
* @param flowId ID
*/
void deleteOperRelationByFlowId(@Param("flowId") String flowId);
}

View File

@ -102,7 +102,11 @@ public class SpFlowOperRelationServiceImpl extends ServiceImpl<SpFlowOperRelatio
String flowId = spFlow.getId();
String flow = spFlow.getFlow();
if (StringUtils.isNotEmpty(flowId)) {
//TODO 根据流程ID 批量删除下挂的工序
spFlowOperRelationMapper.deleteOperRelationByFlowId(flowId);
} else {
//如果流程头表为空先创建一下
iSpFlowService.saveOrUpdate(spFlow);
flowId = spFlow.getId();
}
// 批量处理需要插入数据库的工序
log.info("开始处理流程下工序关系");
@ -110,6 +114,7 @@ public class SpFlowOperRelationServiceImpl extends ServiceImpl<SpFlowOperRelatio
SpFlowOperRelation relation = new SpFlowOperRelation();
relation.setFlowId(flowId);//流程ID
relation.setFlow(flow);//流程编号
SpOper oper = iSpOperService.getById(spOperVoList.get(i).getValue());
if (i == 0) {//首个工序
relation.setPerOperId("");
relation.setPerOper("");
@ -134,12 +139,16 @@ public class SpFlowOperRelationServiceImpl extends ServiceImpl<SpFlowOperRelatio
relation.setOperId(spOperVoList.get(i).getValue());
relation.setOper(spOperVoList.get(i).getTitle());
relation.setSortNum(i + 1);//顺序
processBuild.append("123->");
if (i == 0) {
processBuild.append(oper.getOperDesc());
} else {
processBuild.append("->" + oper.getOperDesc());
}
spFlowOperRelationList.add(relation);
}
log.info("本次流程时序" + processBuild.toString());
spFlow.setProcess(processBuild.toString());
//保存流程头表信息
//更细流程头表信息
iSpFlowService.saveOrUpdate(spFlow);
saveOrUpdateBatch(spFlowOperRelationList);
return Result.success();

View File

@ -20,5 +20,11 @@
ORDER BY sort_num
</select>
<delete id="deleteOperRelationByFlowId">
delete from sp_flow_oper_relation
<where>
flow_id = #{flowId}
</where>
</delete>
</mapper>

View File

@ -30,7 +30,7 @@ body {
}
.splayui-form .layui-form-item > .layui-form-label {
width: 120px !important;
/*width: 120px !important;*/
}
.splayui-form > .layui-form-item > .layui-input-block {

View File

@ -2,7 +2,7 @@
<html>
<head>
<meta charset="UTF-8">
<title>添加用户</title>
<title>工序与流程关系</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
@ -30,18 +30,19 @@
class="layui-input" value="${flow.flowDesc}">
</div>
</div>
<div class="layui-inline">
<label for="js-descr" class="layui-form-label ">流程时序
</label>
<div class="layui-input-inline" style="width: 200px">
<input type="text" id="js-process" name="process" readonly autocomplete="off"
class="layui-input" value="${flow.process}">
</div>
</div>
<div class="layui-form-item">
<label for="js-descr" class="layui-form-label " >流程时序
</label>
<div class="layui-input-inline" style="width: 514px">
<input type="text" id="js-process" readonly autocomplete="off"
class="layui-input" value="${flow.process}">
</div>
</div>
<div class="layui-form-item">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
<fieldset class="layui-elem-field layui-field-title" >
<legend>流程与工序关系</legend>
</fieldset>
<div id="js-shuttle" class="demo-transfer"></div>