rev:自定义表单同步功能
This commit is contained in:
@@ -58,7 +58,7 @@ public class PageQuery implements Serializable {
|
|||||||
if (pageNum <= 0) {
|
if (pageNum <= 0) {
|
||||||
pageNum = DEFAULT_PAGE_NUM;
|
pageNum = DEFAULT_PAGE_NUM;
|
||||||
}
|
}
|
||||||
Page<T> page = new Page<>(pageNum, pageSize);
|
Page<T> page = new Page<>(pageNum+1, pageSize);
|
||||||
if (StringUtils.isNotBlank(sort)){
|
if (StringUtils.isNotBlank(sort)){
|
||||||
String[] split = sort.split(",");
|
String[] split = sort.split(",");
|
||||||
for (int i = 0; i < (split.length & ~1); i=i+2) {
|
for (int i = 0; i < (split.length & ~1); i=i+2) {
|
||||||
|
|||||||
@@ -29,10 +29,12 @@ public enum QueryTEnum {
|
|||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
LE((q, k, v) -> { q.le(k[0],v); }),
|
LE((q, k, v) -> { q.le(k[0],v); }),
|
||||||
|
GE((q, k, v) -> { q.ge(k[0],v); }),
|
||||||
BY((q, k, v) -> { q.orderByDesc(k[0],String.valueOf(v)); }),
|
BY((q, k, v) -> { q.orderByDesc(k[0],String.valueOf(v)); }),
|
||||||
NO((q, k, v) -> { q.isNull(k[0]); }),
|
NO((q, k, v) -> { q.isNull(k[0]); }),
|
||||||
NULL_OR_EMPTY((queryWrapper, k, v) -> { queryWrapper.nested(a->a.isNull(k[0]).or().eq(k[0],"")); }),
|
NULL_OR_EMPTY((queryWrapper, k, v) -> { queryWrapper.nested(a->a.isNull(k[0]).or().eq(k[0],"")); }),
|
||||||
LT((q, k, v) -> { q.lt(k[0],v); }),
|
LT((q, k, v) -> { q.lt(k[0],v); }),
|
||||||
|
GT((q, k, v) -> { q.gt(k[0],v); }),
|
||||||
OREQ((q, k, v) -> { if (StringUtils.isBlank((String)v)){ q.isNull(k[0]); }else { q.eq(k[0],v); } });
|
OREQ((q, k, v) -> { if (StringUtils.isBlank((String)v)){ q.isNull(k[0]); }else { q.eq(k[0],v); } });
|
||||||
|
|
||||||
private LConsumer<QueryWrapper<T>,String[], Object> doP;
|
private LConsumer<QueryWrapper<T>,String[], Object> doP;
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ package org.nl.common.utils;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author ZZQ
|
* @author ZZQ
|
||||||
@@ -19,4 +21,12 @@ public class ListOf implements Serializable {
|
|||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <K> Set ofSet(K... key){
|
||||||
|
Set list = new HashSet<>();
|
||||||
|
for (K k : key) {
|
||||||
|
list.add(k);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
package org.nl.common.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.expression.Expression;
|
||||||
|
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||||
|
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @author ZZQ
|
||||||
|
* @Date 2024/5/13 16:23
|
||||||
|
*/
|
||||||
|
public class SpelUtil {
|
||||||
|
//SpelExpressionParser方法是否线程安全?
|
||||||
|
private static SpelExpressionParser SPEL_PARSER = new SpelExpressionParser();
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
JSONObject source = new JSONObject();
|
||||||
|
JSONObject model = new JSONObject();
|
||||||
|
JSONObject FBillType = new JSONObject();
|
||||||
|
JSONArray FARRAY = new JSONArray();
|
||||||
|
|
||||||
|
source.put("FID","120222");
|
||||||
|
source.put("Model",model);
|
||||||
|
model.put("FDATA", DateUtil.now());
|
||||||
|
model.put("FCODE", IdUtil.getStringId());
|
||||||
|
model.put("FBillType", FBillType);
|
||||||
|
FBillType.put("FNumber",33066);
|
||||||
|
model.put("FARRAY", FARRAY);
|
||||||
|
FARRAY.add(MapOf.of("ARR1","子子子数字"));
|
||||||
|
FARRAY.add(MapOf.of("ARR2","子子子数字2"));
|
||||||
|
Map parse = SpelUtil.parse(source, MapOf.of("FID", "#M['FID']", "ARR1", "#M['Model']['FARRAY'][1]['ARR2']"));
|
||||||
|
System.out.println(parse.toString());
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
"FID": "120222",
|
||||||
|
"Model": {
|
||||||
|
"FBillType": {"FNumber": 33066 },
|
||||||
|
"FCODE": "1789927465523744768",
|
||||||
|
"FDATA": "2024-05-13 15:55:37",
|
||||||
|
"FARRAY": [
|
||||||
|
{"ARR1": "子子子数字"},
|
||||||
|
{"ARR2": "子子子数字2"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
* */
|
||||||
|
System.out.println(source.toJSONString());
|
||||||
|
// DemoJSON demoJSON = source.toJavaObject(DemoJSON.class);
|
||||||
|
//// SpelExpressionParser SPEL_PARSER = new SpelExpressionParser();
|
||||||
|
//// StandardEvaluationContext context = new StandardEvaluationContext();
|
||||||
|
//// context.setVariable("source",demoJSON);
|
||||||
|
//// //这种表达式只支持实体
|
||||||
|
//// Expression expression = SPEL_PARSER.parseExpression("T(String).valueOf(#source.model.FDATA)");
|
||||||
|
//// String value = expression.getValue(context, String.class);
|
||||||
|
// SpelExpressionParser SPEL_PARSER = new SpelExpressionParser();
|
||||||
|
// StandardEvaluationContext context = new StandardEvaluationContext();
|
||||||
|
// context.setVariable("k",source);
|
||||||
|
// //这种表达式只支持实体:map的映射都是通过['xxx']获取,对象的映射通过.xxx
|
||||||
|
// Expression expression = SPEL_PARSER.parseExpression("#M['Model']['FARRAY'][1]['ARR2']");
|
||||||
|
// String value = expression.getValue(context, String.class);
|
||||||
|
// System.out.println(value);
|
||||||
|
}
|
||||||
|
public static Map<String,String> parse(JSONObject sourceData,Map<String,String> fieldSkip){
|
||||||
|
StandardEvaluationContext context = new StandardEvaluationContext();
|
||||||
|
context.setVariable("M",sourceData);
|
||||||
|
Map<String, String> result = new HashMap<>();
|
||||||
|
for (String field : fieldSkip.keySet()) {
|
||||||
|
String skip = fieldSkip.get(field);
|
||||||
|
Expression expression = SpelUtil.SPEL_PARSER.parseExpression(skip);
|
||||||
|
String value = expression.getValue(context, String.class);
|
||||||
|
result.put(field,value);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Data
|
||||||
|
class DemoJSON{
|
||||||
|
private String FID;
|
||||||
|
private Model model;
|
||||||
|
}
|
||||||
|
@Data
|
||||||
|
class Model{
|
||||||
|
private String FDATA;
|
||||||
|
private String FCODE;
|
||||||
|
private FBillType FBillType;
|
||||||
|
}
|
||||||
|
@Data
|
||||||
|
class FBillType{
|
||||||
|
private Integer FNumber;
|
||||||
|
}
|
||||||
@@ -37,8 +37,8 @@ public class BmVehicleInfoController {
|
|||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询载具")
|
@Log("查询载具")
|
||||||
public ResponseEntity<Object> query(VehicleQuery whereJson, PageQuery page) {
|
public ResponseEntity<Object> query(VehicleQuery query, PageQuery page) {
|
||||||
return new ResponseEntity<>(TableDataInfo.build(vehicleInfoService.queryAll(whereJson, page)), HttpStatus.OK);
|
return new ResponseEntity<>(TableDataInfo.build(vehicleInfoService.page(page.build(), query.build())), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ import org.nl.wms.base_manage.vehicle.service.dao.BmVehicleInfo;
|
|||||||
@Data
|
@Data
|
||||||
public class VehicleQuery extends BaseQuery<BmVehicleInfo> {
|
public class VehicleQuery extends BaseQuery<BmVehicleInfo> {
|
||||||
|
|
||||||
private String storagevehicle_code_begin;
|
private String vehicle_code_begin;
|
||||||
private String storagevehicle_code_end;
|
private String vehicle_code_end;
|
||||||
private String storagevehicle_type;
|
private String vehicle_type;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paramMapping() {
|
public void paramMapping() {
|
||||||
super.doP.put("storagevehicle_code_begin", QParam.builder().k(new String[]{"storagevehicle_code"}).type(QueryTEnum.LT).build());
|
super.doP.put("vehicle_code_begin", QParam.builder().k(new String[]{"vehicle_code"}).type(QueryTEnum.GE).build());
|
||||||
super.doP.put("storagevehicle_code_end", QParam.builder().k(new String[]{"storagevehicle_code"}).type(QueryTEnum.LE).build());
|
super.doP.put("vehicle_code_end", QParam.builder().k(new String[]{"vehicle_code"}).type(QueryTEnum.LE).build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ import org.nl.wms.base_manage.vehicle.service.IBmVehicleInfoService;
|
|||||||
import org.nl.wms.base_manage.vehicle.service.dao.BmVehicleInfo;
|
import org.nl.wms.base_manage.vehicle.service.dao.BmVehicleInfo;
|
||||||
import org.nl.wms.base_manage.vehicle.service.dao.mapper.BmVehicleInfoMapper;
|
import org.nl.wms.base_manage.vehicle.service.dao.mapper.BmVehicleInfoMapper;
|
||||||
import org.nl.wms.base_manage.vehicle.service.dto.VehicleQuery;
|
import org.nl.wms.base_manage.vehicle.service.dto.VehicleQuery;
|
||||||
|
import org.nl.wms.system_manage.service.dict.ISysDictService;
|
||||||
|
import org.nl.wms.system_manage.service.dict.dao.Dict;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -37,6 +40,8 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class BmVehicleInfoServiceImpl extends ServiceImpl<BmVehicleInfoMapper, BmVehicleInfo> implements IBmVehicleInfoService {
|
public class BmVehicleInfoServiceImpl extends ServiceImpl<BmVehicleInfoMapper, BmVehicleInfo> implements IBmVehicleInfoService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDictService dictService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BmVehicleInfo vehileInfo(String vehicle_code) {
|
public BmVehicleInfo vehileInfo(String vehicle_code) {
|
||||||
@@ -50,37 +55,21 @@ public class BmVehicleInfoServiceImpl extends ServiceImpl<BmVehicleInfoMapper, B
|
|||||||
if (!ObjectUtil.isEmpty(one)) {
|
if (!ObjectUtil.isEmpty(one)) {
|
||||||
throw new BadRequestException("此载具已存在");
|
throw new BadRequestException("此载具已存在");
|
||||||
}
|
}
|
||||||
String code = "";
|
//转编码类型:
|
||||||
switch (map.getString("vehicle_type")) {
|
Dict dict = dictService.getOne(new QueryWrapper<Dict>().eq("para1", map.getString("vehicle_type")));
|
||||||
case "00":
|
if (dict==null){
|
||||||
code = "VEHICCLE_CODE_XMTPT";
|
throw new BadRequestException("此载具类型"+map.getString("vehicle_type")+"没有配置字典值");
|
||||||
break;
|
|
||||||
case "01":
|
|
||||||
code = "VEHICCLE_CODE_CDMTP";
|
|
||||||
break;
|
|
||||||
case "02":
|
|
||||||
code = "VEHICCLE_CODE_TLD";
|
|
||||||
break;
|
|
||||||
case "03":
|
|
||||||
code = "VEHICCLE_CODE_TTP";
|
|
||||||
break;
|
|
||||||
case "04":
|
|
||||||
code = "VEHICCLE_CODE_XMTPC";
|
|
||||||
break;
|
|
||||||
case "05":
|
|
||||||
code = "VEHICCLE_CODE_LX";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
JSONArray resultCodeArr = new JSONArray();
|
JSONArray resultCodeArr = new JSONArray();
|
||||||
int num = MapUtil.getInt(map, "num");
|
int num = MapUtil.getInt(map, "num");
|
||||||
for (int i = 0; i < num; i++) {
|
for (int i = 0; i < num; i++) {
|
||||||
BmVehicleInfo entity = new BmVehicleInfo();
|
BmVehicleInfo entity = new BmVehicleInfo();
|
||||||
entity.setVehicle_code(CodeUtil.getNewCode(code));
|
entity.setVehicle_code(CodeUtil.getNewCode(map.getString("vehicle_type")));
|
||||||
entity.setVehicle_name(entity.getVehicle_name());
|
entity.setVehicle_name(entity.getVehicle_name());
|
||||||
entity.setUpdate_name(SecurityUtils.getCurrentNickName());
|
entity.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||||
entity.setUpdate_name(DateUtil.now());
|
entity.setUpdate_name(DateUtil.now());
|
||||||
entity.setIs_used(map.getString("is_used").equals("1"));
|
entity.setIs_used(map.getString("is_used").equals("1"));
|
||||||
entity.setVehicle_type(map.getString("vehicle_type"));
|
entity.setVehicle_type(dict.getValue());
|
||||||
this.save(entity);
|
this.save(entity);
|
||||||
resultCodeArr.add(entity.getVehicle_code());
|
resultCodeArr.add(entity.getVehicle_code());
|
||||||
}
|
}
|
||||||
@@ -167,30 +156,8 @@ public class BmVehicleInfoServiceImpl extends ServiceImpl<BmVehicleInfoMapper, B
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject getVehicle(String code) {
|
public JSONObject getVehicle(String code) {
|
||||||
String term = "";
|
|
||||||
switch (code) {
|
|
||||||
case "00":
|
|
||||||
term = "VEHICCLE_CODE_XMTPT";
|
|
||||||
break;
|
|
||||||
case "01":
|
|
||||||
term = "VEHICCLE_CODE_CDMTP";
|
|
||||||
break;
|
|
||||||
case "02":
|
|
||||||
term = "VEHICCLE_CODE_TLD";
|
|
||||||
break;
|
|
||||||
case "03":
|
|
||||||
term = "VEHICCLE_CODE_TTP";
|
|
||||||
break;
|
|
||||||
case "04":
|
|
||||||
term = "VEHICCLE_CODE_XMTPC";
|
|
||||||
break;
|
|
||||||
case "05":
|
|
||||||
term = "VEHICCLE_CODE_LX";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("value", CodeUtil.codeView(term));
|
json.put("value", CodeUtil.codeView(code));
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,9 @@ public class BmFormStrucController {
|
|||||||
,"biz_date","业务单据日期"
|
,"biz_date","业务单据日期"
|
||||||
,"biz_status","业务单据状态"
|
,"biz_status","业务单据状态"
|
||||||
,"material_id","物料id"
|
,"material_id","物料id"
|
||||||
,"qty","数量");
|
,"qty","数量"
|
||||||
|
,"unit_id","单位"
|
||||||
|
,"vehicle_code","载具");
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
IBmFormStrucService iBmFormStrucService;
|
IBmFormStrucService iBmFormStrucService;
|
||||||
@@ -126,18 +128,19 @@ public class BmFormStrucController {
|
|||||||
}
|
}
|
||||||
if (form_struc.getHas_child()){
|
if (form_struc.getHas_child()){
|
||||||
List<Map> dtl_items = new ArrayList<>();
|
List<Map> dtl_items = new ArrayList<>();
|
||||||
BmFormStruc child_struc = iBmFormStrucService.getOne(new QueryWrapper<BmFormStruc>().eq("parent_id", form_struc.getForm_type()));
|
BmFormStruc child_struc = iBmFormStrucService.getOne(new QueryWrapper<BmFormStruc>().eq("parent_id", form_struc.getId()));
|
||||||
|
if (child_struc == null){
|
||||||
|
throw new BadRequestException("当前表单配置异常:无子表配置信息");
|
||||||
|
}
|
||||||
JSONObject child_param = child_struc.getForm_param();
|
JSONObject child_param = child_struc.getForm_param();
|
||||||
child_param.putAll(BASE_FORM);
|
child_param.putAll(BASE_FORM);
|
||||||
for (String key : child_param.keySet()) {
|
for (String key : child_param.keySet()) {
|
||||||
dtl_items.add(MapOf.of("lable",form_param.get(key),"value",key));
|
dtl_items.add(MapOf.of("lable",child_param.get(key),"value",key));
|
||||||
}
|
}
|
||||||
result.put("dtl_item",dtl_items);
|
result.put("dtl_item",dtl_items);
|
||||||
}
|
}
|
||||||
result.put("item",items);
|
result.put("item",items);
|
||||||
return new ResponseEntity<>(result,HttpStatus.OK);
|
return new ResponseEntity<>(result,HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,11 @@ public class BmFormStruc implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String qty;
|
private String qty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位id
|
||||||
|
*/
|
||||||
|
private String unit_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批次号
|
* 批次号
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package org.nl.wms.external_system.acs.service;
|
package org.nl.wms.external_system.acs.service;
|
||||||
|
|
||||||
import cn.hutool.json.JSONArray;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
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;
|
||||||
import org.nl.common.utils.InterationUtil;
|
import org.nl.common.utils.InterationUtil;
|
||||||
@@ -38,7 +38,7 @@ public class WmsToAcsService implements InitializingBean {
|
|||||||
//封装数据:
|
//封装数据:
|
||||||
TransferDto dto = new TransferDto();
|
TransferDto dto = new TransferDto();
|
||||||
MappingSourceDataTypeHandler<JSONObject> typeHandler = new MappingSourceDataTypeHandler<>();
|
MappingSourceDataTypeHandler<JSONObject> typeHandler = new MappingSourceDataTypeHandler<>();
|
||||||
List<JSONObject> items = typeHandler.sourceHandler((JSONArray) JSON.toJSON(arr), mapping);
|
List<JSONObject> items = typeHandler.sourceHandler((JSONArray)JSONArray.toJSON(arr), mapping);
|
||||||
dto.setModel(items);
|
dto.setModel(items);
|
||||||
|
|
||||||
JSONObject result = InterationUtil.notifyExt(mapping.getSync_url(), (JSONObject) JSON.toJSON(dto));
|
JSONObject result = InterationUtil.notifyExt(mapping.getSync_url(), (JSONObject) JSON.toJSON(dto));
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class FormActivityBehavior extends FlowNodeActivityBehavior<JSONObject> {
|
|||||||
// throw new BadRequestException("【flow】当前节点表单类型未定义");
|
// throw new BadRequestException("【flow】当前节点表单类型未定义");
|
||||||
// }
|
// }
|
||||||
//TEST:这部分数据放在框架中,每个节点都需要
|
//TEST:这部分数据放在框架中,每个节点都需要
|
||||||
entity.setForm_struc(targetStruc);
|
entity.setForm_struc(sourceStruc);
|
||||||
|
|
||||||
//处理自定义参数:
|
//处理自定义参数:
|
||||||
if (currentNode.getSkipExpression()!=null || currentNode.getSkipExpression().size()>0){
|
if (currentNode.getSkipExpression()!=null || currentNode.getSkipExpression().size()>0){
|
||||||
@@ -75,7 +75,7 @@ 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(), sourceStruc);
|
JSONObject handler = typeHandler.handler(currentNode.getSkipExpression(), entity.getT(), targetStruc);
|
||||||
|
|
||||||
//该参数里包含三部分:主数据基础字段,组数据自定义及明细,
|
//该参数里包含三部分:主数据基础字段,组数据自定义及明细,
|
||||||
//明细:基础字段,组数据自定义及参数:
|
//明细:基础字段,组数据自定义及参数:
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.nl.common.domain.exception.BadRequestException;
|
||||||
import org.nl.common.utils.ListOf;
|
import org.nl.common.utils.ListOf;
|
||||||
import org.nl.wms.config_manage.form_struc.service.IBmFormStrucService;
|
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.config_manage.form_struc.service.dao.BmFormStruc;
|
||||||
@@ -66,11 +67,14 @@ public class MappingHandler extends TypeHandler<JSONObject, JSONObject> {
|
|||||||
}
|
}
|
||||||
returnObj.put("form_data",form_data);
|
returnObj.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()));
|
||||||
if (item!=null){
|
if (item!=null){
|
||||||
|
//暂定:强制校验
|
||||||
|
if (item_struc == null){
|
||||||
|
throw new BadRequestException("当前数据存在明细且目标单据:"+form_struc.getForm_type()+" 未配置明细表");
|
||||||
|
}
|
||||||
JSONArray itemList = new JSONArray();
|
JSONArray itemList = new JSONArray();
|
||||||
BmFormStruc item_struc = iBmFormStrucService.getOne(new QueryWrapper<BmFormStruc>().eq("parent_id",form_struc.getForm_type()));
|
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package org.nl.wms.flow_manage.flow.framework.process.nodeType.source;
|
package org.nl.wms.flow_manage.flow.framework.process.nodeType.source;
|
||||||
|
|
||||||
import cn.hutool.json.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import cn.hutool.json.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.nl.wms.config_manage.form_struc.service.dao.BmFormStruc;
|
import org.nl.wms.config_manage.form_struc.service.dao.BmFormStruc;
|
||||||
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.sync_manage.service.form_mapping.dao.SyncFormMapping;
|
import org.nl.wms.sync_manage.service.form_mapping.dao.SyncFormMapping;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package org.nl.wms.flow_manage.flow.framework.process.nodeType.source.impl;
|
package org.nl.wms.flow_manage.flow.framework.process.nodeType.source.impl;
|
||||||
|
|
||||||
import cn.hutool.json.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.fastjson.TypeReference;
|
import com.alibaba.fastjson.TypeReference;
|
||||||
import org.nl.common.utils.ListOf;
|
import org.nl.common.utils.ListOf;
|
||||||
@@ -28,15 +28,17 @@ public class MappingSourceDataTypeHandler<Z> extends SourceDataTypeHandler{
|
|||||||
public List<Z> sourceHandler(JSONArray entity, SyncFormMapping formMapping) {
|
public List<Z> sourceHandler(JSONArray entity, SyncFormMapping formMapping) {
|
||||||
|
|
||||||
List<Z> list = new ArrayList<>();
|
List<Z> list = new ArrayList<>();
|
||||||
JSONObject mappingJson = formMapping.getMapping_json();
|
JSONArray mapping_json = formMapping.getMapping_json();
|
||||||
for (Object jdata : entity) {
|
for (Object jdata : entity) {
|
||||||
JSONObject data = (JSONObject) jdata;
|
JSONObject data = (JSONObject) jdata;
|
||||||
data.putAll(data.getJSONObject("form_data"));
|
data.putAll(data.getJSONObject("form_data"));
|
||||||
JSONObject item = new JSONObject();
|
JSONObject item = new JSONObject();
|
||||||
for (String target : mappingJson.keySet()) {
|
for (int i = 0; i < mapping_json.size(); i++) {
|
||||||
String key = mappingJson.getString(target);
|
JSONObject jsonObject = mapping_json.getJSONObject(i);
|
||||||
item.put(target,data.get(key));
|
String key = jsonObject.getString("mapping_field");
|
||||||
|
item.put(key,data.get(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeReference<Class<Z>> typeRef = new TypeReference<Class<Z>>() {};
|
TypeReference<Class<Z>> typeRef = new TypeReference<Class<Z>>() {};
|
||||||
list.add(data.toJavaObject(typeRef));
|
list.add(data.toJavaObject(typeRef));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package org.nl.wms.pm_manage.form_data.service;
|
|||||||
|
|
||||||
import org.nl.wms.pm_manage.form_data.service.dao.PmFormData;
|
import org.nl.wms.pm_manage.form_data.service.dao.PmFormData;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.nl.wms.sync_manage.service.form_mapping.dao.SyncFormMapping;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -15,4 +18,6 @@ public interface IPmFormDataService extends IService<PmFormData> {
|
|||||||
|
|
||||||
Integer syncFormData(String type,String dataString);
|
Integer syncFormData(String type,String dataString);
|
||||||
|
|
||||||
|
List<PmFormData> syncAnalyse(SyncFormMapping mapping, String dataString);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,11 @@ public class PmFormData implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal qty;
|
private BigDecimal qty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
private String unit_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批次号
|
* 批次号
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
package org.nl.wms.pm_manage.form_data.service.impl;
|
package org.nl.wms.pm_manage.form_data.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.nl.common.domain.exception.BadRequestException;
|
||||||
|
import org.nl.common.utils.ListOf;
|
||||||
|
import org.nl.common.utils.SpelUtil;
|
||||||
import org.nl.wms.config_manage.form_struc.service.IBmFormStrucService;
|
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.config_manage.form_struc.service.dao.BmFormStruc;
|
||||||
import org.nl.wms.flow_manage.flow.framework.process.nodeType.source.SourceDataTypeHandler;
|
|
||||||
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.pm_manage.form_data.service.dao.mapper.PmFormDataMapper;
|
import org.nl.wms.pm_manage.form_data.service.dao.mapper.PmFormDataMapper;
|
||||||
import org.nl.wms.pm_manage.form_data.service.IPmFormDataService;
|
import org.nl.wms.pm_manage.form_data.service.IPmFormDataService;
|
||||||
@@ -11,13 +15,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import org.nl.wms.sync_manage.service.form_mapping.ISyncFormMappingService;
|
import org.nl.wms.sync_manage.service.form_mapping.ISyncFormMappingService;
|
||||||
import org.nl.wms.sync_manage.service.form_mapping.dao.SyncFormMapping;
|
import org.nl.wms.sync_manage.service.form_mapping.dao.SyncFormMapping;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.Map;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -40,13 +44,11 @@ import java.util.Map;
|
|||||||
public class PmFormDataServiceImpl extends ServiceImpl<PmFormDataMapper, PmFormData> implements IPmFormDataService {
|
public class PmFormDataServiceImpl extends ServiceImpl<PmFormDataMapper, PmFormData> implements IPmFormDataService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IBmFormStrucService formStrucService;
|
||||||
|
@Autowired
|
||||||
|
private ISyncFormMappingService iSyncFormMappingService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
IBmFormStrucService formStrucService;
|
|
||||||
@Autowired
|
|
||||||
ISyncFormMappingService iSyncFormMappingService;
|
|
||||||
// @Autowired
|
|
||||||
Map<String,SourceDataTypeHandler> SourceDataTypeHandlerMap;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer syncFormData(String form_type, String dataString) {
|
public Integer syncFormData(String form_type, String dataString) {
|
||||||
@@ -71,5 +73,66 @@ public class PmFormDataServiceImpl extends ServiceImpl<PmFormDataMapper, PmFormD
|
|||||||
return saves.size();
|
return saves.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PmFormData> syncAnalyse(SyncFormMapping formMapping, String dataString) {
|
||||||
|
BmFormStruc one = formStrucService.getOne(new QueryWrapper<BmFormStruc>().eq("form_type", formMapping.getForm_type()));
|
||||||
|
//目标数据
|
||||||
|
JSONObject dataJson = JSONObject.parseObject(dataString);
|
||||||
|
if (StringUtils.isNotEmpty(one.getConvert_json())){
|
||||||
|
dataJson = dataJson.getJSONObject(one.getConvert_json());
|
||||||
|
}
|
||||||
|
Map<String, JSONObject> itemMapping = formMapping.getMapping_json().stream().collect(HashMap::new, (formMap, o) -> {
|
||||||
|
JSONObject item = (JSONObject) o;
|
||||||
|
formMap.put(item.getString("value"), item);
|
||||||
|
}, HashMap::putAll);
|
||||||
|
//基础字段
|
||||||
|
Set<String> fields = ListOf.ofSet(one.getBiz_code()
|
||||||
|
, one.getBiz_id()
|
||||||
|
, one.getBiz_code()
|
||||||
|
, one.getBiz_status()
|
||||||
|
, one.getMaterial_id()
|
||||||
|
, one.getPcsn()
|
||||||
|
, one.getVehicle_code()
|
||||||
|
, one.getUnit_id()
|
||||||
|
, one.getQty());
|
||||||
|
//查询目标表字段
|
||||||
|
JSONObject returnObj = new JSONObject();
|
||||||
|
//基础字段映射:如果只有一个就不迭代
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
JSONObject targetData = mappingParse(fields, itemMapping, dataJson);
|
||||||
|
//查询表单配置表,获取自定义json:自定义字段参数获取
|
||||||
|
JSONObject form_param = one.getForm_param();
|
||||||
|
if (form_param!=null){
|
||||||
|
JSONObject form_data = mappingParse(form_param.keySet(), itemMapping, dataJson);
|
||||||
|
targetData.put("form_data",form_data);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private JSONObject mappingParse(Set<String> fields,Map<String, JSONObject> itemMapping,JSONObject sourceData){
|
||||||
|
Map<String, String> SpelMap = new HashMap<>();
|
||||||
|
JSONObject data = new JSONObject();
|
||||||
|
for (String field : fields) {
|
||||||
|
if (StringUtils.isNotEmpty(field)){
|
||||||
|
JSONObject itemMappingConfig = itemMapping.get(field);
|
||||||
|
if (itemMappingConfig == null){
|
||||||
|
throw new BadRequestException(String.format("当前表单没有配置字段:%s 映射", new String[]{field}));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(itemMappingConfig.getString("skipExpression"))){
|
||||||
|
//el表达式解析
|
||||||
|
SpelMap.put(field,itemMappingConfig.getString("skipExpression"));
|
||||||
|
}else {
|
||||||
|
data.put(field,sourceData.getString(itemMappingConfig.getString("mapping_field")));
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(SpelMap)){
|
||||||
|
Map<String, String> parse = SpelUtil.parse(sourceData, SpelMap);
|
||||||
|
data.putAll(parse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package org.nl.wms.sync_manage.service.form_mapping.dao;
|
package org.nl.wms.sync_manage.service.form_mapping.dao;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
@@ -62,7 +61,7 @@ public class SyncFormMapping implements Serializable {
|
|||||||
* 关系中维护springEL表达式
|
* 关系中维护springEL表达式
|
||||||
*/
|
*/
|
||||||
@TableField(typeHandler = FastjsonTypeHandler.class)
|
@TableField(typeHandler = FastjsonTypeHandler.class)
|
||||||
private JSONObject mapping_json;
|
private JSONArray mapping_json;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改人ID
|
* 修改人ID
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.nl.wms.sync_manage.service.form_mapping.impl;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
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 org.nl.common.utils.IdUtil;
|
import org.nl.common.utils.IdUtil;
|
||||||
import org.nl.common.utils.MapOf;
|
import org.nl.common.utils.MapOf;
|
||||||
import org.nl.common.utils.SecurityUtils;
|
import org.nl.common.utils.SecurityUtils;
|
||||||
@@ -11,6 +12,7 @@ import org.nl.wms.sync_manage.service.form_mapping.dao.mapper.SyncFormMappingMap
|
|||||||
import org.nl.wms.sync_manage.service.form_mapping.ISyncFormMappingService;
|
import org.nl.wms.sync_manage.service.form_mapping.ISyncFormMappingService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -38,11 +40,14 @@ public class SyncFormMappingServiceImpl extends ServiceImpl<SyncFormMappingMappe
|
|||||||
* skipExpression:表达式复杂字段通过这个表达式进行转换
|
* skipExpression:表达式复杂字段通过这个表达式进行转换
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public void saveSyncMapping(JSONObject param) {
|
public void saveSyncMapping(JSONObject param) {
|
||||||
if (param==null){
|
if (param==null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JSONObject mst = param.getJSONObject("mst");
|
JSONObject mst = param.getJSONObject("mst");
|
||||||
|
//先删在加
|
||||||
|
this.remove(new QueryWrapper<SyncFormMapping>().eq("form_type",mst.getString("form_type")));
|
||||||
SyncFormMapping mapping = new SyncFormMapping();
|
SyncFormMapping mapping = new SyncFormMapping();
|
||||||
mapping.setId(IdUtil.getStringId());
|
mapping.setId(IdUtil.getStringId());
|
||||||
mapping.setForm_name(mst.getString("form_name"));
|
mapping.setForm_name(mst.getString("form_name"));
|
||||||
@@ -53,7 +58,7 @@ public class SyncFormMappingServiceImpl extends ServiceImpl<SyncFormMappingMappe
|
|||||||
mapping.setUpdate_id(SecurityUtils.getCurrentUserId());
|
mapping.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||||
mapping.setUpdate_name(SecurityUtils.getCurrentNickName());
|
mapping.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||||
mapping.setUpdate_time(DateUtil.now());
|
mapping.setUpdate_time(DateUtil.now());
|
||||||
mapping.setMapping_json(param.getJSONObject("item"));
|
mapping.setMapping_json(param.getJSONArray("item"));
|
||||||
this.save(mapping);
|
this.save(mapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +77,7 @@ public class SyncFormMappingServiceImpl extends ServiceImpl<SyncFormMappingMappe
|
|||||||
mapping.setUpdate_id(SecurityUtils.getCurrentUserId());
|
mapping.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||||
mapping.setUpdate_name(SecurityUtils.getCurrentNickName());
|
mapping.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||||
mapping.setUpdate_time(DateUtil.now());
|
mapping.setUpdate_time(DateUtil.now());
|
||||||
mapping.setMapping_json(param.getJSONObject("item"));
|
mapping.setMapping_json(param.getJSONArray("item"));
|
||||||
this.updateById(mapping);
|
this.updateById(mapping);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,6 @@
|
|||||||
<select id="findBycode" resultType="org.nl.wms.system_manage.service.coderule.dao.SysCodeRuleDetail">
|
<select id="findBycode" resultType="org.nl.wms.system_manage.service.coderule.dao.SysCodeRuleDetail">
|
||||||
select sys_code_rule_detail.* from sys_code_rule_detail
|
select sys_code_rule_detail.* from sys_code_rule_detail
|
||||||
left join sys_code_rule on sys_code_rule_detail.code_rule_id = sys_code_rule.id
|
left join sys_code_rule on sys_code_rule_detail.code_rule_id = sys_code_rule.id
|
||||||
where sys_code_rule.code = #{code}
|
where sys_code_rule.code = #{code} order by sys_code_rule_detail.sort_num asc
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -14,6 +14,6 @@ public class CodeRuleQuery extends BaseQuery<SysCodeRule> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paramMapping() {
|
public void paramMapping() {
|
||||||
this.doP.put("blurry", QParam.builder().k(new String[]{"code", "name"}).type(QueryTEnum.LK).build());
|
this.doP.put("blurry", QParam.builder().k(new String[]{"code", "name"}).type(QueryTEnum.ORLK).build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
|
|||||||
@Override
|
@Override
|
||||||
public String codeDemo(String flag, String code) {
|
public String codeDemo(String flag, String code) {
|
||||||
List<SysCodeRuleDetail> ruleDtl = this.baseMapper.findBycode(code);
|
List<SysCodeRuleDetail> ruleDtl = this.baseMapper.findBycode(code);
|
||||||
|
if (CollectionUtils.isEmpty(ruleDtl)){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
if (CollectionUtils.isEmpty(ruleDtl)){
|
if (CollectionUtils.isEmpty(ruleDtl)){
|
||||||
throw new BadRequestException("编码规则不存在"+code);
|
throw new BadRequestException("编码规则不存在"+code);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,10 @@
|
|||||||
<el-form-item label="长度" prop="length">
|
<el-form-item label="长度" prop="length">
|
||||||
<el-input v-model="form.length" style="width: 370px;" />
|
<el-input v-model="form.length" style="width: 370px;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="当前值" prop="max_value">
|
||||||
|
<el-input v-model="form.current_value" style="width: 370px;" />
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="最大值" prop="max_value">
|
<el-form-item label="最大值" prop="max_value">
|
||||||
<el-input v-model="form.max_value" style="width: 370px;" />
|
<el-input v-model="form.max_value" style="width: 370px;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
@@ -177,7 +177,7 @@
|
|||||||
<el-option
|
<el-option
|
||||||
v-for="item in dict.storagevehicle_type"
|
v-for="item in dict.storagevehicle_type"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value"
|
:value="item.para1"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -188,6 +188,38 @@
|
|||||||
<el-form-item label="载具数量" prop="num">
|
<el-form-item label="载具数量" prop="num">
|
||||||
<el-input-number v-model="form.num" :precision="0" style="width: 150px;" />
|
<el-input-number v-model="form.num" :precision="0" style="width: 150px;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="高度(mm)" prop="h">
|
||||||
|
<el-input-number v-model="form.h" :precision="0" style="width: 150px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="宽度(mm)" prop="w">
|
||||||
|
<el-input-number v-model="form.w" :precision="0" style="width: 150px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="深度(mm)" prop="l">
|
||||||
|
<el-input-number v-model="form.l" :precision="0" style="width: 150px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="重量(g)" prop="weight">
|
||||||
|
<el-input-number v-model="form.weight" :precision="0" style="width: 150px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否超限" prop="overstruct_type">
|
||||||
|
<el-select
|
||||||
|
v-model="form.overstruct_type"
|
||||||
|
style="width: 150px"
|
||||||
|
clearable
|
||||||
|
size="mini"
|
||||||
|
placeholder="超限类型"
|
||||||
|
class="filter-item"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in dict.VEHICLE_OVER_TYPE"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="form.overstruct_type !=='0'" label="超限货位" prop="occupystruct_qty">
|
||||||
|
<el-input-number v-model="form.occupystruct_qty" :precision="0" style="width: 150px;" />
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="是否启用">
|
<el-form-item label="是否启用">
|
||||||
<el-radio v-model="form.is_used" label="0">否</el-radio>
|
<el-radio v-model="form.is_used" label="0">否</el-radio>
|
||||||
<el-radio v-model="form.is_used" label="1">是</el-radio>
|
<el-radio v-model="form.is_used" label="1">是</el-radio>
|
||||||
@@ -209,7 +241,7 @@
|
|||||||
@selection-change="crud.selectionChangeHandler"
|
@selection-change="crud.selectionChangeHandler"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column prop="storagevehicle_type" label="载具类型">
|
<el-table-column prop="vehicle_type" label="载具类型">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ dict.label.storagevehicle_type[scope.row.vehicle_type] }}
|
{{ dict.label.storagevehicle_type[scope.row.vehicle_type] }}
|
||||||
</template>
|
</template>
|
||||||
@@ -289,14 +321,14 @@ const defaultForm = {
|
|||||||
l: null,
|
l: null,
|
||||||
h: null,
|
h: null,
|
||||||
weight: null,
|
weight: null,
|
||||||
overstruct_type: null,
|
overstruct_type: '0',
|
||||||
occupystruct_qty: null,
|
occupystruct_qty: '1',
|
||||||
ext_json: null,
|
ext_json: null,
|
||||||
num: '1'
|
num: '1'
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
name: 'Storagevehicleinfo',
|
name: 'Storagevehicleinfo',
|
||||||
dicts: ['storagevehicle_type'],
|
dicts: ['storagevehicle_type',"VEHICLE_OVER_TYPE"],
|
||||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
cruds() {
|
cruds() {
|
||||||
@@ -371,6 +403,9 @@ export default {
|
|||||||
[CRUD.HOOK.beforeRefresh]() {
|
[CRUD.HOOK.beforeRefresh]() {
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
|
onCloseDialog(){
|
||||||
|
this.form=defaultForm
|
||||||
|
},
|
||||||
queryMater(index, row) {
|
queryMater(index, row) {
|
||||||
this.materialShow = true
|
this.materialShow = true
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -128,6 +128,25 @@
|
|||||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
title="表单同步测试"
|
||||||
|
:visible.sync=syncShow
|
||||||
|
width="600px"
|
||||||
|
@close="syncTestCannel"
|
||||||
|
>
|
||||||
|
<el-form ref="form" :model="syncForm" :rules="rules" size="mini" label-width="50px">
|
||||||
|
<el-form-item label="表单:" prop="occupystruct_qty">
|
||||||
|
<el-input disabled v-model="syncForm.form_name" :precision="0" style="width: 150px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="测试数据" prop="testData">
|
||||||
|
<el-input type="textarea" v-model="syncForm.testData" :precision="0" style="width: 450px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button :loading="crud.cu === 2" type="primary" @click="syncTestSubmit">同步</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
<!--表格渲染-->
|
<!--表格渲染-->
|
||||||
<el-table
|
<el-table
|
||||||
ref="table"
|
ref="table"
|
||||||
@@ -138,24 +157,30 @@
|
|||||||
@selection-change="crud.selectionChangeHandler"
|
@selection-change="crud.selectionChangeHandler"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column prop="form_name" label="表单名称" width="120" />
|
<el-table-column prop="form_name" label="表单名称" width="150" />
|
||||||
<el-table-column prop="form_type" label="表单类型" width="120" />
|
<el-table-column prop="form_type" label="表单类型" width="150" />
|
||||||
<el-table-column prop="sync_type" label="同步方式" width="120" />
|
<el-table-column prop="sync_type" label="同步类型" width="150" >
|
||||||
<el-table-column prop="sync_url" label="同步配置" width="120" />
|
<template slot-scope="scope">
|
||||||
<el-table-column prop="mapping_json" :show-overflow-tooltip="true" :formatter="jsonFormat" label="字段映射关系" width="120" />
|
{{ dict.label.sync_type[scope.row.sync_type] }}
|
||||||
<el-table-column prop="update_name" label="更新人" width="120" />
|
</template>
|
||||||
<el-table-column prop="update_time" label="更新事件" width="120" />
|
</el-table-column>
|
||||||
<!-- <el-table-column prop="sync_type" label="同步类型">-->
|
<el-table-column prop="sync_url" label="同步配置" width="210" />
|
||||||
<!-- <template slot-scope="scope">-->
|
<el-table-column prop="mapping_json" :show-overflow-tooltip="true" :formatter="jsonFormat" label="字段映射关系" width="210" />
|
||||||
<!-- {{ dict.label.sync_type[scope.row.sync_type] }}-->
|
<el-table-column prop="update_name" label="更新人" width="150" />
|
||||||
<!-- </template>-->
|
<el-table-column prop="update_time" label="更新时间" width="150" />
|
||||||
<!-- </el-table-column>-->
|
|
||||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<udOperation
|
<udOperation
|
||||||
:data="scope.row"
|
:data="scope.row"
|
||||||
:permission="permission"
|
:permission="permission"
|
||||||
/>
|
/>
|
||||||
|
<el-button
|
||||||
|
class="filter-item"
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
type="warning"
|
||||||
|
@click="syncTest(scope.row)"
|
||||||
|
>同步测试</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -215,6 +240,8 @@ export default {
|
|||||||
dataTypeList: [],
|
dataTypeList: [],
|
||||||
addShow: false,
|
addShow: false,
|
||||||
editShow: false,
|
editShow: false,
|
||||||
|
syncShow: false,
|
||||||
|
syncForm: {},
|
||||||
permission: {},
|
permission: {},
|
||||||
rules: {
|
rules: {
|
||||||
position_code: [
|
position_code: [
|
||||||
@@ -262,6 +289,16 @@ export default {
|
|||||||
},
|
},
|
||||||
querytable1() {
|
querytable1() {
|
||||||
this.crud.toQuery()
|
this.crud.toQuery()
|
||||||
|
},
|
||||||
|
syncTest(row){
|
||||||
|
this.syncShow = true
|
||||||
|
this.syncForm = row
|
||||||
|
},
|
||||||
|
syncTestSubmit(){
|
||||||
|
this.crud.notify('操作成功'+row.form_type, CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
},
|
||||||
|
syncTestCannel(){
|
||||||
|
this.syncForm = {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user