add:流程修改
This commit is contained in:
@@ -16,9 +16,12 @@ import java.util.Map;
|
||||
@AllArgsConstructor
|
||||
public enum StatusEnum {
|
||||
//单据状态库类型
|
||||
FORM_STATUS(MapOf.of("生成", "10", "执行中", "20","完成", "99")),
|
||||
FLOW_STATUS(MapOf.of("启动", "10", "执行中", "20","暂停", "30","完成", "99"));
|
||||
MODEL_STATUS(MapOf.of("发布", "10", "未发布", "30")),
|
||||
|
||||
FORM_STATUS(MapOf.of("生成", "10", "执行中", "20","完成", "99")),
|
||||
FLOW_STATUS(MapOf.of("启动", "10", "执行中", "20","暂停", "30","完成", "99")),
|
||||
|
||||
;
|
||||
private Map<String, String> code;
|
||||
|
||||
public String code(String desc) {
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
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.anno.Log;
|
||||
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.dao.StStrategyConfig;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 仓储策略配置表 前端控制器
|
||||
@@ -33,6 +40,16 @@ public class StStrategyConfigController {
|
||||
public ResponseEntity<Object> query(StrategyQuery query, PageQuery page) {
|
||||
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
|
||||
@Log("新增")
|
||||
|
||||
@@ -17,11 +17,10 @@ public class EndEventConverter extends BaseNodeConverter {
|
||||
public FlowNode convertToBpmnModel(Iterator<JSONObject> iterator, JSONObject node, BpmnModel model) {
|
||||
JSONObject properties = node.getJSONObject("properties");
|
||||
String type = node.getString("type");
|
||||
Boolean pass = properties.getBoolean("pass");
|
||||
Boolean pass = properties.getBoolean("passNode");
|
||||
EndEvent end = new EndEvent();
|
||||
end.setId(node.getString("id"));
|
||||
end.setType(node.getString("type"));
|
||||
end.setParentNode(properties.getString("parentNode"));
|
||||
end.setName(properties.getString("name"));
|
||||
end.setDocumentation(properties.getString("documentation"));
|
||||
//设置触发事件
|
||||
|
||||
@@ -18,12 +18,12 @@ public class FormConverter extends BaseNodeConverter {
|
||||
public FlowNode convertToBpmnModel(Iterator<JSONObject> iterator, JSONObject node, BpmnModel model) {
|
||||
JSONObject properties = node.getJSONObject("properties");
|
||||
String type = node.getString("type");
|
||||
Boolean pass = properties.getBoolean("pass");
|
||||
Boolean pass = properties.getBoolean("passNode");
|
||||
Form form = new Form();
|
||||
form.setPassNode(pass);
|
||||
form.setId(node.getString("id"));
|
||||
form.setType(node.getString("type"));
|
||||
form.setParentNode(properties.getString("parentNode"));
|
||||
|
||||
form.setForm_type(node.getString("form_type"));
|
||||
form.setName(properties.getString("name"));
|
||||
form.setCategory(properties.getString("category"));
|
||||
|
||||
@@ -17,10 +17,9 @@ public class GatewayConverter extends BaseNodeConverter {
|
||||
public FlowNode convertToBpmnModel(Iterator<JSONObject> iterator, JSONObject node, BpmnModel model) {
|
||||
JSONObject properties = node.getJSONObject("properties");
|
||||
String type = node.getString("type");
|
||||
Boolean pass = properties.getBoolean("pass");
|
||||
Boolean pass = properties.getBoolean("passNode");
|
||||
GateWay gateWay = new GateWay();
|
||||
gateWay.setPassNode(pass);
|
||||
gateWay.setParentNode(properties.getString("parentNode"));
|
||||
gateWay.setId(node.getString("id"));
|
||||
gateWay.setType(node.getString("type"));
|
||||
gateWay.setName(properties.getString("name"));
|
||||
|
||||
@@ -17,13 +17,12 @@ public class SendMsgConverter extends BaseNodeConverter {
|
||||
public FlowNode convertToBpmnModel(Iterator<JSONObject> iterator, JSONObject node, BpmnModel model) {
|
||||
JSONObject properties = node.getJSONObject("properties");
|
||||
String type = node.getString("type");
|
||||
Boolean pass = properties.getBoolean("pass");
|
||||
Boolean pass = properties.getBoolean("passNode");
|
||||
SendMsg msg = new SendMsg();
|
||||
msg.setPassNode(pass);
|
||||
msg.setId(node.getString("id"));
|
||||
msg.setType(node.getString("type"));
|
||||
msg.setName(properties.getString("name"));
|
||||
msg.setParentNode(properties.getString("parentNode"));
|
||||
msg.setDocumentation(properties.getString("documentation"));
|
||||
//设置触发事件
|
||||
msg.setExecutionListeners(null);
|
||||
|
||||
@@ -18,11 +18,12 @@ public class ServerTaskConverter extends BaseNodeConverter {
|
||||
public FlowNode convertToBpmnModel(Iterator<JSONObject> iterator, JSONObject node, BpmnModel model) {
|
||||
JSONObject properties = node.getJSONObject("properties");
|
||||
String type = node.getString("type");
|
||||
Boolean pass = properties.getBoolean("pass");
|
||||
Boolean pass = properties.getBoolean("passNode");
|
||||
ServerTask form = new ServerTask();
|
||||
form.setId(node.getString("id"));
|
||||
form.setType(node.getString("type"));
|
||||
form.setParentNode(properties.getString("parentNode"));
|
||||
form.setCategory(properties.getString("category"));
|
||||
|
||||
form.setName(properties.getString("name"));
|
||||
form.setDocumentation(properties.getString("documentation"));
|
||||
//设置触发事件
|
||||
|
||||
@@ -21,8 +21,6 @@ public class StartEventConverter extends BaseNodeConverter {
|
||||
start.setId(node.getString("id"));
|
||||
start.setType(node.getString("type"));
|
||||
start.setName(properties.getString("name"));
|
||||
start.setParentNode(properties.getString("parentNode"));
|
||||
|
||||
start.setDocumentation(properties.getString("documentation"));
|
||||
//设置触发事件
|
||||
start.setPassNode(true);
|
||||
|
||||
@@ -19,12 +19,12 @@ public class SubProcessConverter extends BaseNodeConverter {
|
||||
public FlowNode convertToBpmnModel(Iterator<JSONObject> iterator, JSONObject node, BpmnModel model) {
|
||||
JSONObject properties = node.getJSONObject("properties");
|
||||
String type = node.getString("type");
|
||||
Boolean pass = properties.getBoolean("pass");
|
||||
Boolean pass = properties.getBoolean("passNode");
|
||||
SubProcess subProcess = new SubProcess();
|
||||
subProcess.setPassNode(pass);
|
||||
subProcess.setId(node.getString("id"));
|
||||
subProcess.setType(node.getString("type"));
|
||||
subProcess.setParentNode(properties.getString("parentNode"));
|
||||
subProcess.setChildren(node.getJSONArray("children").toJavaList(String.class));
|
||||
subProcess.setName(properties.getString("name"));
|
||||
subProcess.setDocumentation(properties.getString("documentation"));
|
||||
//设置触发事件
|
||||
@@ -40,8 +40,7 @@ public class SubProcessConverter extends BaseNodeConverter {
|
||||
JSONObject next = iterator.next();
|
||||
iterator.remove();
|
||||
FlowNode flowNode = BpmnJSONConverter.Node_Converter.get(next.getString("type")).convertToBpmnModel(iterator, next, model);
|
||||
String parentNode = flowNode.getParentNode();
|
||||
if (StringUtils.isNotEmpty(parentNode) && subProcess.getId().equals(parentNode)){
|
||||
if (subProcess.getChildren().contains(flowNode.getId())){
|
||||
subProcess.getFlowElementMap().put(flowNode.getId(),flowNode);
|
||||
subProcess.getFlowElementList().add(flowNode);
|
||||
}
|
||||
|
||||
@@ -37,14 +37,21 @@ public abstract class FlowNodeActivityBehavior<T> {
|
||||
public final void activity(ExecutionEntity<T> entity) {
|
||||
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);
|
||||
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()));
|
||||
|
||||
@@ -101,7 +101,7 @@ public class FormActivityBehavior extends FlowNodeActivityBehavior<JSONObject> {
|
||||
iostorinvService.save(mst);
|
||||
entity.setT(handler);
|
||||
entity.setForm_id(mst.getId());
|
||||
entity.setForm_type("IOSTOR_INV");
|
||||
entity.setForm_type("ST_IVT_IOSTORINV_IN");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,15 +23,13 @@ public class ServerTaskActivityBehavior extends FlowNodeActivityBehavior<JSONObj
|
||||
System.out.println(entity.getForm_id());
|
||||
FlowElement element = entity.getCurrentFlowElement();
|
||||
ServerTask currentNode = (ServerTask) element;
|
||||
currentNode.getCategory();
|
||||
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) {
|
||||
throw new BadRequestException("【flow】当前节点处理类型未定义");
|
||||
}
|
||||
typeHandler.handler(currentNode.getSkipExpression(), entity.getT().getJSONArray("item"), null);
|
||||
typeHandler.handler(currentNode.getSkipExpression(), entity.getT(), null);
|
||||
|
||||
}
|
||||
super.execute(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class SubProcessActivityBehavior extends FlowNodeActivityBehavior<JSONObj
|
||||
}
|
||||
|
||||
JSONObject form = entity.getT();
|
||||
JSONArray items = form.getJSONArray("item");
|
||||
JSONArray items = (JSONArray)form.remove("item");
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
if (items!=null){
|
||||
//子流程并行,子流程单一的时候直接串行
|
||||
@@ -72,6 +72,7 @@ public class SubProcessActivityBehavior extends FlowNodeActivityBehavior<JSONObj
|
||||
subEntity.setForm_type(entity.getForm_type());
|
||||
subEntity.setDeploymentId(entity.getDeploymentId());
|
||||
subEntity.setCurrentFlowElement(startEvent);
|
||||
new JSONObject(form);
|
||||
subEntity.setT(entity.getT());
|
||||
//在endEvent中有个所有子流程结束的判断:如果判断成功会触发父流程:startEvent暂时通过等待处理防止自动流程导致endEvent判断出错
|
||||
commandExecutor.execute(new StartInstanceCmd(), subEntity);
|
||||
|
||||
@@ -24,10 +24,10 @@ public class ExeInstanceCmd implements Command {
|
||||
@Override
|
||||
public Object execute(ExecutionEntity entity) {
|
||||
//获取当前流程版本信息:有可能是流程线需要区分SequenceFlowOperation
|
||||
if (StatusEnum.FLOW_STATUS.code("暂停").equals(status)){
|
||||
CommandExecutor.getAgenda().planOperation(new ContinuOperation(entity));
|
||||
}else {
|
||||
if (StatusEnum.FLOW_STATUS.code("执行中").equals(status)){
|
||||
CommandExecutor.getAgenda().planOperation(new SequenceFlowOperation(entity));
|
||||
}else {
|
||||
CommandExecutor.getAgenda().planOperation(new ContinuOperation(entity));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ public abstract class FlowNode extends FlowElement {
|
||||
private boolean asynchronous;
|
||||
private boolean asynchronousLeave;
|
||||
private boolean notExclusive;
|
||||
private String parentNode;
|
||||
protected Boolean passNode = Boolean.FALSE;
|
||||
|
||||
private List<SequenceFlow> incomingFlows = new ArrayList<>();
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class SubProcess extends FlowNode {
|
||||
protected List<String> children = new ArrayList<>();
|
||||
|
||||
protected Map<String, FlowElement> flowElementMap = new LinkedHashMap<>();
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.wms.flow_manage.flow.framework.entity.node.impl.task.impl;
|
||||
import lombok.Data;
|
||||
import org.nl.wms.flow_manage.flow.framework.entity.node.impl.task.ExecuteTask;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
@@ -12,5 +13,5 @@ import java.util.List;
|
||||
@Data
|
||||
public class ServerTask extends ExecuteTask {
|
||||
protected String category;
|
||||
protected List<String> skipExpression;
|
||||
protected List<String> skipExpression=new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -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.pm_manage.form_data.service.IPmFormDataService;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -37,7 +38,7 @@ public class DecisionHandler extends TypeHandler<JSONObject,JSONObject> {
|
||||
@Autowired
|
||||
private IStIvtStructattrService iStIvtStructattrService;
|
||||
@Autowired
|
||||
private IPmFormDataService iPmFormDataService;
|
||||
private IStIvtIostorinvdtlInService stIvtIostorinvdtlInService;
|
||||
|
||||
@Autowired
|
||||
private Map<String, Decisioner> decisionHandlerMap;
|
||||
@@ -50,33 +51,34 @@ public class DecisionHandler extends TypeHandler<JSONObject,JSONObject> {
|
||||
*/
|
||||
|
||||
@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");
|
||||
for (int i = 0; i < item.size(); i++) {
|
||||
JSONObject item_json = item.getJSONObject(i);
|
||||
PmFormData iostorinvdtlIn = item_json.toJavaObject(PmFormData.class);
|
||||
List<StIvtStructattr> list = iStIvtStructattrService.list(new QueryWrapper<StIvtStructattr>()
|
||||
.eq("is_emp", true)
|
||||
.eq("is_used", true)
|
||||
.eq("stor_code",iostorinvdtlIn.getStor_code()));
|
||||
for (String param : params) {
|
||||
Decisioner decisioner = decisionHandlerMap.get(param);
|
||||
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);
|
||||
StIvtIostorinvdtlIn iostorinvdtlIn = item_json.toJavaObject(StIvtIostorinvdtlIn.class);
|
||||
List<StIvtStructattr> list = iStIvtStructattrService.list(new QueryWrapper<StIvtStructattr>()
|
||||
.eq("is_emp", true)
|
||||
.eq("is_used", true)
|
||||
.eq("stor_code",iostorinvdtlIn.getStor_code()));
|
||||
for (String param : params) {
|
||||
Decisioner decisioner = decisionHandlerMap.get(param);
|
||||
list = decisioner.handler(list, iostorinvdtlIn);
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
throw new BadRequestException("当前分配策略无可用货位");
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
* @author ZZQ
|
||||
* @Date 2024/3/21 15:16
|
||||
*/
|
||||
@Service("express")
|
||||
@Service("expression")
|
||||
public class ExpressionHandler extends TypeHandler<JSONObject,String> {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -95,5 +95,10 @@ public class ActDeModel implements Serializable {
|
||||
*/
|
||||
private String tenant_id;
|
||||
|
||||
/**
|
||||
* 归属租户
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user