Browse Source

上架策略

master
zhangli 1 year ago
parent
commit
7fdd8dced9
  1. 5
      src/api/wms/areabasic/index.ts
  2. 5
      src/api/wms/customer/index.ts
  3. 4
      src/api/wms/locationgroup/index.ts
  4. 28
      src/views/wms/strategy/purchaseReceiptStrategy/AddForm.vue
  5. 8
      src/views/wms/strategy/supplieDeliveryStrategy/AddForm.vue
  6. 543
      src/views/wms/strategy/upShelfStrategy/AddForm.vue
  7. 85
      src/views/wms/strategy/upShelfStrategy/index.vue

5
src/api/wms/areabasic/index.ts

@ -17,7 +17,10 @@ export interface AreaVO {
export const getAreaPage = async (params) => { export const getAreaPage = async (params) => {
return await request.get({ url: `/wms/areabasic/page`, params }) return await request.get({ url: `/wms/areabasic/page`, params })
} }
// 查询库区列表
export const getAreaList = async (params) => {
return await request.get({ url: `/wms/areabasic/list`, params })
}
// 查询库区详情 // 查询库区详情
export const getArea = async (id: number) => { export const getArea = async (id: number) => {
return await request.get({ url: `/wms/areabasic/get?id=` + id }) return await request.get({ url: `/wms/areabasic/get?id=` + id })

5
src/api/wms/customer/index.ts

@ -25,7 +25,10 @@ export interface CustomerVO {
export const getCustomerPage = async (params) => { export const getCustomerPage = async (params) => {
return await request.get({ url: `/wms/customer/page`, params }) return await request.get({ url: `/wms/customer/page`, params })
} }
// 查询客户列表
export const getCustomerList = async (params) => {
return await request.get({ url: `/wms/customer/list`, params })
}
// 查询客户详情 // 查询客户详情
export const getCustomer = async (id: number) => { export const getCustomer = async (id: number) => {
return await request.get({ url: `/wms/customer/get?id=` + id }) return await request.get({ url: `/wms/customer/get?id=` + id })

4
src/api/wms/locationgroup/index.ts

@ -16,6 +16,10 @@ export interface LocationgroupVO {
export const getLocationgroupPage = async (params) => { export const getLocationgroupPage = async (params) => {
return await request.get({ url: `/wms/locationgroup/page`, params }) return await request.get({ url: `/wms/locationgroup/page`, params })
} }
// 查询库位组列表
export const getLocationgroupList = async (params) => {
return await request.get({ url: `/wms/locationgroup/list`, params })
}
// 查询库位组详情 // 查询库位组详情
export const getLocationgroup = async (id: number) => { export const getLocationgroup = async (id: number) => {

28
src/views/wms/strategy/purchaseReceiptStrategy/AddForm.vue

@ -124,9 +124,6 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons'
defineOptions({ name: 'SupplieDeliveryStrategyAddForm' }) defineOptions({ name: 'SupplieDeliveryStrategyAddForm' })
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import { getSupplierList } from '@/api/wms/supplier' import { getSupplierList } from '@/api/wms/supplier'
import { getWarehouseList } from '@/api/wms/warehouse'
import { getDockList } from '@/api/wms/dock'
import { getLocationList } from '@/api/wms/location'
import * as RuleApi from '@/api/wms/rule' import * as RuleApi from '@/api/wms/rule'
@ -173,7 +170,7 @@ const formData = ref({
// //
const rules = ref({ const rules = ref({
code: [{ required: true, message: '请输入代码', trigger: 'blur' }], strategyCode: [{ required: true, message: '请输入代码', trigger: 'blur' }],
name: [{ required: true, message: '请输入名字', trigger: 'blur' }], name: [{ required: true, message: '请输入名字', trigger: 'blur' }],
description: [{ required: true, message: '请输入描述', trigger: 'blur' }], description: [{ required: true, message: '请输入描述', trigger: 'blur' }],
priority: [{ required: true, message: '请输入优先级', trigger: 'blur' }] priority: [{ required: true, message: '请输入优先级', trigger: 'blur' }]
@ -208,12 +205,7 @@ const options = reactive({
supplierRangeOptions: formatRangeOptions('IN', 'NOT IN'), supplierRangeOptions: formatRangeOptions('IN', 'NOT IN'),
// //
supplierList: [{ value: 1, label: '供应商1' }, { value: 2, label: '供应商2' }, { value: 3, label: '供应商3' }], supplierList: [{ value: 1, label: '供应商1' }, { value: 2, label: '供应商2' }, { value: 3, label: '供应商3' }],
//
warehouseList: [],
//
dockList: [],
//
locationList: [],
}) })
// //
const querySupplierParams = ref({ const querySupplierParams = ref({
@ -231,24 +223,8 @@ const changeSupplierType = (e) => {
getFormSupplierList() getFormSupplierList()
} }
//
const getFormWarehouseList = async () => {
options.warehouseList = await getWarehouseList();
}
//
const getFormDockList = async () => {
options.dockList = await getDockList();
}
//
const getFormLocationList = async () => {
options.locationList = await getLocationList({ type: 'TRANSPORT' });
}
getFormSupplierList() getFormSupplierList()
getFormWarehouseList()
getFormDockList()
getFormLocationList()
/** 打开弹窗 */ /** 打开弹窗 */
const open = async (type: string, strategyCode: string, id?: number) => { const open = async (type: string, strategyCode: string, id?: number) => {

8
src/views/wms/strategy/supplieDeliveryStrategy/AddForm.vue

@ -51,7 +51,6 @@
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.SUPPLIER_TYPE)" :key="dict.value" <el-option v-for="dict in getStrDictOptions(DICT_TYPE.SUPPLIER_TYPE)" :key="dict.value"
:label="dict.label" :value="dict.value" /> :label="dict.label" :value="dict.value" />
</el-select> </el-select>
<!-- </div> -->
</el-form-item> </el-form-item>
<!-- 供应商 --> <!-- 供应商 -->
<el-form-item v-else-if="item.ParamCode == 'SupplierCode'" label="供应商" class="err-120"> <el-form-item v-else-if="item.ParamCode == 'SupplierCode'" label="供应商" class="err-120">
@ -206,7 +205,7 @@ const formData = ref({
// //
const rules = ref({ const rules = ref({
code: [{ required: true, message: '请输入代码', trigger: 'blur' }], strategyCode: [{ required: true, message: '请输入代码', trigger: 'blur' }],
name: [{ required: true, message: '请输入名字', trigger: 'blur' }], name: [{ required: true, message: '请输入名字', trigger: 'blur' }],
description: [{ required: true, message: '请输入描述', trigger: 'blur' }], description: [{ required: true, message: '请输入描述', trigger: 'blur' }],
priority: [{ required: true, message: '请输入优先级', trigger: 'blur' }], priority: [{ required: true, message: '请输入优先级', trigger: 'blur' }],
@ -229,18 +228,17 @@ const formatRangeOptions = (...rest) => {
// //
let result = rangeOptions.filter(aItem => rest.some(bItem => aItem.value === bItem)); let result = rangeOptions.filter(aItem => rest.some(bItem => aItem.value === bItem));
return result return result
} }
// //
const options = reactive({ const options = reactive({
// //
supplierTypeRangeOptions: formatRangeOptions('=='), supplierTypeRangeOptions: formatRangeOptions('=='),
// //
supplierTypeOptions: [{ value: 1, label: '标准' }, { value: 2, label: '委外' }, { value: 3, label: '其他' }], supplierTypeOptions: [],
// //
supplierRangeOptions: formatRangeOptions('IN', 'NOT IN'), supplierRangeOptions: formatRangeOptions('IN', 'NOT IN'),
// //
supplierList: [{ value: 1, label: '供应商1' }, { value: 2, label: '供应商2' }, { value: 3, label: '供应商3' }], supplierList: [],
// //
weekRangeOptions: formatRangeOptions('IN', 'NOT IN'), weekRangeOptions: formatRangeOptions('IN', 'NOT IN'),
// //

543
src/views/wms/strategy/upShelfStrategy/AddForm.vue

@ -8,8 +8,8 @@
<div class="title">规则</div> <div class="title">规则</div>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="代码" prop="code"> <el-form-item label="代码" prop="strategyCode">
<el-input v-model="formData.code" placeholder="请输入代码" clearable /> <el-input v-model="formData.strategyCode" placeholder="请输入代码" clearable disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
@ -18,8 +18,8 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="描述" prop="describe"> <el-form-item label="描述" prop="description">
<el-input v-model="formData.describe" placeholder="请输入描述" clearable /> <el-input v-model="formData.description" placeholder="请输入描述" clearable />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -40,151 +40,136 @@
<div class="item mt-20px"> <div class="item mt-20px">
<div class="title">规则条件</div> <div class="title">规则条件</div>
<!-- 选择供应商和客户 -->
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24" v-for="(item, index) in formData.condition" :key="index">
<el-form-item label="" label-width="0" prop="supplier" class="err-240"> <!-- 选择供应商和客户 -->
<el-select v-model="formData.type" placeholder="" style="width: 110px;margin-right: 10px;"> <el-form-item label="" label-width="0" class="err-240" v-if="index == 0">
<el-option :label="item.label" :value="item.value" v-for="item in options.typeOptions" <el-select v-model="item.ParamCode" placeholder="" style="width: 110px;margin-right: 10px;"
:key="item.value" /> @change="changeSupplierCustomer">
<el-option :label="cur.label" :value="cur.value" v-for="(cur, index) in options.typeOptions"
:key="index" />
</el-select> </el-select>
<el-select v-model="formData.supplierTypeRange" placeholder="请选择范围" <el-select v-model="item.Operator" placeholder="请选择范围" style="width: 110px;;margin-right: 10px;">
style="width: 110px;;margin-right: 10px;"> <el-option :label="cur.label" :value="cur.value" v-for="cur in options.rangeOptions1"
<el-option :label="item.label" :value="item.value" v-for="item in options.rangeOptions" :key="cur.value" />
:key="item.value" />
</el-select> </el-select>
<el-select v-model="formData.supplier" placeholder="请选择供应商" style="flex: 1;" clearable> <el-select v-model="item.Value" :placeholder="`请选择${item.ParamCode == 'SupplierCode' ? '供应商' : '客户'}`"
<el-option v-for="item in options.supplierList" :key="item.value" :label="item.label" style="flex: 1;" clearable>
:value="item.value" /> <el-option v-for="cur in options.supplierList" :key="cur.id" :label="cur.name" :value="cur.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col>
<!-- 选择物品类型 --> <!-- 选择物品类型 -->
<el-col :span="24"> <el-form-item label="" label-width="0" class="err-240" v-if="index == 1">
<el-form-item label="" label-width="0" prop="item" class="err-240"> <el-select v-model="item.ParamCode" placeholder="" @change="changeItemsType"
<el-select v-model="formData.itemType" placeholder="" style="width: 110px;margin-right: 10px;"> style="width: 110px;margin-right: 10px;">
<el-option :label="item.label" :value="item.value" v-for="item in options.itemTypeOptions" <el-option :label="item.label" :value="item.value" v-for="item in options.itemTypeOptions"
:key="item.value" /> :key="item.value" />
</el-select> </el-select>
<el-select v-model="formData.itemTypeRange" placeholder="请选择范围" style="width: 110px;;margin-right: 10px;"> <el-select v-model="item.Operator" placeholder="请选择范围" style="width: 110px;;margin-right: 10px;">
<el-option :label="item.label" :value="item.value" v-for="item in options.rangeOptions" <el-option :label="cur.label" :value="cur.value" v-for="cur in options.rangeOptions1"
:key="item.value" /> :key="cur.value" />
</el-select> </el-select>
<el-select v-model="formData.item" placeholder="请选择物品" style="flex: 1;" clearable> <el-select v-model="item.Value" placeholder="请选择物品类型" style="flex: 1;" clearable
<el-option v-for="item in options.itemList" :key="item.value" :label="item.label" :value="item.value" /> v-if="item.ParamCode == 'ItemType'">
<el-option v-for="cur in getStrDictOptions(DICT_TYPE.ITEM_TYPE)" :key="cur.value" :label="cur.label"
:value="cur.value" />
</el-select> </el-select>
<el-select v-model="item.Value" placeholder="请选择ABC类" style="flex: 1;" clearable
v-else-if="item.ParamCode == 'AbcClass'">
<el-option v-for="cur in getStrDictOptions(DICT_TYPE.ABC_CLASS)" :key="cur.value" :label="cur.label"
:value="cur.value" />
</el-select>
<el-input v-model="item.Value" placeholder="请输入物品分组" clearable style="flex: 1;"
v-else-if="item.ParamCode == 'ItemGroup'" />
<el-input v-model="item.Value" placeholder="请输入项目" clearable style="flex: 1;"
v-else-if="item.ParamCode == 'Project'" />
<el-input v-model="item.Value" placeholder="请输入物品" clearable style="flex: 1;"
v-else-if="item.ParamCode == 'ItemCode'" />
</el-form-item> </el-form-item>
</el-col>
<!-- 选择重量体积还是面积 --> <!-- 选择重量体积还是面积 -->
<el-col :span="24"> <el-form-item label="" label-width="0" class="err-240" v-if="index == 2">
<el-form-item label="" label-width="0" prop="calculation" class="err-240"> <el-select v-model="item.ParamCode" placeholder="" @change="changeCalculation"
<el-select v-model="formData.calculationType" placeholder="" style="width: 110px;margin-right: 10px;"> style="width: 110px;margin-right: 10px;">
<el-option :label="item.label" :value="item.value" v-for="item in options.calculationTypeOptions" <el-option :label="cur.label" :value="cur.value" v-for="cur in options.calculationTypeOptions"
:key="item.value" /> :key="cur.value" />
</el-select>
<el-select v-model="formData.calculationTypeRange" placeholder="请选择范围"
style="width: 110px;;margin-right: 10px;">
<el-option :label="item.label" :value="item.value" v-for="item in options.rangeOptions"
:key="item.value" />
</el-select> </el-select>
<el-select v-model="formData.calculation" placeholder="请选择物品" style="flex: 1;" clearable> <el-select v-model="item.Operator" placeholder="请选择范围" style="width: 110px;;margin-right: 10px;">
<el-option v-for="item in options.calculationList" :key="item.value" :label="item.label" <el-option :label="cur.label" :value="cur.value" v-for="cur in options.rangeOptions2"
:value="item.value" /> :key="cur.value" />
</el-select> </el-select>
<el-input v-model="item.Value"
:placeholder="`请输入${item.ParamCode == 'Weight' ? '重量' : item.ParamCode == 'Area' ? '面积' : '体积'}`"
clearable style="flex: 1;" />
</el-form-item> </el-form-item>
</el-col>
<!-- 库存状态 --> <!-- 库存状态 -->
<el-col :span="24"> <el-form-item label="库存状态" class="err-120" v-if="index == 3">
<el-form-item label="库存状态" prop="inventoryStatus" class="err-120"> <el-select v-model="item.Operator" placeholder="请选择范围" style="width: 110px;;margin-right: 10px;">
<el-select v-model="formData.inventoryStatusRange" placeholder="请选择范围" <el-option :label="cur.label" :value="cur.value" v-for="cur in options.rangeOptions1"
style="width: 110px;;margin-right: 10px;"> :key="cur.value" />
<el-option :label="item.label" :value="item.value" v-for="item in options.rangeOptions"
:key="item.value" />
</el-select> </el-select>
<el-select v-model="formData.inventoryStatus" placeholder="请选择库存状态" style="flex: 1;" clearable> <el-select v-model="item.Value" placeholder="请选择库存状态" style="flex: 1;" clearable>
<el-option v-for="item in options.inventoryStatusList" :key="item.value" :label="item.label" <el-option v-for="cur in getStrDictOptions(DICT_TYPE.INVENTORY_STATUS)" :key="cur.value"
:value="item.value" /> :label="cur.label" :value="cur.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col>
<!-- 存储类型 --> <!-- 存储类型 -->
<el-col :span="24"> <el-form-item label="存储类型" class="err-120" v-if="index == 4">
<el-form-item label="存储状态" prop="storageType" class="err-120"> <el-select v-model="item.Operator" placeholder="请选择范围" style="width: 110px;;margin-right: 10px;">
<el-select v-model="formData.storageTypeRange" placeholder="请选择范围" <el-option :label="cur.label" :value="cur.value" v-for="cur in options.rangeOptions1"
style="width: 110px;;margin-right: 10px;"> :key="cur.value" />
<el-option :label="item.label" :value="item.value" v-for="item in options.rangeOptions"
:key="item.value" />
</el-select> </el-select>
<el-select v-model="formData.storageType" placeholder="请选择存储状态" style="flex: 1;" clearable> <el-select v-model="item.Value" placeholder="请选择存储类型" style="flex: 1;" clearable>
<el-option v-for="item in options.storageTypeList" :key="item.value" :label="item.label" <el-option v-for="cur in getStrDictOptions(DICT_TYPE.STORAGE_TYPE)" :key="cur.value" :label="cur.label"
:value="item.value" /> :value="cur.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col>
<!-- 库存事务 --> <!-- 库存事务 -->
<el-col :span="24"> <el-form-item label="库存事务" class="err-120" v-if="index == 5">
<el-form-item label="库存事务" prop="inventoryAffair" class="err-120"> <el-select v-model="item.Operator" placeholder="请选择范围" style="width: 110px;margin-right: 10px;">
<el-select v-model="formData.inventoryAffairRange" placeholder="请选择范围" <el-option :label="cur.label" :value="cur.value" v-for="cur in options.rangeOptions1"
style="width: 110px;;margin-right: 10px;"> :key="cur.value" />
<el-option :label="item.label" :value="item.value" v-for="item in options.rangeOptions"
:key="item.value" />
</el-select>
<el-select v-model="formData.inventoryAffair" placeholder="请选择库存事务" style="flex: 1;" clearable>
<el-option v-for="item in options.inventoryAffairList" :key="item.value" :label="item.label"
:value="item.value" />
</el-select> </el-select>
<el-input v-model="item.Value" placeholder="请输入库存事务" clearable style="flex: 1;" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<!-- 规则配置 --> <!-- 规则配置 -->
<div class="item mt-20px"> <div class="item mt-20px">
<div class="title">规则配置</div> <div class="title">规则配置</div>
<el-row> <el-row>
<!-- 仓库 库区 库位组 库位 --> <!-- 仓库 库区 库位组 库位 -->
<el-col :span="24"> <el-col :span="24" v-for="(item, index) in formData.configuration" :key="index">
<el-form-item label="" label-width="0" prop="warehouse" class="err-120"> <el-form-item label="" label-width="0" prop="warehouse" class="err-120" v-if="index == 0">
<el-select v-model="formData.warehouseType" style="width: 110px;;margin-right: 10px;"> <el-select v-model="item.ParamCode" placeholder="" style="width: 110px;margin-right: 10px;"
<el-option :label="item.label" :value="item.value" v-for="item in options.warehouseTypeOptions" @change="changeWarehouse">
:key="item.value" /> <el-option :label="cur.label" :value="cur.value" v-for="(cur, index) in options.warehouseTypeOptions"
:key="index" />
</el-select> </el-select>
<el-select v-model="formData.warehouse" placeholder="请选择库位" style="flex: 1;" clearable> <el-select v-model="item.Value" placeholder="请选择仓库" clearable style="flex: 1;">
<el-option v-for="item in options.warehouseTypeList" :key="item.value" :label="item.label" <el-option v-for="cur in options.warehouseList" :key="cur.id" :label="cur.name" :value="cur.id" />
:value="item.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col>
<!-- 优先空位库 --> <!-- 优先空位库 -->
<el-col :span="24"> <el-form-item label="优先空位库" v-else-if="index == 1">
<el-form-item label="优先空位库" prop="firstWarehouse"> <el-switch v-model="item.Value" />
<el-switch v-model="formData.firstWarehouse" />
</el-form-item> </el-form-item>
</el-col>
<!-- 优先非空位库 --> <!-- 优先非空位库 -->
<el-col :span="24"> <el-form-item label="优先非空位库" v-else-if="index == 2">
<el-form-item label="优先非空位库" prop="firstNoWarehouse"> <el-switch v-model="item.Value" />
<el-switch v-model="formData.firstNoWarehouse" />
</el-form-item> </el-form-item>
</el-col> <!-- 可以混物品 -->
<!-- 允许混物品 --> <el-form-item label="可以混物品" v-else-if="index == 3">
<el-col :span="24"> <el-switch v-model="item.Value" />
<el-form-item label="允许混合品" prop="allowMixedItems">
<el-switch v-model="formData.allowMixedItems" />
</el-form-item> </el-form-item>
</el-col> <!-- 可以混批次 -->
<!-- 允许混批次 --> <el-form-item label="可以混批次" v-else-if="index == 4">
<el-col :span="24"> <el-switch v-model="item.Value" />
<el-form-item label="允许混批次" prop="allowMixedBatch">
<el-switch v-model="formData.allowMixedBatch" />
</el-form-item> </el-form-item>
</el-col> <!-- 可以混状态 -->
<!-- 允许混状态 --> <el-form-item label="可以混状态" v-else-if="index == 5">
<el-col :span="24"> <el-switch v-model="item.Value" />
<el-form-item label="允许混状态" prop="allowMixedStatus">
<el-switch v-model="formData.allowMixedStatus" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -200,6 +185,15 @@
<script setup lang="ts"> <script setup lang="ts">
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
defineOptions({ name: 'UpShelfStrategyAddForm' }) defineOptions({ name: 'UpShelfStrategyAddForm' })
import { getSupplierList } from '@/api/wms/supplier'
import { getCustomerList } from '@/api/wms/customer'
import { getWarehouseList } from '@/api/wms/warehouse'
import { getAreaList } from '@/api/wms/areabasic'
import { getLocationgroupList } from '@/api/wms/locationgroup'
import { getLocationList } from '@/api/wms/location'
import * as RuleApi from '@/api/wms/rule'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
@ -208,105 +202,201 @@ const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // const dialogTitle = ref('') //
const formLoading = ref(false) // 12 const formLoading = ref(false) // 12
const formType = ref('') // create - update - const formType = ref('') // create - update -
const formRef1 = ref() // Ref const formRef = ref() // Ref
const formRef2 = ref() // Ref
const formRef3 = ref() // Ref
const formStrategyCode = ref('')
// form // form
const formData = ref({ const formData = ref({
code: '',// id: '',
strategyCode: formStrategyCode.value,//id
name: '',// name: '',//
describe: '',// description: '',//
priority: '',// priority: '',//
status: false,// status: true,//
// //
type: 1,// condition: [
supplierTypeRange: 1,// //
supplier: '',// { ParamCode: 'SupplierCode', Operator: "IN", Value: "" },
// ///abc//
// { ParamCode: 'ItemType', Operator: "IN", Value: "" },
itemType: 1,// // //
itemTypeRange: 1, // { ParamCode: 'Weight', Operator: ">", Value: [] },
item: '',//
//
calculationType: 1,//
calculationTypeRange: 1, //
calculation: '',//
// //
inventoryStatusRange: 1, // { ParamCode: 'InventoryStatus', Operator: "IN", Value: [] },
inventoryStatus: '',// //
{ ParamCode: 'StorageType', Operator: "IN", Value: [] },
//
storageTypeRange: 1, //
storageType: '',//
// //
inventoryAffairRange: 1, // { ParamCode: 'TransactionType', Operator: "IN", Value: [] }
inventoryAffair: '',// ],
configuration: [
//
{ ParamCode: 'WarehouseCode', Value: "" },
//
{ ParamCode: 'EmptyLocationFirst', Value: false },
//
{ ParamCode: 'NotEmptyLocationFirst', Value: false },
//
{ ParamCode: 'EnableMixItem', Value: true },
//
{ ParamCode: 'EnableMixLot', Value: true },
//
{ ParamCode: 'EnableMixStatus', Value: true },
]
//
warehouseType: 1,/////
warehouse: '',/////
firstWarehouse: false,//
firstNoWarehouse: false,//
allowMixedItems: false,//
allowMixedBatch: false,//
allowMixedStatus: false,//
}) })
// //
const rules = ref({ const rules = ref({
code: [{ required: true, message: '请输入代码', trigger: 'blur' }], strategyCode: [{ required: true, message: '请输入代码', trigger: 'blur' }],
name: [{ required: true, message: '请输入名字', trigger: 'blur' }], name: [{ required: true, message: '请输入名字', trigger: 'blur' }],
describe: [{ required: true, message: '请输入描述', trigger: 'blur' }], description: [{ required: true, message: '请输入描述', trigger: 'blur' }],
priority: [{ required: true, message: '请输入优先级', trigger: 'blur' }], priority: [{ required: true, message: '请输入优先级', trigger: 'blur' }],
supplier: [{ required: true, message: '请选择供应商', trigger: 'blur' }],
item: [{ required: true, message: '请选择物品', trigger: 'blur' }],
calculation: [{ required: true, message: '请选择', trigger: 'blur' }],
inventoryStatus: [{ required: true, message: '请选择库存状态', trigger: 'blur' }],
storageType: [{ required: true, message: '请选择存储类型', trigger: 'blur' }],
inventoryAffair: [{ required: true, message: '请选择库存事务', trigger: 'blur' }],
warehouse: [{ required: true, message: '请选择仓库', trigger: 'blur' }],
}) })
//
const rangeOptions = [
{ value: '==', label: '等于' },
{ value: '!=', label: '不等于' },
{ value: '>', label: '大于' },
{ value: '<', label: '小于' },
{ value: '>=', label: '大于等于' },
{ value: '<=', label: '小于等于' },
{ value: 'IN', label: '包含' },
{ value: 'NOT IN', label: '不包含' },
{ value: 'NULL', label: '为空' },
{ value: 'NOT NULL', label: '不为空' },
]
const formatRangeOptions = (...rest) => {
//
let result = rangeOptions.filter(aItem => rest.some(bItem => aItem.value === bItem));
return result
}
// //
const options = reactive({ const options = reactive({
//
rangeOptions1: formatRangeOptions('IN', 'NOT IN'),
rangeOptions2: formatRangeOptions('>', '<', '>=', '<='),
// //
typeOptions: [{ value: 1, label: '供应商' }, { value: 2, label: '客户' }], typeOptions: [{ value: 'SupplierCode', label: '供应商' }, { value: 'CustomerCode', label: '客户' }],
//
rangeOptions: [{ value: 1, label: '包含' }, { value: 2, label: '大于', }],
// //
supplierList: [{ value: 1, label: '供应商1' }, { value: 2, label: '供应商2' }, { value: 3, label: '供应商3' }], supplierList: [],
// //
itemTypeOptions: [{ value: 1, label: '物品分类' }, { value: 2, label: '物品分组' }, { value: 3, label: '物品' }, { value: 4, label: '项目' }, { value: 5, label: 'ABC类' }], itemTypeOptions: [{ value: 'ItemType', label: '物品类型' }, { value: 'ItemGroup', label: '物品分组' }, { value: 'ItemCode', label: '物品' }, { value: 'Project', label: '项目' }, { value: 'AbcClass', label: 'ABC类' }],
//
itemList: [{ value: 1, label: '物品1' }, { value: 2, label: '物品2' }, { value: 3, label: '物品3' }],
// //
calculationTypeOptions: [{ value: 1, label: '重量' }, { value: 2, label: '体积' }, { value: 3, label: '面积' }], calculationTypeOptions: [{ value: 'Weight', label: '重量' }, { value: 'Volume', label: '体积' }, { value: 'Area', label: '面积' }],
//
calculationList: [{ value: 1, label: '重量1' }, { value: 2, label: '重量2' }, { value: 3, label: '重量3' }], warehouseTypeOptions: [{ value: 'WarehouseCode', label: '仓库' }, { value: 'AreaCode', label: '库区' }, { value: 'LocationGroupCode', label: '库位组' }, { value: 'LocationCode', label: '库位' }],
// //
inventoryStatusList: [{ value: 1, label: '库存状态1' }, { value: 2, label: '库存状态2' }, { value: 3, label: '库存状态3' }], warehouseList: [],
//
storageTypeList: [{ value: 1, label: '存储状态1' }, { value: 2, label: '存储状态2' }, { value: 3, label: '存储状态3' }],
//
inventoryAffairList: [{ value: 1, label: '库存事务1' }, { value: 2, label: '库存事务2' }, { value: 3, label: '库存事务3' }],
//
warehouseTypeOptions: [{ value: 1, label: '仓库' }, { value: 2, label: '库区' }, { value: 3, label: '库位组' }, { value: 4, label: '库位' }],
//
warehouseTypeList: [{ value: 1, label: '仓库1' }, { value: 2, label: '仓库2' }, { value: 3, label: '仓库3' }],
}) })
//
const getFormSupplierList = async () => {
options.supplierList = await getSupplierList();
}
//
const getFormCustomerList = async () => {
options.supplierList = await getCustomerList();
}
//
const changeSupplierCustomer = (e) => {
formData.value.condition[0].Value = ''
if (e == 'CustomerCode') {
getFormCustomerList()
} else if (e == 'SupplierCode') {
getFormSupplierList()
}
}
getFormSupplierList()
// //abc//
const changeItemsType = () => {
formData.value.condition[1].Value = ''
}
// //
const changeCalculation = () => {
formData.value.condition[2].Value = ''
}
//
const getFormWarehouseList = async () => {
options.warehouseList = await getWarehouseList();
}
getFormWarehouseList()
//
const getFormAreaList = async () => {
options.warehouseList = await getAreaList();
}
getFormWarehouseList()
//
const getFormLocationgrouList = async () => {
options.warehouseList = await getLocationgroupList();
}
getFormWarehouseList()
//
const getFormLocationList = async () => {
options.warehouseList = await getLocationList();
}
getFormWarehouseList()
// ///
const changeWarehouse = (e) => {
formData.value.configuration[0].Value = ''
if (e == 'WarehouseCode') {
getFormWarehouseList()
} else if (e == 'AreaCode') {
getFormAreaList()
} else if (e == 'LocationGroupCode') {
getFormLocationgrouList()
} else if (e == 'LocationCode') {
getFormLocationList()
}
}
/** 打开弹窗 */ /** 打开弹窗 */
const open = async (type: string, id?: number) => { const open = async (type: string, strategyCode: string, id?: number) => {
formStrategyCode.value = strategyCode
dialogVisible.value = true dialogVisible.value = true
dialogTitle.value = t('action.' + type) dialogTitle.value = t('action.' + type)
formType.value = type formType.value = type
resetForm() resetForm()
// //
if (id) {
formLoading.value = true
try {
let data = await RuleApi.getRule(id)
formData.value.id = data.id
formData.value.strategyCode = data.strategyCode
formData.value.name = data.name
formData.value.description = data.description
formData.value.priority = data.priority
formData.value.status = data.status == 1 ? true : false
if (data.condition) {
formData.value.condition = JSON.parse(data.condition)
}
if (data.configuration) {
formData.value.configuration = JSON.parse(data.configuration)
}
//
if(formData.value.condition[0].ParamCode == 'SupplierCode'){
getFormSupplierList()
}else{
getFormCustomerList()
}
// ///
if (formData.value.configuration[0].ParamCode == 'WarehouseCode') {
getFormWarehouseList()
} else if (formData.value.configuration[0].ParamCode == 'AreaCode') {
getFormAreaList()
} else if (formData.value.configuration[0].ParamCode == 'LocationGroupCode') {
getFormLocationgrouList()
} else if (formData.value.configuration[0].ParamCode == 'LocationCode') {
getFormLocationList()
}
} finally {
formLoading.value = false
}
}
} }
defineExpose({ open }) // open defineExpose({ open }) // open
@ -314,58 +404,77 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
const emit = defineEmits(['success']) // success const emit = defineEmits(['success']) // success
const submitForm = async () => { const submitForm = async () => {
// //
if (!formRef1 || !formRef2 || !formRef3) return if (!formRef) return
const valid2 = formRef2.value.validate() const valid = await formRef.value.validate()
const valid1 = formRef1.value.validate() if (!valid) return
const valid3 = await formRef3.value.validate()
if (!valid1 || !valid2 || !valid3) return
// //
formLoading.value = true formLoading.value = true
try {
let data = {
id: formData.value.id,
strategyCode: formData.value.strategyCode,//
name: formData.value.name,//
description: formData.value.description,//
priority: formData.value.priority,//
status: formData.value.status ? 1 : 0,//
//
condition: JSON.stringify(formData.value.condition),
configuration: JSON.stringify(formData.value.configuration)
}
if (formType.value === 'create') {
await RuleApi.createRule(data)
message.success(t('common.createSuccess'))
} else {
await RuleApi.updateRule(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
} }
/** 重置表单 */ /** 重置表单 */
const resetForm = () => { const resetForm = () => {
formData.value = { formData.value = {
code: '', id: '',
name: '', strategyCode: formStrategyCode.value,//id
describe: '', name: '',//
priority: '', description: '',//
status: false, priority: '',//
// status: true,//
type: 1,// //
supplierTypeRange: 1,// condition: [
supplier: '',// //
// { ParamCode: 'SupplierCode', Operator: "IN", Value: "" },
itemType: 1,// // ///abc//
itemTypeRange: 1, // { ParamCode: 'ItemType', Operator: "IN", Value: "" },
item: '',// // ///
// { ParamCode: 'Weight', Operator: ">", Value: [] },
calculationType: 1,//
calculationTypeRange: 1, //
calculation: '',//
// //
inventoryStatusRange: 1, // { ParamCode: 'InventoryStatus', Operator: "IN", Value: [] },
inventoryStatus: '',// //
{ ParamCode: 'StorageType', Operator: "IN", Value: [] },
//
storageTypeRange: 1, //
storageType: '',//
// //
inventoryAffairRange: 1, // { ParamCode: 'TransactionType', Operator: "IN", Value: [] }
inventoryAffair: '',// ],
// configuration: [
warehouseType: 1,///// //
warehouse: '',///// { ParamCode: 'WarehouseCode', Value: "" },
//
firstWarehouse: false,// { ParamCode: 'EmptyLocationFirst', Value: false },
firstNoWarehouse: false,// //
allowMixedItems: false,// { ParamCode: 'NotEmptyLocationFirst', Value: false },
allowMixedBatch: false,// //
allowMixedStatus: false,// { ParamCode: 'EnableMixItem', Value: true },
//
{ ParamCode: 'EnableMixLot', Value: true },
//
{ ParamCode: 'EnableMixStatus', Value: true },
]
} }
} }

85
src/views/wms/strategy/upShelfStrategy/index.vue

@ -1,28 +1,88 @@
<!-- 上架策略 -->
<!-- 供应商送货策略 -->
<template> <template>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @buttonBaseClick="buttonBaseClick" /> <TableHead :HeadButttondata="HeadButttondata" @buttonBaseClick="buttonBaseClick" />
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list">
<el-table-column align="center" label="策略代码" prop="strategyCode" />
<el-table-column align="center" label="策略名称" prop="name" show-overflow-tooltip />
<el-table-column align="center" label="策略描述" prop="description" />
<el-table-column align="center" label="优先级" prop="priority" />
<el-table-column align="center" label="状态" prop="status">
<template #default="scope">
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status ? 0 : 1" />
</template>
</el-table-column>
<el-table-column align="center" label="操作" fixed="right" width="240">
<template #default="scope">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, scope.row)" />
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNo" :total="total"
@pagination="getList" />
</ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<AddForm ref="formRef" @success="getList" /> <AddForm ref="formRef" @success="getList" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { DICT_TYPE } from '@/utils/dict'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import * as RuleApi from '@/api/wms/rule'
import AddForm from './AddForm.vue' import AddForm from './AddForm.vue'
// import { dateFormatter } from '@/utils/formatTime'
defineOptions({ name: 'SupplieDeliveryStrategy' })
const { t } = useI18n() //
const message = useMessage() //
const loading = ref(true) //
const total = ref(0) //
const list = ref([]) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
strategyCode: 'S005',
})
/** 查询字典类型列表 */
const getList = async () => {
loading.value = true
try {
const data = await RuleApi.getRulePage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
defineOptions({ name: 'UpShelfStrategy' })
// //
const formRef = ref() const formRef = ref()
const openForm = (type: string) => { const openForm = (type: string, strategyCode: string, id: number) => {
formRef.value.open(type) formRef.value.open(type, strategyCode, id)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await RuleApi.deleteRule(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch { }
} }
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn(null), // defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultImportBtn(null), //
defaultButtons.defaultExportBtn(null), //
// defaultButtons.defaultFilterBtn(), //
defaultButtons.defaultFreshBtn(null), //
] ]
@ -30,7 +90,7 @@ const HeadButttondata = [
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'add') { //
openForm('create') openForm('create', queryParams.strategyCode)
} else if (val == 'import') { // } else if (val == 'import') { //
handleImport() handleImport()
} else if (val == 'export') { // } else if (val == 'export') { //
@ -52,10 +112,15 @@ const butttondata = [
// - // -
const buttonTableClick = (val, row) => { const buttonTableClick = (val, row) => {
if (val == 'edit') { // if (val == 'edit') { //
openForm('update', row.id) openForm('update', queryParams.strategyCode, row.id)
} else if (val == 'delete') { // } else if (val == 'delete') { //
handleDelete(row.id) handleDelete(row.id)
} }
} }
/** 初始化 **/
onMounted(() => {
getList()
})
</script> </script>

Loading…
Cancel
Save