add:拣选流程优化;

This commit is contained in:
zhangzq
2024-06-18 20:33:25 +08:00
parent 9f776a45c9
commit 52d7020ff8
16 changed files with 89 additions and 55 deletions

View File

@@ -32,7 +32,7 @@ public enum StatusEnum {
* 出入库单据类型 * 出入库单据类型
*/ */
IOBILL_TYPE_IN(ForkMap.of("生产入库", "10","inStorageTask", "调拨入库", "11","inStorageTask", "退货入库", "12","inStorageTask","拣选回库", "13","inStorageTask")), IOBILL_TYPE_IN(ForkMap.of("生产入库", "10","inStorageTask", "调拨入库", "11","inStorageTask", "退货入库", "12","inStorageTask","拣选回库", "13","inStorageTask")),
IOBILL_TYPE_OUT(ForkMap.of("销售出库", "20","outStorageTask","生产出库", "21","outStorageTask", "调拨出库", "22","outStorageTask", "拣选出库", "23","outStorageTask")), IOBILL_TYPE_OUT(ForkMap.of("销售出库", "20","outStorageTask","生产出库", "21","outStorageTask", "调拨出库", "22","outStorageTask", "拣选出库", "23","conveyorOutStorageTask")),
/** /**
* 任务类型 * 任务类型
@@ -81,12 +81,6 @@ public enum StatusEnum {
public Boolean check(String code) { public Boolean check(String code) {
ForkMap<String, String, String> map = this.getCode(); ForkMap<String, String, String> map = this.getCode();
for (String key : map.getKeySet()) { return map.getKeySet().contains(code);
if (code.equals(map.getM(key))){
return true;
}
}
return false;
} }
} }

View File

@@ -124,9 +124,13 @@ public class BmFormStruc implements Serializable {
*/ */
private String parent_id; private String parent_id;
/** /**
* 关联上级表单id * 表单自动映射
*/ */
private Boolean auto_mapping; private Boolean auto_mapping;
/**
* 是否属于基础表单
*/
private Boolean is_base;
} }

View File

