add:仓库策略配置页面
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package org.nl.config.mybatis.typeHandler;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedJdbcTypes;
|
||||
import org.apache.ibatis.type.MappedTypes;
|
||||
import org.nl.common.domain.handler.ListTypeHandler;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
@MappedTypes({Object.class})
|
||||
@MappedJdbcTypes(JdbcType.VARCHAR)
|
||||
public class ListStrTypeHandler extends ListTypeHandler {
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType) throws SQLException {
|
||||
ps.setString(i, JSON.toJSONString(parameter));
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,12 @@
|
||||
package org.nl.wms.decision_manage.controller.sectStrategy;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import org.apache.catalina.security.SecurityUtil;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.decision_manage.service.sectStrategy.IStSectStrategyService;
|
||||
import org.nl.wms.decision_manage.service.sectStrategy.dao.StSectStrategy;
|
||||
import org.nl.wms.decision_manage.service.sectStrategy.dto.SectStrategyQuery;
|
||||
@@ -23,7 +27,7 @@ import java.util.Arrays;
|
||||
* @since 2025-06-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/stSectStrategy")
|
||||
@RequestMapping("/api/sectStrategy")
|
||||
public class StSectStrategyController {
|
||||
|
||||
@Autowired
|
||||
@@ -31,12 +35,14 @@ public class StSectStrategyController {
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<Object> query(SectStrategyQuery query, PageQuery page) {
|
||||
return new ResponseEntity<>(iStSectStrategyService.page(page.build(),query.build()), HttpStatus.OK);
|
||||
return new ResponseEntity<>(TableDataInfo.build(iStSectStrategyService.page(page.build(),query.build())), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增库区货位规则")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody StSectStrategy dao) {
|
||||
dao.setUpdate_time(DateUtil.now());
|
||||
dao.setUpdate_name(SecurityUtils.getCurrentUsername());
|
||||
iStSectStrategyService.save(dao);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@@ -44,6 +50,8 @@ public class StSectStrategyController {
|
||||
@PutMapping
|
||||
@Log("修改库区货位规则")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody StSectStrategy dao) {
|
||||
dao.setUpdate_time(DateUtil.now());
|
||||
dao.setUpdate_name(SecurityUtils.getCurrentUsername());
|
||||
iStSectStrategyService.updateById(dao);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
package org.nl.wms.decision_manage.service.sectStrategy.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nl.common.domain.handler.ListTypeHandler;
|
||||
import org.nl.config.mybatis.typeHandler.ListStrTypeHandler;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -17,7 +22,7 @@ import lombok.EqualsAndHashCode;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("st_sect_strategy")
|
||||
@TableName(value = "st_sect_strategy",autoResultMap = true)
|
||||
public class StSectStrategy implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -36,7 +41,8 @@ public class StSectStrategy implements Serializable {
|
||||
/**
|
||||
* 规则
|
||||
*/
|
||||
private String strategy;
|
||||
@TableField(typeHandler = ListStrTypeHandler.class)
|
||||
private List<String> strategy;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
|
||||
@@ -13,13 +13,6 @@ import org.nl.wms.decision_manage.service.sectStrategy.dao.StSectStrategy;
|
||||
@Data
|
||||
public class SectStrategyQuery extends BaseQuery<StSectStrategy> {
|
||||
|
||||
private String strategy_name;
|
||||
private Boolean is_delete =Boolean.FALSE;
|
||||
|
||||
@Override
|
||||
public void paramMapping() {
|
||||
super.doP.put("strategy_name", QParam.builder().k(new String[]{"strategy_name"}).type(QueryTEnum.LK).build());
|
||||
}
|
||||
|
||||
private String sect_code;
|
||||
|
||||
}
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="110px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-col :span="11">
|
||||
<el-form-item label="库区:" prop="sect_code">
|
||||
<el-select
|
||||
v-model="form.sect_code"
|
||||
placeholder=""
|
||||
style="width: 200px"
|
||||
style="width: 180px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in sectList"
|
||||
v-for="item in tableEnum.st_ivt_sectattr"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
@@ -23,12 +23,12 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-col :span="11">
|
||||
<el-form-item label="策略类型:" prop="strategy_type">
|
||||
<el-select
|
||||
v-model="form.strategy_type"
|
||||
placeholder=""
|
||||
style="width: 200px"
|
||||
style="width: 180px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in strategyTypeList"
|
||||
@@ -40,17 +40,18 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="类处理类型:" prop="class_type">
|
||||
<el-form-item label="策略:" prop="strategy_type">
|
||||
<el-select
|
||||
v-model="form.class_type"
|
||||
v-model="form.strategy"
|
||||
clearable
|
||||
multiple
|
||||
placeholder=""
|
||||
style="width: 200px"
|
||||
style="width: 460px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in tableEnum.st_ivt_sectattr"
|
||||
v-for="item in tableEnum.st_strategy_config"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
@@ -58,24 +59,11 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="参数:" prop="param">
|
||||
<el-input v-model="form.param" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="策略编码:" prop="param">
|
||||
<el-input v-model="form.strategy_code" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="描述:" prop="remark">
|
||||
<el-input v-model="form.remark" :rows="3" type="textarea" style="width: 560px;" />
|
||||
<el-form-item label="描述:" prop="description">
|
||||
<el-input v-model="form.description" :rows="3" type="textarea" style="width: 460px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -90,23 +78,17 @@
|
||||
<script>
|
||||
const defaultForm = {
|
||||
id: null,
|
||||
strategy_code: null,
|
||||
strategy_name: null,
|
||||
strategy_type: null,
|
||||
class_type: null,
|
||||
param: null,
|
||||
remark: null,
|
||||
is_used: null,
|
||||
ban: null,
|
||||
sect_code: null,
|
||||
strategy: null,
|
||||
description: null,
|
||||
update_name: null,
|
||||
update_time: null,
|
||||
is_delete: null
|
||||
update_time: null
|
||||
}
|
||||
import CRUD, { form, crud } from '@crud/crud'
|
||||
|
||||
export default {
|
||||
name: 'AddDialog',
|
||||
tableEnums: ['st_ivt_sectattr#sect_name#sect_code'],
|
||||
tableEnums: ['st_ivt_sectattr#sect_name#sect_code', 'st_strategy_config#strategy_name#strategy_code'],
|
||||
|
||||
mixins: [form(defaultForm), crud()],
|
||||
props: {
|
||||
@@ -123,29 +105,17 @@ export default {
|
||||
dialogVisible: false,
|
||||
strategyTypeList: [
|
||||
{ 'label': '入库', 'value': '1' },
|
||||
{ 'label': '出库', 'value': '2' },
|
||||
{ 'label': '通用', 'value': '3' }
|
||||
],
|
||||
classTypeList: [
|
||||
{ 'label': '实现类', 'value': '1' },
|
||||
{ 'label': '表达式', 'value': '2' },
|
||||
{ 'label': '脚本', 'value': '3' }
|
||||
{ 'label': '出库', 'value': '2' }
|
||||
],
|
||||
rules: {
|
||||
strategy_name: [
|
||||
{ required: true, message: '策略名称不能为空', trigger: 'blur' }
|
||||
strategy: [
|
||||
{ required: true, message: '策略不能为空', trigger: 'blur' }
|
||||
],
|
||||
sect_code: [
|
||||
{ required: true, message: '库区不能为空', trigger: 'blur' }
|
||||
],
|
||||
strategy_type: [
|
||||
{ required: true, message: '策略类型不能为空', trigger: 'blur' }
|
||||
],
|
||||
strategy_code: [
|
||||
{ required: true, message: '策略编码不能为空', trigger: 'blur' }
|
||||
],
|
||||
param: [
|
||||
{ required: true, message: '参数不能为空', trigger: 'blur' }
|
||||
],
|
||||
class_type: [
|
||||
{ required: true, message: '类处理类型不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
label-width="80px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="策略名称">
|
||||
<el-form-item label="库区名称">
|
||||
<el-input
|
||||
v-model="query.strategy_name"
|
||||
v-model="query.sect_code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="策略名称"
|
||||
placeholder="库区名称"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission"/>
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表单组件-->
|
||||
<el-table
|
||||
ref="table"
|
||||
@@ -37,30 +37,33 @@
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="策略类型" >
|
||||
<el-table-column prop="sect_code" label="库区名称" />
|
||||
<el-table-column prop="strategy_type" label="策略类型">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.ban?"系统策略":"自定义策略"}}
|
||||
{{ scope.row.strategy_type == '1'?'入库策略':'出库策略' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="strategy_name" label="策略名称" />
|
||||
<el-table-column prop="strategy_code" label="策略编码" />
|
||||
<el-table-column prop="strategy_type" label="决策类型" />
|
||||
<el-table-column prop="class_type" label="策略执行器" />
|
||||
<el-table-column prop="param" show-overflow-tooltip label="参数" />
|
||||
<el-table-column prop="remark" show-overflow-tooltip label="描述" />
|
||||
<el-table-column label="是否启用" align="center" prop="is_used">
|
||||
<el-table-column prop="strategy" label="策略列表" width="460">
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
:value="scope.row.is_used"
|
||||
active-color="#409EFF"
|
||||
inactive-color="#F56C6C"
|
||||
@change="changeEnabled(scope.row, scope.row.is_used)"
|
||||
/>
|
||||
<el-select
|
||||
v-model="scope.row.strategy"
|
||||
disabled
|
||||
style="width: 400px"
|
||||
multiple
|
||||
placeholder=""
|
||||
>
|
||||
<el-option
|
||||
v-for="item in tableEnum.st_strategy_config"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="description" label="描述" />
|
||||
<el-table-column prop="update_name" label="操作人" />
|
||||
<el-table-column min-width="160" prop="update_time" label="操作时间" />
|
||||
<el-table-column prop="update_time" label="操作时间" />
|
||||
<el-table-column
|
||||
v-permission="[]"
|
||||
label="操作"
|
||||
@@ -70,8 +73,8 @@
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:disabledDle="scope.row.ban"
|
||||
:disabledEdit="scope.row.ban"
|
||||
:disabled-dle="scope.row.ban"
|
||||
:disabled-edit="scope.row.ban"
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
@@ -94,14 +97,14 @@ import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
export default {
|
||||
name: 'Strategy',
|
||||
dicts: [],
|
||||
name: 'SectStrategy',
|
||||
tableEnums: ['st_strategy_config#strategy_name#strategy_code'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, AddDialog },
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '策略管理',
|
||||
url: 'api/strategy',
|
||||
url: 'api/sectStrategy',
|
||||
idField: 'id',
|
||||
sort: 'id,desc',
|
||||
crudMethod: { ...crudStrategy },
|
||||
@@ -116,6 +119,10 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
strategyTypeList: [
|
||||
{ 'label': '入库', 'value': '1' },
|
||||
{ 'label': '出库', 'value': '2' }
|
||||
],
|
||||
dialogVisible: false,
|
||||
permission: {},
|
||||
rules: {
|
||||
@@ -128,7 +135,7 @@ export default {
|
||||
return true
|
||||
},
|
||||
format_is_used(is_used) {
|
||||
return is_used==true
|
||||
return is_used == true
|
||||
},
|
||||
changeEnabled(data, val) {
|
||||
let msg = '此操作将停用,是否继续!'
|
||||
|
||||
@@ -2,7 +2,7 @@ import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/strategy',
|
||||
url: 'api/sectStrategy',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
@@ -10,7 +10,7 @@ export function add(data) {
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/strategy/',
|
||||
url: 'api/sectStrategy/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
@@ -18,18 +18,10 @@ export function del(ids) {
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/strategy',
|
||||
url: 'api/sectStrategy',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function changeActive(data) {
|
||||
return request({
|
||||
url: 'api/strategy/changeActive',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, changeActive }
|
||||
export default { add, edit, del }
|
||||
|
||||
Reference in New Issue
Block a user