rev:入库单数据修改

This commit is contained in:
zhangzq
2024-05-21 13:54:55 +08:00
parent c0abb88e80
commit b3fee56bb9
23 changed files with 267 additions and 171 deletions

View File

@@ -7,6 +7,7 @@ import org.nl.wms.flow_manage.flow.framework.entity.ExecutionDto;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.function.Consumer; import java.util.function.Consumer;
/* /*
@@ -29,24 +30,34 @@ public class FlowStartEvent extends PublishEvent {
return model_key; return model_key;
} }
public FlowStartEvent build(String form_type, String form_id, JSONObject data){ public FlowStartEvent build(String form_type, String form_id,String source_form_type,String source_form_id, JSONObject data){
if (dto == null){ if (dto == null){
dto = ExecutionDto.builder().form_id(form_id).form_type(form_type).t(data).build(); dto = ExecutionDto.builder()
.form_id(form_id)
.form_type(form_type)
.source_form_type(source_form_type)
.source_form_id(source_form_id)
.t(data).build();
} }
return this; return this;
} }
public FlowStartEvent build(String form_type,List<String> ids, List<JSONObject> datas){ public FlowStartEvent build(String form_type, List<Map> datas){
if (dto == null){ if (dto == null){
throw new BadRequestException("主数据参数未构建"); throw new BadRequestException("主数据参数未构建");
} }
List<ExecutionDto> item =new ArrayList(); List<ExecutionDto> item =new ArrayList();
for (int i = 0; i < ids.size(); i++) { for (Map data : datas) {
String id = ids.get(i); String form_id = (String)data.get("form_id");
JSONObject data = datas.get(i); String source_form_id = (String)data.get("source_form_id");
ExecutionDto build = ExecutionDto.builder().form_id(id).form_type(form_type).t(data).build(); String source_form_type = (String)data.get("source_form_type");
JSONObject data_json = (JSONObject)data.get("t");
ExecutionDto build = ExecutionDto.builder()
.form_id(form_id)
.form_type(form_type).source_form_id(source_form_id).source_form_type(source_form_type).t(data_json).build();
item.add(build); item.add(build);
} }
dto.setItem(item); dto.setItem(item);
return this; return this;
} }

View File

@@ -74,9 +74,9 @@ public class ExecutionController {
return new ResponseEntity<>(flowOperationService.startFormFlow(startProcessInstanceVo), HttpStatus.OK); return new ResponseEntity<>(flowOperationService.startFormFlow(startProcessInstanceVo), HttpStatus.OK);
} }
@GetMapping(value = "/confirm") @GetMapping(value = "/confirm/{proc_inst_id}")
public ResponseEntity<Object> flowConfirm(String inst_id) { public ResponseEntity<Object> flowConfirm(@PathVariable String proc_inst_id) {
return new ResponseEntity<>(flowOperationService.flowConfirm(inst_id,null), HttpStatus.OK); return new ResponseEntity<>(flowOperationService.flowConfirm(proc_inst_id,null), HttpStatus.OK);
} }
@GetMapping(value = "/queryByParentId/{id}") @GetMapping(value = "/queryByParentId/{id}")

View File

@@ -38,6 +38,7 @@ public abstract class FlowNodeActivityBehavior<T> {
public final void activity(ExecutionEntity<T> entity) { public final void activity(ExecutionEntity<T> entity) {
try { try {
//当前节点 //当前节点
log.info("流程:{},开始流程数据:{}", entity.getActivityName(),JSONObject.toJSONString(entity.getT()));
if (StringUtils.isNotEmpty(entity.getProc_inst_id())){ if (StringUtils.isNotEmpty(entity.getProc_inst_id())){
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())
@@ -47,14 +48,15 @@ public abstract class FlowNodeActivityBehavior<T> {
.set("form_id", entity.getForm_id()) .set("form_id", entity.getForm_id())
.set("remark", "") .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", entity.getT().toString())
.set("update_time", DateUtil.now())); .set("update_time", DateUtil.now()));
} }
this.execute(entity); this.execute(entity);
log.info("流程:{},结束流程数据:{}", entity.getActivityName(), JSONObject.toJSONString(entity.getT()));
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("status", StatusEnum.FLOW_STATUS.code("节点完成")) .set("status", StatusEnum.FLOW_STATUS.code("节点完成"))
.set("form_data", JSONObject.toJSON(entity.getT()).toString()) .set("form_data", entity.getT().toString())
.set("form_type",entity.getForm_type()) .set("form_type",entity.getForm_type())
.set("update_time", DateUtil.now())); .set("update_time", DateUtil.now()));
this.leaveActivity(entity); this.leaveActivity(entity);
@@ -78,7 +80,7 @@ public abstract class FlowNodeActivityBehavior<T> {
historyEntity.setActivity_name(entity.getActivityName()); historyEntity.setActivity_name(entity.getActivityName());
historyEntity.setForm_type(entity.getForm_type()); historyEntity.setForm_type(entity.getForm_type());
historyEntity.setForm_id(entity.getForm_id()); historyEntity.setForm_id(entity.getForm_id());
historyEntity.setForm_data((JSONObject) JSONObject.toJSON(entity.getT())); historyEntity.setForm_data((JSONObject) entity.getT());
historyEntity.setUpdate_time(DateUtil.now()); historyEntity.setUpdate_time(DateUtil.now());
history.save(historyEntity); history.save(historyEntity);
this.leave(entity); this.leave(entity);

View File

@@ -1,6 +1,7 @@
package org.nl.wms.flow_manage.flow.framework.engine.behavior.impl; 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.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -75,33 +76,38 @@ public class FormActivityBehavior extends FlowNodeActivityBehavior<JSONObject> {
if (typeHandler==null){ if (typeHandler==null){
throw new BadRequestException("【flow】当前节点处理类型未定义"); throw new BadRequestException("【flow】当前节点处理类型未定义");
} }
JSONObject handler = typeHandler.handler(currentNode.getSkipExpression(), entity.getT(), targetStruc); JSONObject handler = typeHandler.handler(currentNode.getSkipExpression(), entity.getT() , targetStruc);
//该参数里包含三部分:主数据基础字段,组数据自定义及明细, //该参数里包含三部分:主数据基础字段,组数据自定义及明细,
//明细:基础字段,组数据自定义及参数: //明细:基础字段,组数据自定义及参数:
//TODO:id,code等非映射字段后续可以通过SpringEL表达式生成 //TODO:id,code等非映射字段后续可以通过SpringEL表达式生成
handler.put("id",IdUtil.getStringId()); JSONObject mst_json = handler.getJSONObject("t");
handler.put("create_time",DateUtil.now()); mst_json.put("id",IdUtil.getStringId());
handler.put("create_id",SecurityUtils.getCurrentUserId()); mst_json.put("create_time",DateUtil.now());
handler.put("status",StatusEnum.FORM_STATUS.code("生成")); mst_json.put("create_id",SecurityUtils.getCurrentUserId());
handler.put("code",CodeUtil.getNewCode("IO_CODE")); mst_json.put("status",StatusEnum.FORM_STATUS.code("生成"));
StIvtIostorinvIn mst = handler.toJavaObject(StIvtIostorinvIn.class); mst_json.put("code",CodeUtil.getNewCode("IO_CODE"));
StIvtIostorinvIn mst = mst_json.toJavaObject(StIvtIostorinvIn.class);
handler.put("form_id",mst.getId());
JSONArray itemArr = handler.getJSONArray("item"); Object item = mst_json.remove("item");
if(itemArr !=null){ if(item !=null){
JSONArray itemArr = (JSONArray) item;
for (int i = 0; i < itemArr.size(); i++) { for (int i = 0; i < itemArr.size(); i++) {
JSONObject dtl = itemArr.getJSONObject(i); JSONObject dtl = itemArr.getJSONObject(i);
dtl.put("inv_id",mst.getId()); JSONObject dtl_json = dtl.getJSONObject("t");
dtl.put("status",StatusEnum.FORM_STATUS.code("生成")); dtl_json.put("inv_id",mst.getId());
dtl.put("id",IdUtil.getStringId()); dtl_json.put("status",StatusEnum.FORM_STATUS.code("生成"));
StIvtIostorinvdtlIn iostorinvdtl= dtl.toJavaObject(StIvtIostorinvdtlIn.class); dtl_json.put("id",IdUtil.getStringId());
StIvtIostorinvdtlIn iostorinvdtl= dtl_json.toJavaObject(StIvtIostorinvdtlIn.class);
iostorinvdtlService.save(iostorinvdtl); iostorinvdtlService.save(iostorinvdtl);
dtl.put("form_id",iostorinvdtl.getId());
} }
} }
iostorinvService.save(mst); iostorinvService.save(mst);
entity.setT(handler); entity.setT(handler);
entity.setForm_id(mst.getId()); entity.setForm_id(entity.getForm_id());
entity.setForm_type(currentNode.getForm_type()); entity.setForm_type(entity.getForm_type());
} }
} }
} }

View File

@@ -21,18 +21,19 @@ import org.springframework.util.CollectionUtils;
public class ServerTaskActivityBehavior extends FlowNodeActivityBehavior<JSONObject> { public class ServerTaskActivityBehavior extends FlowNodeActivityBehavior<JSONObject> {
@Override @Override
public void execute(ExecutionEntity<JSONObject> entity) { public void execute(ExecutionEntity<JSONObject> entity) {
System.out.println(entity.getForm_id()); String form_id = entity.getForm_id();
String form_type = entity.getForm_type();
FlowElement element = entity.getCurrentFlowElement(); FlowElement element = entity.getCurrentFlowElement();
ServerTask currentNode = (ServerTask) element; ServerTask currentNode = (ServerTask) element;
if (!CollectionUtils.isEmpty(currentNode.getSkipExpression())) { if (!CollectionUtils.isEmpty(currentNode.getSkipExpression())) {
TypeHandler<ExecutionDto, ExecutionEntity<JSONObject>> 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】当前节点处理类型未定义");
} }
ExecutionDto result = typeHandler.handler(currentNode.getSkipExpression(), entity, null); JSONObject handler = typeHandler.handler(currentNode.getSkipExpression(), entity.getT(), null);
entity.setT(result.getT()); entity.setT(handler);
entity.setForm_id(result.getForm_id()); entity.setForm_id(form_id);
entity.setForm_type(currentNode.getForm_type()); entity.setForm_type(form_type);
} }
} }
} }

View File

@@ -18,6 +18,7 @@ import java.util.List;
*/ */
@AllArgsConstructor @AllArgsConstructor
@Builder @Builder
@Data
public class ExecutionDto { public class ExecutionDto {
/** /**
* 表单id * 表单id
@@ -27,6 +28,14 @@ public class ExecutionDto {
* 单据类型 * 单据类型
*/ */
private String form_type; private String form_type;
/**
* 源单id
*/
private String source_form_id;
/**
* 源单类型
*/
private String source_form_type;
/** /**
* 主数据 * 主数据
*/ */
@@ -36,36 +45,4 @@ public class ExecutionDto {
*/ */
private List<ExecutionDto> item; private List<ExecutionDto> item;
/**
* 获取数据时:合并主表明细表
* @return
*/
public JSONObject getT() {
t.put("item",item);
return t;
}
public void setT(JSONObject t) {
this.t = t;
}
public void setItem(List<ExecutionDto> item) {
this.item = item;
}
public String getForm_id() {
return form_id;
}
public void setForm_id(String form_id) {
this.form_id = form_id;
}
public String getForm_type() {
return form_type;
}
public void setForm_type(String form_type) {
this.form_type = form_type;
}
} }

View File

@@ -15,29 +15,45 @@ import java.util.function.Consumer;
*/ */
@Getter @Getter
public class ExecutionEntity<T> implements Cloneable{ public class ExecutionEntity<T> implements Cloneable{
@Override
public Object clone() {
try {
return super.clone();
}catch (Exception ex){
throw new BadRequestException(ex.getMessage());
}
}
/**
* 当前流程节点
*/
protected FlowElement currentFlowElement; protected FlowElement currentFlowElement;
//用于获取当前流程实例对象 /**
* 对应流程实例id
*/
protected String proc_inst_id; protected String proc_inst_id;
//父流程实例id /**
* 父流程id
*/
protected String parent_id; protected String parent_id;
//当前流程id=currentFlowElement.getId() /**
* 开始流程id
*/
protected String startActivityId; protected String startActivityId;
/**
* 当前流程id
*/
protected String activityId; protected String activityId;
/**
* 流程节点名称
*/
protected String activityName; protected String activityName;
/**
* 流程部署id
*/
protected String deploymentId; protected String deploymentId;
/**
* 源单类型
*/
protected String form_type; protected String form_type;
protected BmFormStruc form_struc; /**
* 源单id
*/
protected String form_id; protected String form_id;
protected BmFormStruc form_struc;
//回调执行 //回调执行
protected Consumer callback = null; protected Consumer callback = null;
@@ -84,4 +100,15 @@ public class ExecutionEntity<T> implements Cloneable{
public void setCallback(Consumer callback) { public void setCallback(Consumer callback) {
this.callback = callback; this.callback = callback;
} }
@Override
public Object clone() {
try {
return super.clone();
}catch (Exception ex){
throw new BadRequestException(ex.getMessage());
}
}
} }

View File

@@ -31,9 +31,12 @@ public class MappingHandler extends TypeHandler<JSONObject, JSONObject> {
@Override @Override
public JSONObject handler(List<String> param, JSONObject data, BmFormStruc form_struc) { public JSONObject handler(List<String> param, JSONObject data, BmFormStruc form_struc) {
//数据平铺 //数据平铺
JSONObject forms = data.getJSONObject("form_data"); JSONObject sourceFormData = new JSONObject(data.getJSONObject("t"));
String souceFromId = data.getString("form_id");
String souceFromType = data.getString("form_type");
JSONObject forms = sourceFormData.getJSONObject("form_data");
if (forms!=null){ if (forms!=null){
data.putAll(forms); sourceFormData.putAll(forms);
} }
//数据字段列表 //数据字段列表
List<String> fields = ListOf.of(form_struc.getBiz_code() List<String> fields = ListOf.of(form_struc.getBiz_code()
@@ -45,13 +48,13 @@ public class MappingHandler extends TypeHandler<JSONObject, JSONObject> {
, form_struc.getVehicle_code() , form_struc.getVehicle_code()
, form_struc.getQty()); , form_struc.getQty());
//查询目标表字段 //查询目标表字段
JSONObject returnObj = new JSONObject(); JSONObject t = new JSONObject();
//基础字段映射:如果只有一个就不迭代 //基础字段映射:如果只有一个就不迭代
JSONObject mapping = JSONObject.parseObject(param.size()==1?param.get(0):param.remove(0)); JSONObject mapping = JSONObject.parseObject(param.size()==1?param.get(0):param.remove(0));
for (String field : fields) { for (String field : fields) {
if (field!=null){ if (field!=null){
String value = data.getString(mapping.getString(field)); String value = sourceFormData.getString(mapping.getString(field));
returnObj.put(field,value); t.put(field,value);
} }
} }
//查询表单配置表获取自定义json:自定义字段参数获取 //查询表单配置表获取自定义json:自定义字段参数获取
@@ -61,14 +64,14 @@ public class MappingHandler extends TypeHandler<JSONObject, JSONObject> {
for (String item : form_param.keySet()) { for (String item : form_param.keySet()) {
String mappingConfig = mapping.getString(item); String mappingConfig = mapping.getString(item);
if (StringUtils.isNotEmpty(mappingConfig)){ if (StringUtils.isNotEmpty(mappingConfig)){
String value = data.getString(mappingConfig); String value = sourceFormData.getString(mappingConfig);
form_data.put(item,value); form_data.put(item,value);
} }
} }
returnObj.put("form_data",form_data); t.put("form_data",form_data);
} }
JSONArray item = data.getJSONArray("item"); JSONArray item = data.getJSONArray("item");
BmFormStruc item_struc = iBmFormStrucService.getOne(new QueryWrapper<BmFormStruc>().eq("parent_id",form_struc.getForm_type())); BmFormStruc item_struc = iBmFormStrucService.getOne(new QueryWrapper<BmFormStruc>().eq("parent_id",form_struc.getId()));
if (item!=null){ if (item!=null){
//暂定:强制校验 //暂定:强制校验
if (item_struc == null){ if (item_struc == null){
@@ -78,8 +81,14 @@ public class MappingHandler extends TypeHandler<JSONObject, JSONObject> {
for (int i = 0; i < item.size(); i++) { for (int i = 0; i < item.size(); i++) {
itemList.add(this.handler(param, item.getJSONObject(i), item_struc)); itemList.add(this.handler(param, item.getJSONObject(i), item_struc));
} }
returnObj.put("item",itemList); t.put("item",itemList);
} }
return returnObj; JSONObject resultT = new JSONObject();
resultT.put("form_type",form_struc.getForm_type());
resultT.put("form_id","");
resultT.put("source_form_type",souceFromType);
resultT.put("source_form_id",souceFromId);
resultT.put("t",t);
return resultT;
} }
} }

View File

@@ -17,6 +17,8 @@ public class ExecutionQuery extends BaseQuery<ActRuExecution> {
private String search; private String search;
private String proc_inst_id;
@Override @Override
public void paramMapping() { public void paramMapping() {
super.doP.put("name", QParam.builder().k(new String[]{"name"}).type(QueryTEnum.LK).build()); super.doP.put("name", QParam.builder().k(new String[]{"name"}).type(QueryTEnum.LK).build());

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.nl.common.TableDataInfo; import org.nl.common.TableDataInfo;
import org.nl.common.domain.entity.PageQuery; import org.nl.common.domain.entity.PageQuery;
@@ -37,9 +38,9 @@ public class ActRuExecutionServiceImpl extends ServiceImpl<ActRuExecutionMapper,
@Override @Override
public Object getAll(ExecutionQuery query, PageQuery page) { public Object getAll(ExecutionQuery query, PageQuery page) {
//判断是否存在子实例 //判断是否存在子实例
LambdaQueryWrapper<ActRuExecution> lqw = new LambdaQueryWrapper<>(); QueryWrapper<ActRuExecution> build = (QueryWrapper)query.build();
lqw.isNull(ActRuExecution::getParent_id); build.isNull("parent_id");
Page<ActRuExecution> executionPage = this.page(page.build(), lqw); Page<ActRuExecution> executionPage = this.page(page.build(), build);
List<ActRuExecution> records = executionPage.getRecords(); List<ActRuExecution> records = executionPage.getRecords();
this.findChildren(records); this.findChildren(records);
return TableDataInfo.build(executionPage); return TableDataInfo.build(executionPage);

View File

@@ -58,10 +58,10 @@ public class FlowOperationServiceImpl implements IFlowOperationService {
//创建流程参数ExecutionEntity执行流程 //创建流程参数ExecutionEntity执行流程
ExecutionEntity entity = new ExecutionEntity(); ExecutionEntity entity = new ExecutionEntity();
entity.setCurrentFlowElement(bpmnModel.getStartEvent()); entity.setCurrentFlowElement(bpmnModel.getStartEvent());
entity.setT(dto.getT()); entity.setT(JSONObject.toJSON(dto));
entity.setCallback(callback); entity.setCallback(callback);
entity.setForm_type(dto.getForm_type()); entity.setForm_type(dto.getSource_form_type());
entity.setForm_id(dto.getForm_id()); entity.setForm_id(dto.getSource_form_id());
entity.setStartActivityId(entity.getActivityId()); entity.setStartActivityId(entity.getActivityId());
entity.setDeploymentId(deployment.getDeployment_id()); entity.setDeploymentId(deployment.getDeployment_id());
commandExecutor.execute(new StartInstanceCmd(),entity); commandExecutor.execute(new StartInstanceCmd(),entity);

View File

@@ -11,6 +11,7 @@ import org.nl.common.domain.entity.PageQuery;
import org.nl.common.publish.BussEventMulticaster; import org.nl.common.publish.BussEventMulticaster;
import org.nl.common.utils.CodeUtil; import org.nl.common.utils.CodeUtil;
import org.nl.common.utils.IdUtil; import org.nl.common.utils.IdUtil;
import org.nl.common.utils.MapOf;
import org.nl.common.utils.SecurityUtils; import org.nl.common.utils.SecurityUtils;
import org.nl.wms.base_manage.vehicle.vehicleMater.service.IMdPbVehicleMaterService; import org.nl.wms.base_manage.vehicle.vehicleMater.service.IMdPbVehicleMaterService;
import org.nl.wms.base_manage.vehicle.vehicleMater.service.dao.MdPbVehicleMater; import org.nl.wms.base_manage.vehicle.vehicleMater.service.dao.MdPbVehicleMater;
@@ -84,7 +85,7 @@ public class MdGruopDickServiceImpl extends ServiceImpl<MdGruopDickMapper, MdGru
List<MdGruopDtl> items = new ArrayList<>(); List<MdGruopDtl> items = new ArrayList<>();
List<MdPbVehicleMater> vehicleMaters = new ArrayList<>(); List<MdPbVehicleMater> vehicleMaters = new ArrayList<>();
List<JSONObject> dtlJson = new ArrayList<>(); List<Map> dtlJson = new ArrayList<>();
if (!CollectionUtils.isEmpty(forms)){ if (!CollectionUtils.isEmpty(forms)){
for (int i = 0; i < tableData.size(); i++) { for (int i = 0; i < tableData.size(); i++) {
Map item = tableData.get(i); Map item = tableData.get(i);
@@ -97,7 +98,10 @@ public class MdGruopDickServiceImpl extends ServiceImpl<MdGruopDickMapper, MdGru
MdPbVehicleMater vehicleMater = item_json.toJavaObject(MdPbVehicleMater.class); MdPbVehicleMater vehicleMater = item_json.toJavaObject(MdPbVehicleMater.class);
items.add(mdGruopDtl); items.add(mdGruopDtl);
vehicleMaters.add(vehicleMater); vehicleMaters.add(vehicleMater);
dtlJson.add(item_json); dtlJson.add(MapOf.of("form_id",mdGruopDtl.getId()
,"t",item_json
,"source_form_type",mdGruopDtl.getSource_form_type()
,"source_form_id",mdGruopDtl.getSource_form_id()));
} }
} }
this.save(mdGroupMst); this.save(mdGroupMst);
@@ -107,8 +111,8 @@ public class MdGruopDickServiceImpl extends ServiceImpl<MdGruopDickMapper, MdGru
BussEventMulticaster.Publish(new FlowStartEvent("md_group_dick", (Consumer<String>) proc_inst_id -> { BussEventMulticaster.Publish(new FlowStartEvent("md_group_dick", (Consumer<String>) proc_inst_id -> {
self.update(new UpdateWrapper<MdGruopDick>() self.update(new UpdateWrapper<MdGruopDick>()
.set("proc_inst_id",proc_inst_id).eq("id",mdGroupMst.getId())); }) .set("proc_inst_id",proc_inst_id).eq("id",mdGroupMst.getId())); })
.build("md_group_dick",mdGroupMst.getId(),forms) .build("md_group_dick",mdGroupMst.getId(),mdGroupMst.getSource_form_type(),mdGroupMst.getSource_form_id(),forms)
.build("md_group_dtl",items.stream().map(MdGruopDtl::getId).collect(Collectors.toList()), dtlJson) .build("md_group_dtl",dtlJson)
,true); ,true);
} }

View File

@@ -191,15 +191,17 @@ public class PmFormDataServiceImpl extends ServiceImpl<PmFormDataMapper, PmFormD
for (String field : fields) { for (String field : fields) {
if (StringUtils.isNotEmpty(field)) { if (StringUtils.isNotEmpty(field)) {
JSONObject itemMappingConfig = fieldMapping.get(field); JSONObject itemMappingConfig = fieldMapping.get(field);
if (itemMappingConfig == null) { if (itemMappingConfig != null) {
throw new BadRequestException(String.format(" 当前表单没有配置字段:%s 映射", new String[]{field})); if (StringUtils.isNotEmpty(itemMappingConfig.getString("skipExpression"))) {
} //el表达式解析
if (StringUtils.isNotEmpty(itemMappingConfig.getString("skipExpression"))) { SpelMap.put(field, itemMappingConfig.getString("skipExpression"));
//el表达式解析 } else {
SpelMap.put(field, itemMappingConfig.getString("skipExpression")); data.put(field, sourceData.getString(itemMappingConfig.getString("mapping_field")));
} else { }
data.put(field, sourceData.getString(itemMappingConfig.getString("mapping_field")));
} }
// else {
// throw new BadRequestException(String.format(" 当前表单没有配置字段:%s 映射", new String[]{field}));
// }
} }
} }
if (!CollectionUtils.isEmpty(SpelMap)) { if (!CollectionUtils.isEmpty(SpelMap)) {

View File

@@ -71,7 +71,7 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="父表类型" prop="class_name"> <el-form-item label="父表类型" prop="parent_id">
<el-select <el-select
v-model="form.parent_id" v-model="form.parent_id"
placeholder="父表类型" placeholder="父表类型"
@@ -81,7 +81,7 @@
<el-option <el-option
v-for="item in form_types" v-for="item in form_types"
:key="item.id" :key="item.id"
:label="item.label" :label="item.lable"
:value="item.id" :value="item.id"
/> />
</el-select> </el-select>
@@ -98,13 +98,13 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="业务表id映射" prop="bus_id"> <el-form-item label="业务表id映射" prop="biz_id">
<el-input v-model="form.bus_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-col :span="12"> <el-col :span="12">
<el-form-item label="业务表编码映射" prop="bus_code"> <el-form-item label="业务表编码映射" prop="biz_code">
<el-input v-model="form.bus_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>
@@ -115,8 +115,8 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="业务表状态映射" prop="bus_status"> <el-form-item label="业务表状态映射" prop="biz_status">
<el-input v-model="form.bus_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>
@@ -171,10 +171,10 @@
<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="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="bus_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="bus_code" show-overflow-tooltip width="130" label="业务单据code映射"/> <el-table-column prop="biz_code" show-overflow-tooltip width="130" label="业务单据code映射"/>
<el-table-column prop="bus_date" show-overflow-tooltip width="130" label="业务单据时间映射"/> <el-table-column prop="biz_date" show-overflow-tooltip width="130" label="业务单据时间映射"/>
<el-table-column prop="status" show-overflow-tooltip width="130" label="业务单据状态映射"/> <el-table-column prop="biz_status" show-overflow-tooltip width="130" label="业务单据状态映射"/>
<el-table-column prop="material_id" show-overflow-tooltip width="120" label="物料id映射"/> <el-table-column prop="material_id" show-overflow-tooltip width="120" label="物料id映射"/>
<el-table-column prop="qty" show-overflow-tooltip width="120" label="物料数量映射"/> <el-table-column prop="qty" show-overflow-tooltip width="120" label="物料数量映射"/>
<el-table-column prop="pcsn" show-overflow-tooltip width="120" label="物料批次映射"/> <el-table-column prop="pcsn" show-overflow-tooltip width="120" label="物料批次映射"/>
@@ -223,10 +223,10 @@ const defaultForm = {
form_desc: null, form_desc: null,
create_time: null, create_time: null,
create_id: null, create_id: null,
bus_id: null, biz_id: null,
bus_code: null, biz_code: null,
bus_date: null, biz_date: null,
bus_status: null, biz_status: null,
material_id: null, material_id: null,
qty: null, qty: null,
pcsn: null, pcsn: null,

View File

@@ -89,12 +89,12 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="业务表id映射" prop="class_desc"> <el-form-item label="业务表id映射" prop="class_desc">
<el-input v-model="form.bus_id" style="width: 120px;" /> <el-input v-model="form.biz_id" style="width: 120px;" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="业务表编码映射" prop="class_desc"> <el-form-item label="业务表编码映射" prop="class_desc">
<el-input v-model="form.bus_code" style="width: 120px;" /> <el-input v-model="form.biz_code" style="width: 120px;" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@@ -106,7 +106,7 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="业务表状态映射" prop="class_desc"> <el-form-item label="业务表状态映射" prop="class_desc">
<el-input v-model="form.bus_status" style="width: 120px;" /> <el-input v-model="form.biz_status" style="width: 120px;" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@@ -153,9 +153,9 @@
<el-table-column prop="create_time" label="创建时间" min-width="150"/> <el-table-column prop="create_time" label="创建时间" min-width="150"/>
<el-table-column prop="has_child" :formatter="booleanFormat" label="是否关联子表" /> <el-table-column prop="has_child" :formatter="booleanFormat" label="是否关联子表" />
<el-table-column prop="parent_id" label="父表id" min-width="150"/> <el-table-column prop="parent_id" label="父表id" min-width="150"/>
<el-table-column prop="bus_id" label="业务单据id映射" min-width="150"/> <el-table-column prop="biz_id" label="业务单据id映射" min-width="150"/>
<el-table-column prop="bus_code" label="业务单据code映射" min-width="150"/> <el-table-column prop="biz_code" label="业务单据code映射" min-width="150"/>
<el-table-column prop="bus_date" label="业务单据时间映射" min-width="150"/> <el-table-column prop="biz_date" label="业务单据时间映射" min-width="150"/>
<el-table-column prop="status" label="业务单据状态映射" min-width="150"/> <el-table-column prop="status" label="业务单据状态映射" min-width="150"/>
<el-table-column prop="material_id" label="物料id映射" min-width="150"/> <el-table-column prop="material_id" label="物料id映射" min-width="150"/>
<el-table-column prop="qty" label="物料数量映射" min-width="150"/> <el-table-column prop="qty" label="物料数量映射" min-width="150"/>
@@ -204,10 +204,10 @@ const defaultForm = {
form_desc: null, form_desc: null,
create_time: null, create_time: null,
create_id: null, create_id: null,
bus_id: null, biz_id: null,
bus_code: null, biz_code: null,
bus_date: null, biz_date: null,
bus_status: null, biz_status: null,
material_id: null, material_id: null,
qty: null, qty: null,
pcsn: null, pcsn: null,

View File

@@ -94,12 +94,12 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="业务表id映射" prop="class_desc"> <el-form-item label="业务表id映射" prop="class_desc">
<el-input v-model="form.bus_id" style="width: 120px;" /> <el-input v-model="form.biz_id" style="width: 120px;" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="业务表编码映射" prop="class_desc"> <el-form-item label="业务表编码映射" prop="class_desc">
<el-input v-model="form.bus_code" style="width: 120px;" /> <el-input v-model="form.biz_code" style="width: 120px;" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@@ -111,7 +111,7 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="业务表状态映射" prop="class_desc"> <el-form-item label="业务表状态映射" prop="class_desc">
<el-input v-model="form.bus_status" style="width: 120px;" /> <el-input v-model="form.biz_status" style="width: 120px;" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@@ -158,9 +158,9 @@
<el-table-column prop="create_time" label="创建时间" min-width="150"/> <el-table-column prop="create_time" label="创建时间" min-width="150"/>
<el-table-column prop="has_child" :formatter="booleanFormat" label="是否关联子表" /> <el-table-column prop="has_child" :formatter="booleanFormat" label="是否关联子表" />
<el-table-column prop="parent_id" label="父表id" min-width="150"/> <el-table-column prop="parent_id" label="父表id" min-width="150"/>
<el-table-column prop="bus_id" label="业务单据id映射" /> <el-table-column prop="biz_id" label="业务单据id映射" />
<el-table-column prop="bus_code" label="业务单据code映射" /> <el-table-column prop="biz_code" label="业务单据code映射" />
<el-table-column prop="bus_date" label="业务单据时间映射" /> <el-table-column prop="biz_date" label="业务单据时间映射" />
<el-table-column prop="status" label="业务单据状态映射" /> <el-table-column prop="status" label="业务单据状态映射" />
<el-table-column prop="material_id" label="物料id映射" min-width="120"/> <el-table-column prop="material_id" label="物料id映射" min-width="120"/>
<el-table-column prop="qty" label="物料数量映射" min-width="120"/> <el-table-column prop="qty" label="物料数量映射" min-width="120"/>
@@ -209,10 +209,10 @@ const defaultForm = {
form_desc: null, form_desc: null,
create_time: null, create_time: null,
create_id: null, create_id: null,
bus_id: null, biz_id: null,
bus_code: null, biz_code: null,
bus_date: null, biz_date: null,
bus_status: null, biz_status: null,
material_id: null, material_id: null,
qty: null, qty: null,
pcsn: null, pcsn: null,

View File

@@ -178,10 +178,10 @@ const defaultForm = {
form_desc: null, form_desc: null,
create_time: null, create_time: null,
create_id: null, create_id: null,
bus_id: null, biz_id: null,
bus_code: null, biz_code: null,
bus_date: null, biz_date: null,
bus_status: null, biz_status: null,
material_id: null, material_id: null,
qty: null, qty: null,
pcsn: null, pcsn: null,

View File

@@ -75,6 +75,12 @@ export function changeActive(data) {
data data
}) })
} }
export function flowConfirm(inst_id) {
return request({
url: 'api/bpmnExecution/confirm/'+inst_id,
method: 'get',
})
}
export default { export default {
add, add,
@@ -86,5 +92,6 @@ export default {
publish, publish,
queryByParentId, queryByParentId,
getDeploymentById, getDeploymentById,
changeActive changeActive,
flowConfirm
} }

View File

@@ -11,6 +11,15 @@
prefix-icon="el-icon-search" prefix-icon="el-icon-search"
class="filter-item" class="filter-item"
/> />
<el-input
v-model="query.proc_inst_id"
clearable
style="width: 300px"
size="mini"
placeholder="输入实例id"
prefix-icon="el-icon-search"
class="filter-item"
/>
<rrOperation/> <rrOperation/>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'--> <!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission"/> <crudOperation :permission="permission"/>
@@ -35,10 +44,13 @@
<el-form-item label="实例状态" prop="status"> <el-form-item label="实例状态" prop="status">
<el-input v-model="form.status" style="width: 300px;"/> <el-input v-model="form.status" style="width: 300px;"/>
</el-form-item> </el-form-item>
<el-form-item label="业务类型" prop="form_type"> <el-form-item label="表单类型" prop="form_type">
<el-input v-model="form.form_type" style="width: 300px;"/> <el-input v-model="form.form_type" style="width: 300px;"/>
</el-form-item> </el-form-item>
<el-form-item label="业务数据" prop="form_data"> <el-form-item label="表单id" prop="form_type">
<el-input v-model="form.form_id" style="width: 300px;"/>
</el-form-item>
<el-form-item label="表单数据" prop="form_data">
<el-input type="textarea" v-model="form.form_data" style="width: 300px;"/> <el-input type="textarea" v-model="form.form_data" style="width: 300px;"/>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
@@ -90,9 +102,9 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="remark" show-overflow-tooltip show-tooltip-when-overflow label="备注"/> <el-table-column prop="remark" show-overflow-tooltip show-tooltip-when-overflow label="备注"/>
<el-table-column prop="form_id" show-overflow-tooltip show-tooltip-when-overflow width="130" label="业务主键"/> <el-table-column prop="form_type" show-overflow-tooltip show-tooltip-when-overflow width="130" label="表单类型"/>
<el-table-column prop="form_type" show-overflow-tooltip show-tooltip-when-overflow width="130" label="业务类型"/> <el-table-column prop="form_id" show-overflow-tooltip show-tooltip-when-overflow width="130" label="表单id"/>
<el-table-column prop="form_data" show-overflow-tooltip show-tooltip-when-overflow width="130" label="业务数据" :formatter="jsonFormat"/> <el-table-column prop="form_data" show-overflow-tooltip show-tooltip-when-overflow width="130" label="表单数据" :formatter="jsonFormat"/>
<el-table-column prop="create_id" label="创建人" width="135"/> <el-table-column prop="create_id" label="创建人" width="135"/>
<el-table-column prop="create_time" label="创建时间" width="135"/> <el-table-column prop="create_time" label="创建时间" width="135"/>
<el-table-column prop="update_time" label="修改时间" width="135"/> <el-table-column prop="update_time" label="修改时间" width="135"/>
@@ -100,7 +112,7 @@
v-permission="['admin','actDeModel:edit','actDeModel:del']" v-permission="['admin','actDeModel:edit','actDeModel:del']"
fixed="right" fixed="right"
label="操作" label="操作"
width="160px" width="210px"
align="center" align="center"
> >
<template slot-scope="scope"> <template slot-scope="scope">
@@ -109,6 +121,7 @@
:permission="permission" :permission="permission"
style="display: inline" style="display: inline"
/> />
<el-button slot="right" @click="flowConfirm(scope.row.proc_inst_id)" type="text" icon="el-icon-video-play" size="mini">触发</el-button>
<el-button slot="right" @click="viewClick(scope.row)" type="text" icon="el-icon-thumb" size="mini">预览</el-button> <el-button slot="right" @click="viewClick(scope.row)" type="text" icon="el-icon-thumb" size="mini">预览</el-button>
</template> </template>
</el-table-column> </el-table-column>
@@ -207,6 +220,11 @@ export default {
this.$refs.viewCurrentFlowDesigner.showLogicFlowDesigner(res.model_editor_json, row); this.$refs.viewCurrentFlowDesigner.showLogicFlowDesigner(res.model_editor_json, row);
}) })
}, },
flowConfirm(proc_inst_id) {
curdExecution.flowConfirm(proc_inst_id).then(res => {
crud.notify("操作成功", CRUD.NOTIFICATION_TYPE.SUCCESS)
})
},
load(tree, treeNode, resolve) { load(tree, treeNode, resolve) {
setTimeout(() => { setTimeout(() => {
resolve(tree.children) resolve(tree.children)

View File

@@ -195,7 +195,6 @@ const defaultForm = {
update_name: '', update_name: '',
update_time: '', update_time: '',
status: '', status: '',
tableData: [],
form_data: {} form_data: {}
} }
@@ -263,7 +262,6 @@ export default {
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO) this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
return true return true
} }
debugger
this.form.item = this.tableData this.form.item = this.tableData
}, },
deleteRow(index, rows) { deleteRow(index, rows) {
@@ -284,7 +282,29 @@ export default {
}) })
this.form.child_qty = this.tableData.length this.form.child_qty = this.tableData.length
}, },
tableDtlMaterial2(rows) { tableDtlMaterial2(data) {
debugger
let mst = data['t'];
let rows = data['item'];
this.form.source_form_type = mst.form_type
this.form.source_form_id = mst.id
let mst_form_data = mst.form_data;
this.cols.forEach(a=>{
let item = null
if (a.value in mst_form_data) {
item = mst_form_data[a.value];
}
// let keys = Object.keys(mst_form_data);
// for (let i = 0; i < keys.length; i++) {
// let key = keys[i];
// if (a.value == key) {
// item = mst_form_data[a.value];
// break
// }
// }
this.$set(this.form.form_data,a.value,item)
})
rows.forEach((row) => { rows.forEach((row) => {
const data = {} const data = {}
data.material_name = row.material_name data.material_name = row.material_name
@@ -327,7 +347,6 @@ export default {
}, },
unitFormatter(row) { unitFormatter(row) {
debugger
if (row.unit_id!=null){ if (row.unit_id!=null){
for (let i = 0; i < this.unitDict.length; i++) { for (let i = 0; i < this.unitDict.length; i++) {
let item = this.unitDict[i]; let item = this.unitDict[i];

View File

@@ -25,9 +25,9 @@
<el-table-column prop="create_time" label="创建时间" /> <el-table-column prop="create_time" label="创建时间" />
<el-table-column prop="has_child" :formatter="booleanFormat" label="是否关联子表" /> <el-table-column prop="has_child" :formatter="booleanFormat" label="是否关联子表" />
<el-table-column prop="parent_id" label="父表id" /> <el-table-column prop="parent_id" label="父表id" />
<el-table-column prop="bus_id" label="业务单据id映射" /> <el-table-column prop="biz_id" label="业务单据id映射" />
<el-table-column prop="bus_code" label="业务单据code映射" /> <el-table-column prop="biz_code" label="业务单据code映射" />
<el-table-column prop="bus_date" label="业务单据时间映射" /> <el-table-column prop="biz_date" label="业务单据时间映射" />
<el-table-column prop="status" label="业务单据状态映射" /> <el-table-column prop="status" label="业务单据状态映射" />
<el-table-column prop="material_id" label="物料id映射" /> <el-table-column prop="material_id" label="物料id映射" />
<el-table-column prop="qty" label="物料数量映射" /> <el-table-column prop="qty" label="物料数量映射" />
@@ -52,9 +52,9 @@ const defaultForm = {
create_time: null, create_time: null,
has_child: null, has_child: null,
parent_id: null, parent_id: null,
bus_id: null, biz_id: null,
bus_code: null, biz_code: null,
bus_date: null, biz_date: null,
status: null, status: null,
material_id: null, material_id: null,
qty: null, qty: null,

View File

@@ -139,14 +139,17 @@ import ViewDialog from '@/views/wms/md_manage/group_dick/ViewDialog'
const defaultForm = { const defaultForm = {
id: '', id: '',
code: '',
parent_vehicle_code: '', parent_vehicle_code: '',
child_qty: '0', status: '',
remark: '0', source_form_id: '',
source_form_type: '',
remark: '',
update_name: '', update_name: '',
update_time: '', update_time: '',
status: '', create_time: '',
tableData: [], proc_inst_id: '',
form_data: null form_data: {}
} }
export default { export default {
name: 'DeliveryOrder', name: 'DeliveryOrder',

View File

@@ -53,6 +53,7 @@
@select="crud.selectChange" @select="crud.selectChange"
@select-all="crud.selectAllChange" @select-all="crud.selectAllChange"
@selection-change="crud.selectionChangeHandler" @selection-change="crud.selectionChangeHandler"
@current-change="clickChange"
> >
<el-table-column type="selection" width="55"/> <el-table-column type="selection" width="55"/>
<el-table-column prop="code" label="单据编码" show-overflow-tooltip width="210px"> <el-table-column prop="code" label="单据编码" show-overflow-tooltip width="210px">
@@ -237,8 +238,11 @@ export default {
// 处理单选 // 处理单选
if (this.isSingle && this.tableRadio) { if (this.isSingle && this.tableRadio) {
this.dialogVisible = false this.dialogVisible = false
let subData = {}
this.$set(subData, 't', this.form)
this.$set(subData, 'item', this.tableRadio)
this.$emit('update:dialogShow', false) this.$emit('update:dialogShow', false)
this.$emit('setMaterValue', this.tableRadio) this.$emit('setMaterValue', subData)
return return
} }
this.rows = this.$refs.table.selection this.rows = this.$refs.table.selection
@@ -248,7 +252,10 @@ export default {
} }
this.crud.resetQuery(false) this.crud.resetQuery(false)
this.$emit('update:dialogShow', false) this.$emit('update:dialogShow', false)
this.$emit('setMaterValue', this.rows[0].children) let subData = {}
this.$set(subData, 't', this.rows[0])
this.$set(subData, 'item', this.rows[0].children)
this.$emit('setMaterValue', subData)
}, },
} }
} }