@@ -117,6 +117,14 @@ public class BmFormStrucDto implements Serializable {
* 是否含有明细表单 * 是否含有明细表单
*/ */
private Boolean has_child; private Boolean has_child;
/**
* 是否为基础表
*/
private Boolean is_base;
/**
* 表单自动映射
*/
private Boolean auto_mapping;
/** /**
* 关联上级表单id * 关联上级表单id

View File

@@ -115,8 +115,8 @@ public class FormActivityBehavior extends FlowNodeActivityBehavior<JSONObject> {
} }
iostorinvService.save(mst); iostorinvService.save(mst);
entity.setT(handler); entity.setT(handler);
entity.setForm_id(handler.getString("form_type")); entity.setForm_id(handler.getString("form_id"));
entity.setForm_type(handler.getString("form_id")); entity.setForm_type(handler.getString("form_type"));
} }
} }
} }

View File

@@ -37,8 +37,8 @@ public class ServerTaskActivityBehavior extends FlowNodeActivityBehavior<JSONObj
} }
JSONObject handler = typeHandler.handler(currentNode.getSkipExpression(), entity, null); JSONObject handler = typeHandler.handler(currentNode.getSkipExpression(), entity, null);
entity.setT(handler); entity.setT(handler);
entity.setForm_id(handler.getString("form_type")); entity.setForm_id(handler.getString("form_id"));
entity.setForm_type(handler.getString("form_id")); entity.setForm_type(handler.getString("form_type"));
} }
} }
} }

View File

@@ -2,10 +2,13 @@ package org.nl.wms.flow_manage.flow.framework.engine.behavior.impl;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.nl.common.domain.exception.BadRequestException; import org.nl.common.domain.exception.BadRequestException;
import org.nl.common.enums.StatusEnum; import org.nl.common.enums.StatusEnum;
import org.nl.common.utils.IdUtil; import org.nl.common.utils.IdUtil;
import org.nl.wms.config_manage.form_struc.service.IBmFormStrucService;
import org.nl.wms.config_manage.form_struc.service.dao.BmFormStruc;
import org.nl.wms.flow_manage.flow.framework.engine.behavior.FlowNodeActivityBehavior; import org.nl.wms.flow_manage.flow.framework.engine.behavior.FlowNodeActivityBehavior;
import org.nl.wms.flow_manage.flow.framework.engine.cmd.CommandExecutor; import org.nl.wms.flow_manage.flow.framework.engine.cmd.CommandExecutor;
import org.nl.wms.flow_manage.flow.framework.engine.operation.impl.SequenceFlowOperation; import org.nl.wms.flow_manage.flow.framework.engine.operation.impl.SequenceFlowOperation;
@@ -17,11 +20,15 @@ import org.nl.wms.flow_manage.flow.service.deployment.IActReProcdefService;
import org.nl.wms.flow_manage.flow.service.deployment.dao.ActReProcdef; import org.nl.wms.flow_manage.flow.service.deployment.dao.ActReProcdef;
import org.nl.wms.flow_manage.flow.service.execution.IActRuExecutionService; import org.nl.wms.flow_manage.flow.service.execution.IActRuExecutionService;
import org.nl.wms.flow_manage.flow.service.execution.dao.ActRuExecution; import org.nl.wms.flow_manage.flow.service.execution.dao.ActRuExecution;
import org.nl.wms.flow_manage.flow.service.history.dao.ActHiExecution;
import org.nl.wms.pm_manage.form_data.service.IPmFormDataService; import org.nl.wms.pm_manage.form_data.service.IPmFormDataService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.stream.Collectors;
/* /*
* @author ZZQ * @author ZZQ
@@ -32,9 +39,11 @@ import java.util.function.Consumer;
public class StartEventActivityBehavior extends FlowNodeActivityBehavior { public class StartEventActivityBehavior extends FlowNodeActivityBehavior {
@Autowired @Autowired
IActReProcdefService deploymentService; private IActReProcdefService deploymentService;
@Autowired @Autowired
IPmFormDataService iPmFormDataService; private IPmFormDataService iPmFormDataService;
@Autowired
private IBmFormStrucService iBmFormStrucService;
@Override @Override
public void execute(ExecutionEntity entity) { public void execute(ExecutionEntity entity) {
@@ -48,8 +57,24 @@ public class StartEventActivityBehavior extends FlowNodeActivityBehavior {
ActReProcdef deployment = deploymentService.getById(entity.getDeploymentId()); ActReProcdef deployment = deploymentService.getById(entity.getDeploymentId());
if (deployment==null){throw new BadRequestException("当前部署的流程状态异常");} if (deployment==null){throw new BadRequestException("当前部署的流程状态异常");}
//创建流程实例: //创建流程实例:
String proc_inst_id = IdUtil.getStringId();
StartEvent tmpFlow = (StartEvent)entity.getCurrentFlowElement();
String form_type = tmpFlow.getForm_type();
BmFormStruc bmFormStruc = iBmFormStrucService.getOne(new QueryWrapper<BmFormStruc>().eq("form_type", form_type));
StringBuffer sql = new StringBuffer();
sql.append("update ")
.append(bmFormStruc.getIs_base()?form_type:"pm_form_data")
.append(" set status = ")
.append("'"+StatusEnum.FORM_STATUS.code("执行中")+"'")
.append(" where id = ")
.append("'"+entity.getForm_id()+"'");
iPmFormDataService.dynamicSql(sql.toString());
Consumer callback = entity.getCallback();
if (callback!=null){
callback.accept(proc_inst_id);
}
ActRuExecution execution = new ActRuExecution(); ActRuExecution execution = new ActRuExecution();
execution.setProc_inst_id(IdUtil.getStringId()); execution.setProc_inst_id(proc_inst_id);
execution.setDeployment_id(deployment.getDeployment_id()); execution.setDeployment_id(deployment.getDeployment_id());
execution.setForm_type(entity.getForm_type()); execution.setForm_type(entity.getForm_type());
execution.setParent_id(entity.getParent_id()); execution.setParent_id(entity.getParent_id());
@@ -60,22 +85,7 @@ public class StartEventActivityBehavior extends FlowNodeActivityBehavior {
execution.setCreate_time(DateUtil.now()); execution.setCreate_time(DateUtil.now());
execution.setStatus(StatusEnum.FLOW_STATUS.code("启动")); execution.setStatus(StatusEnum.FLOW_STATUS.code("启动"));
iActRuExecutionService.save(execution); iActRuExecutionService.save(execution);
StartEvent currentFlowElement = (StartEvent)entity.getCurrentFlowElement();
String form_type = currentFlowElement.getForm_type();
if (StringUtils.isNotEmpty(form_type)){
StringBuffer sql = new StringBuffer();
sql.append("update ")
.append(entity.getForm_type())
.append(" set status = ")
.append("'"+StatusEnum.FORM_STATUS.code("执行中")+"'")
.append(" where id = ")
.append("'"+entity.getForm_id()+"'");
iPmFormDataService.dynamicSql(sql.toString());
}
Consumer callback = entity.getCallback();
if (callback!=null){
callback.accept(execution.getProc_inst_id());
}
entity.setProc_inst_id(execution.getProc_inst_id()); entity.setProc_inst_id(execution.getProc_inst_id());
} }

View File

@@ -109,8 +109,8 @@ public class StrucFormActivityBehavior extends FlowNodeActivityBehavior<JSONObje
} }
iPmFormDataService.save(mst); iPmFormDataService.save(mst);
entity.setT(handler); entity.setT(handler);
entity.setForm_id(handler.getString("form_type")); entity.setForm_id(handler.getString("form_id"));
entity.setForm_type(handler.getString("form_id")); entity.setForm_type(handler.getString("form_type"));
} }
} }
} }

View File

@@ -67,6 +67,10 @@ public class DecisionHandler extends TypeHandler<JSONObject,ExecutionEntity<JSON
JSONObject t = entity.getT(); JSONObject t = entity.getT();
JSONObject item_json = t.getJSONObject("t"); JSONObject item_json = t.getJSONObject("t");
ServerTask flow = (ServerTask)entity.getCurrentFlowElement(); ServerTask flow = (ServerTask)entity.getCurrentFlowElement();
JSONObject auxParam = flow.getAuxParam();
if (auxParam!=null){
item_json.putAll(auxParam);
}
Map<String, String> map = SpringContextHolder.getBean(DecisionHandler.class).dispense(params, item_json); Map<String, String> map = SpringContextHolder.getBean(DecisionHandler.class).dispense(params, item_json);
//更新仓位,更新数据 //更新仓位,更新数据
System.out.println(flow.getForm_type()+"更新明细id"+item_json.getString("id")); System.out.println(flow.getForm_type()+"更新明细id"+item_json.getString("id"));

View File

@@ -6,6 +6,8 @@ import org.apache.commons.lang3.StringUtils;
import org.nl.common.domain.exception.BadRequestException; import org.nl.common.domain.exception.BadRequestException;
import org.nl.common.enums.StatusEnum; import org.nl.common.enums.StatusEnum;
import org.nl.common.publish.AbstraceListener; import org.nl.common.publish.AbstraceListener;
import org.nl.wms.config_manage.form_struc.service.IBmFormStrucService;
import org.nl.wms.config_manage.form_struc.service.dao.BmFormStruc;
import org.nl.wms.flow_manage.flow.service.history.IActHiExecutionService; import org.nl.wms.flow_manage.flow.service.history.IActHiExecutionService;
import org.nl.wms.flow_manage.flow.service.history.dao.ActHiExecution; import org.nl.wms.flow_manage.flow.service.history.dao.ActHiExecution;
import org.nl.wms.flow_manage.monitor.event.FlowEndEvent; import org.nl.wms.flow_manage.monitor.event.FlowEndEvent;
@@ -15,6 +17,8 @@ import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/* /*
* @author ZZQ * @author ZZQ
@@ -30,6 +34,10 @@ public class FlowEndEventListener extends AbstraceListener<FlowEndEvent> {
@Autowired @Autowired
private IPmFormDataService iPmFormDataService; private IPmFormDataService iPmFormDataService;
@Autowired
private IBmFormStrucService iBmFormStrucService;
@Override @Override
protected String doEvent(FlowEndEvent event) { protected String doEvent(FlowEndEvent event) {
//更新所有流程过程中的单据为完成 //更新所有流程过程中的单据为完成
@@ -44,10 +52,13 @@ public class FlowEndEventListener extends AbstraceListener<FlowEndEvent> {
.eq("proc_inst_id", proc_inst_id) .eq("proc_inst_id", proc_inst_id)
.in("form_type",finish) .in("form_type",finish)
.select("activity_id","update_time","form_type","form_id")); .select("activity_id","update_time","form_type","form_id"));
Set<String> tmpFormTypes = historys.stream().map(ActHiExecution::getForm_type).collect(Collectors.toSet());
List<BmFormStruc> tmpFormTypeCollect = iBmFormStrucService.list(new QueryWrapper<BmFormStruc>().in("form_type", tmpFormTypes));
Set<String> baseFromCollect = tmpFormTypeCollect.stream().filter(BmFormStruc::getIs_base).map(BmFormStruc::getForm_type).collect(Collectors.toSet());
for (ActHiExecution history : historys) { for (ActHiExecution history : historys) {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append("update ") sql.append("update ")
.append(history.getForm_type()) .append(baseFromCollect.contains(history.getForm_type())?history.getForm_type():"pm_form_data")
.append(" set status = ") .append(" set status = ")
.append("'"+StatusEnum.FORM_STATUS.code("完成")+"'") .append("'"+StatusEnum.FORM_STATUS.code("完成")+"'")
.append(" where id = ") .append(" where id = ")

View File

@@ -97,30 +97,38 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12">
<el-form-item label="是否基础表" prop="has_child">
<el-radio-group v-model="form.is_base" style="width: 140px">
<el-radio :label='true'>是</el-radio>
<el-radio :label='false'>否</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="业务表id映射" prop="biz_id"> <el-form-item label="业务表id映射" prop="biz_id">
<el-input v-model="form.biz_id" style="width: 150px;"/> <el-input v-model="form.biz_id" style="width: 150px;"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="业务表编码映射" prop="biz_code"> <el-form-item label="业务表编码映射" prop="biz_code">
<el-input v-model="form.biz_code" style="width: 150px;"/> <el-input v-model="form.biz_code" style="width: 150px;"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="业务表时间映射" prop="bus_data"> <el-form-item label="业务表时间映射" prop="bus_data">
<el-input v-model="form.biz_date" style="width: 150px;"/> <el-input v-model="form.biz_date" style="width: 150px;"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="业务表状态映射" prop="biz_status"> <el-form-item label="业务表状态映射" prop="biz_status">
<el-input v-model="form.biz_status" style="width: 150px;"/> <el-input v-model="form.biz_status" style="width: 150px;"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="业务表单据类型映射" prop="bus_data"> <el-form-item label="业务表单据类型映射" prop="bus_data">
<el-input v-model="form.biz_form_type" style="width: 150px;"/> <el-input v-model="form.biz_form_type" style="width: 150px;"/>
@@ -177,6 +185,7 @@
<el-table-column prop="form_desc" show-overflow-tooltip width="120" label="描述"/> <el-table-column prop="form_desc" show-overflow-tooltip width="120" label="描述"/>
<el-table-column prop="convert_json" show-overflow-tooltip width="120" label="数据映射字段"/> <el-table-column prop="convert_json" show-overflow-tooltip width="120" label="数据映射字段"/>
<el-table-column prop="has_child" show-overflow-tooltip width="120" :formatter="booleanFormat" label="是否关联子表"/> <el-table-column prop="has_child" show-overflow-tooltip width="120" :formatter="booleanFormat" label="是否关联子表"/>
<el-table-column prop="is_base" show-overflow-tooltip width="120" :formatter="booleanFormat" label="属于基础表"/>
<!-- <el-table-column prop="parent_id" show-overflow-tooltip width="120" label="父表id"/>--> <!-- <el-table-column prop="parent_id" show-overflow-tooltip width="120" label="父表id"/>-->
<el-table-column prop="biz_id" show-overflow-tooltip width="120" label="业务单据id映射"/> <el-table-column prop="biz_id" show-overflow-tooltip width="120" label="业务单据id映射"/>
<el-table-column prop="biz_code" show-overflow-tooltip width="130" label="业务单据code映射"/> <el-table-column prop="biz_code" show-overflow-tooltip width="130" label="业务单据code映射"/>
@@ -241,6 +250,7 @@ const defaultForm = {
pcsn: null, pcsn: null,
form_param: null, form_param: null,
has_child: false, has_child: false,
is_base: false,
parent_id: null, parent_id: null,
convert_json: null, convert_json: null,
bus_data: null bus_data: null
@@ -252,7 +262,7 @@ export default {
mixins: [ presenter(), header(), form(defaultForm), crud() ], mixins: [ presenter(), header(), form(defaultForm), crud() ],
cruds() { cruds() {
return CRUD({ return CRUD({
title: '基础类别', title: '自定义表单',
url: 'api/bmFormStruc', url: 'api/bmFormStruc',
idField: 'id', idField: 'id',
sort: 'id,desc', sort: 'id,desc',
@@ -300,12 +310,8 @@ export default {
resolve(tree.children) resolve(tree.children)
}, 100) }, 100)
}, },
booleanFormat(row, index) { booleanFormat(row, column, cellValue) {
if (row.has_child) { return cellValue ? '是' : '否';
return '是'
} else {
return '否'
}
}, },
jsonFormat(row, index) { jsonFormat(row, index) {
if (row.form_param != null) { if (row.form_param != null) {

View File

@@ -240,7 +240,7 @@ export default {
mixins: [presenter(), header(), form(defaultForm), crud()], mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() { cruds() {
return CRUD({ return CRUD({
title: '基础类别', title: '安全超期预警',
url: 'api/almEarlyMsg', url: 'api/almEarlyMsg',
idField: 'id', idField: 'id',
sort: 'id,desc', sort: 'id,desc',

View File

@@ -230,7 +230,7 @@ export default {
mixins: [presenter(), header(), form(defaultForm), crud()], mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() { cruds() {
return CRUD({ return CRUD({
title: '基础类别', title: '安全库存预警',
url: '/api/almEarlyInv', url: '/api/almEarlyInv',
idField: 'id', idField: 'id',
sort: 'id,desc', sort: 'id,desc',

View File

@@ -46,7 +46,7 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item v-if="formData.category === 'class'" label="配置参数" prop="auxParam"> <el-form-item label="配置参数" prop="auxParam">
<el-input v-model="formData.auxParam"></el-input> <el-input v-model="formData.auxParam"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="描述" prop="documentation"> <el-form-item label="描述" prop="documentation">
@@ -114,9 +114,6 @@ export default {
passNode: [ passNode: [
{required: true, message: '自动执行不能为空', trigger: 'blur'} {required: true, message: '自动执行不能为空', trigger: 'blur'}
], ],
auxParam: [
{required: true, message: 'auxParam不能为空', trigger: 'blur'}
]
} }
} }
}, },

View File

@@ -69,7 +69,7 @@ export default {
mixins: [ presenter(), header(), form(defaultForm), crud() ], mixins: [ presenter(), header(), form(defaultForm), crud() ],
cruds() { cruds() {
return CRUD({ return CRUD({
title: '基础类别', title: '组盘配置',
url: 'api/bmFormStruc', url: 'api/bmFormStruc',
idField: 'id', idField: 'id',
sort: 'id,desc', sort: 'id,desc',

View File

@@ -183,7 +183,7 @@ export default {
mixins: [presenter(), header(), form(defaultForm), crud()], mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() { cruds() {
return CRUD({ return CRUD({
title: '基础类别', title: '表单数据',
url: 'api/pmFormData', url: 'api/pmFormData',
idField: 'id', idField: 'id',
sort: 'id,desc', sort: 'id,desc',

View File

@@ -202,7 +202,7 @@ export default {
mixins: [presenter(), header(), form(defaultForm), crud()], mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() { cruds() {
return CRUD({ return CRUD({
title: '基础类别', title: '拣选',
url: 'api/pmFormData', url: 'api/pmFormData',
idField: 'id', idField: 'id',
sort: 'id,desc', sort: 'id,desc',