add:流程修改

This commit is contained in:
zhangzq
2024-05-10 13:47:09 +08:00
parent 12f1fefa43
commit 403065e55e
20 changed files with 89 additions and 60 deletions

View File

@@ -16,9 +16,12 @@ import java.util.Map;
@AllArgsConstructor @AllArgsConstructor
public enum StatusEnum { public enum StatusEnum {
//单据状态库类型 //单据状态库类型
FORM_STATUS(MapOf.of("生成", "10", "执行中", "20","完成", "99")), MODEL_STATUS(MapOf.of("发布", "10", "未发布", "30")),
FLOW_STATUS(MapOf.of("启动", "10", "执行中", "20","暂停", "30","完成", "99"));
FORM_STATUS(MapOf.of("生成", "10", "执行中", "20","完成", "99")),
FLOW_STATUS(MapOf.of("启动", "10", "执行中", "20","暂停", "30","完成", "99")),
;
private Map<String, String> code; private Map<String, String> code;
public String code(String desc) { public String code(String desc) {

View File

@@ -1,9 +1,12 @@
package org.nl.wms.decision_manage.controller; package org.nl.wms.decision_manage.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.nl.common.TableDataInfo; import org.nl.common.TableDataInfo;
import org.nl.common.anno.Log; import org.nl.common.anno.Log;
import org.nl.common.domain.entity.PageQuery; import org.nl.common.domain.entity.PageQuery;
import org.nl.common.utils.MapOf;
import org.nl.wms.decision_manage.service.IStStrategyConfigService; import org.nl.wms.decision_manage.service.IStStrategyConfigService;
import org.nl.wms.decision_manage.service.dao.StStrategyConfig; import org.nl.wms.decision_manage.service.dao.StStrategyConfig;
import org.nl.wms.decision_manage.service.dto.StrategyQuery; import org.nl.wms.decision_manage.service.dto.StrategyQuery;
@@ -13,6 +16,10 @@ import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/** /**
* <p> * <p>
* 仓储策略配置表 前端控制器 * 仓储策略配置表 前端控制器
@@ -33,6 +40,16 @@ public class StStrategyConfigController {
public ResponseEntity<Object> query(StrategyQuery query, PageQuery page) { public ResponseEntity<Object> query(StrategyQuery query, PageQuery page) {
return new ResponseEntity<>(TableDataInfo.build(iStStrategyConfigService.page(page.build(),query.build())), HttpStatus.OK); return new ResponseEntity<>(TableDataInfo.build(iStStrategyConfigService.page(page.build(),query.build())), HttpStatus.OK);
} }
@GetMapping("/decisionColumns")
@SaIgnore
public ResponseEntity<Object> decisionColumns() {
List<StStrategyConfig> list = iStStrategyConfigService.list(new QueryWrapper<StStrategyConfig>().select("strategy_code", "strategy_name"));
List<Map> result = new ArrayList<>();
for (StStrategyConfig config : list) {
result.add(MapOf.of("label",config.getStrategy_name(),"value",config.getStrategy_code()));
}
return new ResponseEntity<>(result, HttpStatus.OK);
}
@PostMapping @PostMapping
@Log("新增") @Log("新增")

View File

@@ -17,11 +17,10 @@ public class EndEventConverter extends BaseNodeConverter {
public FlowNode convertToBpmnModel(Iterator<JSONObject> iterator, JSONObject node, BpmnModel model) { public FlowNode convertToBpmnModel(Iterator<JSONObject> iterator, JSONObject node, BpmnModel model) {
JSONObject properties = node.getJSONObject("properties"); JSONObject properties = node.getJSONObject("properties");
String type = node.getString("type"); String type = node.getString("type");
Boolean pass = properties.getBoolean("pass"); Boolean pass = properties.getBoolean("passNode");
EndEvent end = new EndEvent(); EndEvent end = new EndEvent();
end.setId(node.getString("id")); end.setId(node.getString("id"));
end.setType(node.getString("type")); end.setType(node.getString("type"));
end.setParentNode(properties.getString("parentNode"));
end.setName(properties.getString("name")); end.setName(properties.getString("name"));
end.setDocumentation(properties.getString("documentation")); end.setDocumentation(properties.getString("documentation"));
//设置触发事件 //设置触发事件

View File

@@ -18,12 +18,12 @@ public class FormConverter extends BaseNodeConverter {
public FlowNode convertToBpmnModel(Iterator<JSONObject> iterator, JSONObject node, BpmnModel model) { public FlowNode convertToBpmnModel(Iterator<JSONObject> iterator, JSONObject node, BpmnModel model) {
JSONObject properties = node.getJSONObject("properties"); JSONObject properties = node.getJSONObject("properties");
String type = node.getString("type"); String type = node.getString("type");
Boolean pass = properties.getBoolean("pass"); Boolean pass = properties.getBoolean("passNode");
Form form = new Form(); Form form = new Form();
form.setPassNode(pass); form.setPassNode(pass);
form.setId(node.getString("id")); form.setId(node.getString("id"));
form.setType(node.getString("type")); form.setType(node.getString("type"));
form.setParentNode(properties.getString("parentNode"));
form.setForm_type(node.getString("form_type")); form.setForm_type(node.getString("form_type"));
form.setName(properties.getString("name")); form.setName(properties.getString("name"));
form.setCategory(properties.getString("category")); form.setCategory(properties.getString("category"));

View File

@@ -17,10 +17,9 @@ public class GatewayConverter extends BaseNodeConverter {
public FlowNode convertToBpmnModel(Iterator<JSONObject> iterator, JSONObject node, BpmnModel model) { public FlowNode convertToBpmnModel(Iterator<JSONObject> iterator, JSONObject node, BpmnModel model) {
JSONObject properties = node.getJSONObject("properties"); JSONObject properties = node.getJSONObject("properties");
String type = node.getString("type"); String type = node.getString("type");
Boolean pass = properties.getBoolean("pass"); Boolean pass = properties.getBoolean("passNode");
GateWay gateWay = new GateWay(); GateWay gateWay = new GateWay();
gateWay.setPassNode(pass); gateWay.setPassNode(pass);
gateWay.setParentNode(properties.getString("parentNode"));
gateWay.setId(node.getString("id")); gateWay.setId(node.getString("id"));
gateWay.setType(node.getString("type")); gateWay.setType(node.getString("type"));
gateWay.setName(properties.getString("name")); gateWay.setName(properties.getString("name"));

View File

@@ -17,13 +17,12 @@ public class SendMsgConverter extends BaseNodeConverter {
public FlowNode convertToBpmnModel(Iterator<JSONObject> iterator, JSONObject node, BpmnModel model) { public FlowNode convertToBpmnModel(Iterator<JSONObject> iterator, JSONObject node, BpmnModel model) {
JSONObject properties = node.getJSONObject("properties"); JSONObject properties = node.getJSONObject("properties");
String type = node.getString("type"); String type = node.getString("type");
Boolean pass = properties.getBoolean("pass"); Boolean pass = properties.getBoolean("passNode");
SendMsg msg = new SendMsg(); SendMsg msg = new SendMsg();
msg.setPassNode(pass); msg.setPassNode(pass);
msg.setId(node.getString("id")); msg.setId(node.getString("id"));
msg.setType(node.getString("type")); msg.setType(node.getString("type"));
msg.setName(properties.getString("name")); msg.setName(properties.getString("name"));
msg.setParentNode(properties.getString("parentNode"));
msg.setDocumentation(properties.getString("documentation")); msg.setDocumentation(properties.getString("documentation"));
//设置触发事件 //设置触发事件
msg.setExecutionListeners(null); msg.setExecutionListeners(null);

View File

@@ -18,11 +18,12 @@ public class ServerTaskConverter extends BaseNodeConverter {
public FlowNode convertToBpmnModel(Iterator<JSONObject> iterator, JSONObject node, BpmnModel model) { public FlowNode convertToBpmnModel(Iterator<JSONObject> iterator, JSONObject node, BpmnModel model) {
JSONObject properties = node.getJSONObject("properties"); JSONObject properties = node.getJSONObject("properties");
String type = node.getString("type"); String type = node.getString("type");
Boolean pass = properties.getBoolean("pass"); Boolean pass = properties.getBoolean("passNode");
ServerTask form = new ServerTask(); ServerTask form = new ServerTask();
form.setId(node.getString("id")); form.setId(node.getString("id"));
form.setType(node.getString("type")); form.setType(node.getString("type"));
form.setParentNode(properties.getString("parentNode")); form.setCategory(properties.getString("category"));
form.setName(properties.getString("name")); form.setName(properties.getString("name"));
form.setDocumentation(properties.getString("documentation")); form.setDocumentation(properties.getString("documentation"));
//设置触发事件 //设置触发事件

View File

@@ -21,8 +21,6 @@ public class StartEventConverter extends BaseNodeConverter {
start.setId(node.getString("id")); start.setId(node.getString("id"));
start.setType(node.getString("type")); start.setType(node.getString("type"));
start.setName(properties.getString("name")); start.setName(properties.getString("name"));
start.setParentNode(properties.getString("parentNode"));
start.setDocumentation(properties.getString("documentation")); start.setDocumentation(properties.getString("documentation"));
//设置触发事件 //设置触发事件
start.setPassNode(true); start.setPassNode(true);

View File

@@ -19,12 +19,12 @@ public class SubProcessConverter extends BaseNodeConverter {
public FlowNode convertToBpmnModel(Iterator<JSONObject> iterator, JSONObject node, BpmnModel model) { public FlowNode convertToBpmnModel(Iterator<JSONObject> iterator, JSONObject node, BpmnModel model) {
JSONObject properties = node.getJSONObject("properties"); JSONObject properties = node.getJSONObject("properties");
String type = node.getString("type"); String type = node.getString("type");
Boolean pass = properties.getBoolean("pass"); Boolean pass = properties.getBoolean("passNode");
SubProcess subProcess = new SubProcess(); SubProcess subProcess = new SubProcess();
subProcess.setPassNode(pass); subProcess.setPassNode(pass);
subProcess.setId(node.getString("id")); subProcess.setId(node.getString("id"));
subProcess.setType(node.getString("type")); subProcess.setType(node.getString("type"));
subProcess.setParentNode(properties.getString("parentNode")); subProcess.setChildren(node.getJSONArray("children").toJavaList(String.class));
subProcess.setName(properties.getString("name")); subProcess.setName(properties.getString("name"));
subProcess.setDocumentation(properties.getString("documentation")); subProcess.setDocumentation(properties.getString("documentation"));
//设置触发事件 //设置触发事件
@@ -40,8 +40,7 @@ public class SubProcessConverter extends BaseNodeConverter {
JSONObject next = iterator.next(); JSONObject next = iterator.next();
iterator.remove(); iterator.remove();
FlowNode flowNode = BpmnJSONConverter.Node_Converter.get(next.getString("type")).convertToBpmnModel(iterator, next, model); FlowNode flowNode = BpmnJSONConverter.Node_Converter.get(next.getString("type")).convertToBpmnModel(iterator, next, model);
String parentNode = flowNode.getParentNode(); if (subProcess.getChildren().contains(flowNode.getId())){
if (StringUtils.isNotEmpty(parentNode) && subProcess.getId().equals(parentNode)){
subProcess.getFlowElementMap().put(flowNode.getId(),flowNode); subProcess.getFlowElementMap().put(flowNode.getId(),flowNode);
subProcess.getFlowElementList().add(flowNode); subProcess.getFlowElementList().add(flowNode);
} }

View File

@@ -37,14 +37,21 @@ public abstract class FlowNodeActivityBehavior<T> {
public final void activity(ExecutionEntity<T> entity) { public final void activity(ExecutionEntity<T> entity) {
try { try {
//当前节点 //当前节点
if (StringUtils.isNotEmpty(entity.getProc_inst_id())){
iActRuExecutionService.update(new UpdateWrapper<ActRuExecution>()
.eq("proc_inst_id",entity.getProc_inst_id())
.set("activity_id", entity.getActivityId())
.set("activity_name", entity.getActivityName())
.set("form_type", entity.getForm_type())
.set("form_id", entity.getForm_id())
.set("remark", "")
.set("status", StatusEnum.FLOW_STATUS.code("启动"))
.set("form_data", JSONObject.toJSON(entity.getT()).toString())
.set("update_time", DateUtil.now()));
}
this.execute(entity); this.execute(entity);
iActRuExecutionService.update(new UpdateWrapper<ActRuExecution>() iActRuExecutionService.update(new UpdateWrapper<ActRuExecution>()
.eq("proc_inst_id",entity.getProc_inst_id()) .eq("proc_inst_id",entity.getProc_inst_id())
.set("activity_id", entity.getActivityId())
.set("activity_name", entity.getActivityName())
.set("form_type", entity.getForm_type())
.set("form_id", entity.getForm_id())
.set("remark", "")
.set("status", StatusEnum.FLOW_STATUS.code("执行中")) .set("status", StatusEnum.FLOW_STATUS.code("执行中"))
.set("form_data", JSONObject.toJSON(entity.getT()).toString()) .set("form_data", JSONObject.toJSON(entity.getT()).toString())
.set("update_time", DateUtil.now())); .set("update_time", DateUtil.now()));

View File

@@ -101,7 +101,7 @@ public class FormActivityBehavior extends FlowNodeActivityBehavior<JSONObject> {
iostorinvService.save(mst); iostorinvService.save(mst);
entity.setT(handler); entity.setT(handler);
entity.setForm_id(mst.getId()); entity.setForm_id(mst.getId());
entity.setForm_type("IOSTOR_INV"); entity.setForm_type("ST_IVT_IOSTORINV_IN");
} }
} }
} }

View File

@@ -23,15 +23,13 @@ public class ServerTaskActivityBehavior extends FlowNodeActivityBehavior<JSONObj
System.out.println(entity.getForm_id()); System.out.println(entity.getForm_id());
FlowElement element = entity.getCurrentFlowElement(); FlowElement element = entity.getCurrentFlowElement();
ServerTask currentNode = (ServerTask) element; ServerTask currentNode = (ServerTask) element;
currentNode.getCategory();
if (!CollectionUtils.isEmpty(currentNode.getSkipExpression())) { if (!CollectionUtils.isEmpty(currentNode.getSkipExpression())) {
TypeHandler<JSONObject, JSONArray> typeHandler = TypeHandler.HANDLER_MAP.get(currentNode.getCategory()); TypeHandler<JSONObject, JSONObject> typeHandler = TypeHandler.HANDLER_MAP.get(currentNode.getCategory());
if (typeHandler == null) { if (typeHandler == null) {
throw new BadRequestException("【flow】当前节点处理类型未定义"); throw new BadRequestException("【flow】当前节点处理类型未定义");
} }
typeHandler.handler(currentNode.getSkipExpression(), entity.getT().getJSONArray("item"), null); typeHandler.handler(currentNode.getSkipExpression(), entity.getT(), null);
} }
super.execute(entity);
} }
} }

View File

@@ -61,7 +61,7 @@ public class SubProcessActivityBehavior extends FlowNodeActivityBehavior<JSONObj
} }
JSONObject form = entity.getT(); JSONObject form = entity.getT();
JSONArray items = form.getJSONArray("item"); JSONArray items = (JSONArray)form.remove("item");
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
if (items!=null){ if (items!=null){
//子流程并行,子流程单一的时候直接串行 //子流程并行,子流程单一的时候直接串行
@@ -72,6 +72,7 @@ public class SubProcessActivityBehavior extends FlowNodeActivityBehavior<JSONObj
subEntity.setForm_type(entity.getForm_type()); subEntity.setForm_type(entity.getForm_type());
subEntity.setDeploymentId(entity.getDeploymentId()); subEntity.setDeploymentId(entity.getDeploymentId());
subEntity.setCurrentFlowElement(startEvent); subEntity.setCurrentFlowElement(startEvent);
new JSONObject(form);
subEntity.setT(entity.getT()); subEntity.setT(entity.getT());
//在endEvent中有个所有子流程结束的判断如果判断成功会触发父流程startEvent暂时通过等待处理防止自动流程导致endEvent判断出错 //在endEvent中有个所有子流程结束的判断如果判断成功会触发父流程startEvent暂时通过等待处理防止自动流程导致endEvent判断出错
commandExecutor.execute(new StartInstanceCmd(), subEntity); commandExecutor.execute(new StartInstanceCmd(), subEntity);

View File

@@ -24,10 +24,10 @@ public class ExeInstanceCmd implements Command {
@Override @Override
public Object execute(ExecutionEntity entity) { public Object execute(ExecutionEntity entity) {
//获取当前流程版本信息有可能是流程线需要区分SequenceFlowOperation //获取当前流程版本信息有可能是流程线需要区分SequenceFlowOperation
if (StatusEnum.FLOW_STATUS.code("暂停").equals(status)){ if (StatusEnum.FLOW_STATUS.code("执行中").equals(status)){
CommandExecutor.getAgenda().planOperation(new ContinuOperation(entity));
}else {
CommandExecutor.getAgenda().planOperation(new SequenceFlowOperation(entity)); CommandExecutor.getAgenda().planOperation(new SequenceFlowOperation(entity));
}else {
CommandExecutor.getAgenda().planOperation(new ContinuOperation(entity));
} }
return null; return null;
} }

View File

@@ -20,7 +20,6 @@ public abstract class FlowNode extends FlowElement {
private boolean asynchronous; private boolean asynchronous;
private boolean asynchronousLeave; private boolean asynchronousLeave;
private boolean notExclusive; private boolean notExclusive;
private String parentNode;
protected Boolean passNode = Boolean.FALSE; protected Boolean passNode = Boolean.FALSE;
private List<SequenceFlow> incomingFlows = new ArrayList<>(); private List<SequenceFlow> incomingFlows = new ArrayList<>();

View File

@@ -23,6 +23,7 @@ import java.util.Map;
@Data @Data
public class SubProcess extends FlowNode { public class SubProcess extends FlowNode {
protected List<String> children = new ArrayList<>();
protected Map<String, FlowElement> flowElementMap = new LinkedHashMap<>(); protected Map<String, FlowElement> flowElementMap = new LinkedHashMap<>();

View File

@@ -3,6 +3,7 @@ package org.nl.wms.flow_manage.flow.framework.entity.node.impl.task.impl;
import lombok.Data; import lombok.Data;
import org.nl.wms.flow_manage.flow.framework.entity.node.impl.task.ExecuteTask; import org.nl.wms.flow_manage.flow.framework.entity.node.impl.task.ExecuteTask;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/* /*
@@ -12,5 +13,5 @@ import java.util.List;
@Data @Data
public class ServerTask extends ExecuteTask { public class ServerTask extends ExecuteTask {
protected String category; protected String category;
protected List<String> skipExpression; protected List<String> skipExpression=new ArrayList<>();
} }

View File

@@ -15,6 +15,7 @@ import org.nl.wms.decision_manage.service.IStStrategyConfigService;
import org.nl.wms.flow_manage.flow.framework.process.nodeType.TypeHandler; import org.nl.wms.flow_manage.flow.framework.process.nodeType.TypeHandler;
import org.nl.wms.pm_manage.form_data.service.IPmFormDataService; import org.nl.wms.pm_manage.form_data.service.IPmFormDataService;
import org.nl.wms.pm_manage.form_data.service.dao.PmFormData; import org.nl.wms.pm_manage.form_data.service.dao.PmFormData;
import org.nl.wms.stor_manage.service.in.iostor_dtl.IStIvtIostorinvdtlInService;
import org.nl.wms.stor_manage.service.in.iostor_dtl.dao.StIvtIostorinvdtlIn; import org.nl.wms.stor_manage.service.in.iostor_dtl.dao.StIvtIostorinvdtlIn;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -37,7 +38,7 @@ public class DecisionHandler extends TypeHandler<JSONObject,JSONObject> {
@Autowired @Autowired
private IStIvtStructattrService iStIvtStructattrService; private IStIvtStructattrService iStIvtStructattrService;
@Autowired @Autowired
private IPmFormDataService iPmFormDataService; private IStIvtIostorinvdtlInService stIvtIostorinvdtlInService;
@Autowired @Autowired
private Map<String, Decisioner> decisionHandlerMap; private Map<String, Decisioner> decisionHandlerMap;
@@ -50,33 +51,34 @@ public class DecisionHandler extends TypeHandler<JSONObject,JSONObject> {
*/ */
@Override @Override
public JSONObject handler(List<String> params, JSONObject entity, BmFormStruc form_struc) { public JSONObject handler(List<String> params, JSONObject item_json, BmFormStruc form_struc) {
//出入库明细 //出入库明细
JSONArray item = entity.getJSONArray("item"); StIvtIostorinvdtlIn iostorinvdtlIn = item_json.toJavaObject(StIvtIostorinvdtlIn.class);
for (int i = 0; i < item.size(); i++) { List<StIvtStructattr> list = iStIvtStructattrService.list(new QueryWrapper<StIvtStructattr>()
JSONObject item_json = item.getJSONObject(i); .eq("is_emp", true)
PmFormData iostorinvdtlIn = item_json.toJavaObject(PmFormData.class); .eq("is_used", true)
List<StIvtStructattr> list = iStIvtStructattrService.list(new QueryWrapper<StIvtStructattr>() .eq("stor_code",iostorinvdtlIn.getStor_code()));
.eq("is_emp", true) for (String param : params) {
.eq("is_used", true) Decisioner decisioner = decisionHandlerMap.get(param);
.eq("stor_code",iostorinvdtlIn.getStor_code())); list = decisioner.handler(list, iostorinvdtlIn);
for (String param : params) { if (CollectionUtils.isEmpty(list)){
Decisioner decisioner = decisionHandlerMap.get(param); throw new BadRequestException("当前分配策略无可用货位");
list = decisioner.handler(list, iostorinvdtlIn);
if (CollectionUtils.isEmpty(list)){
throw new BadRequestException("当前分配策略无可用货位");
}
//跟新货位载具
String struct_code = list.get(0).getStruct_code();
//更新仓位,更新数据
iStIvtStructattrService.update(new UpdateWrapper<StIvtStructattr>()
.set("vahicle_code",struct_code)
.eq("struct_code",struct_code));
iPmFormDataService.updateById(iostorinvdtlIn);
item_json.getJSONObject("form_data").put("point_code2", struct_code);
} }
System.out.println(list); //跟新货位载具
String struct_code = list.get(0).getStruct_code();
//更新仓位,更新数据
iStIvtStructattrService.update(new UpdateWrapper<StIvtStructattr>()
.set("vahicle_code",struct_code)
.eq("struct_code",struct_code));
// iPmFormDataService.updateById(iostorinvdtlIn);
stIvtIostorinvdtlInService.updateById(iostorinvdtlIn);
item_json.getJSONObject("form_data").put("point_code2", struct_code);
} }
System.out.println(list);
// JSONArray item = entity.getJSONArray("item");
// for (int i = 0; i < item.size(); i++) {
//
// }
return null; return null;
} }

View File

@@ -11,7 +11,7 @@ import java.util.List;
* @author ZZQ * @author ZZQ
* @Date 2024/3/21 15:16 * @Date 2024/3/21 15:16
*/ */
@Service("express") @Service("expression")
public class ExpressionHandler extends TypeHandler<JSONObject,String> { public class ExpressionHandler extends TypeHandler<JSONObject,String> {
@Override @Override

View File

@@ -95,5 +95,10 @@ public class ActDeModel implements Serializable {
*/ */
private String tenant_id; private String tenant_id;
/**
* 归属租户
*/
private String status;
} }