Browse Source

检测策略,库位存储策略新增中加搜索

intex
zhang_li 2 days ago
parent
commit
da76cfd58d
  1. 146
      src/views/wms/basicDataManage/strategySetting/strategy/inspectStrategy/AddForm.vue
  2. 280
      src/views/wms/basicDataManage/strategySetting/strategy/warehouseStorageStrategy/AddForm.vue

146
src/views/wms/basicDataManage/strategySetting/strategy/inspectStrategy/AddForm.vue

@ -107,7 +107,7 @@
:key="'供应商option'+cur.value"
/>
</el-select>
<el-select :key="'供应商Value'+index"
<!-- <el-select :key="'供应商Value'+index"
v-model="item.Value"
placeholder="请选择供应商"
style="flex: 1"
@ -120,7 +120,14 @@
:label="cur.name"
:value="cur.code"
/>
</el-select>
</el-select> -->
<el-input key="供应商和客户Value" style="flex:1" placeholder="请选择客户" v-model="item.Value" @blur="blurWarehouse({module:'condition',type:'SupplierCode'})">
<template #suffix>
<el-button :disabled="formData.priority==0&&formType=='update'" type="text" plain style="color:var(--el-button-text-color)" @click.stop="searchList('SupplierCode')">
<Icon icon="ep:search" class="mr-5px" />
</el-button>
</template>
</el-input>
</el-form-item>
<!-- 物料 -->
<el-form-item :key="'物料formItem'+index" v-else-if="index == 2" label="物料" class="flex-top err-120">
@ -137,13 +144,20 @@
:key="'供应商OperatorOption'+cur.value"
/>
</el-select>
<el-input :key="'供应商Value'+index"
<!-- <el-input :key="'供应商Value'+index"
v-model="item.Value"
placeholder="请输入物料,多个物料以逗号分隔"
clearable
style="flex: 1"
:disabled="formData.priority==0&&formType=='update'"
/>
/> -->
<el-input key="物料Value" style="flex:1" placeholder="请选择物料" v-model="item.Value" @blur="blurWarehouse({module:'condition',type:'ItemCode'})">
<template #suffix>
<el-button :disabled="formData.priority==0&&formType=='update'" type="text" plain style="color:var(--el-button-text-color)" @click.stop="searchList('ItemCode')">
<Icon icon="ep:search" class="mr-5px" />
</el-button>
</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
@ -252,6 +266,10 @@
<TableHead :HeadButttondata="Butttondata" @buttonBaseClick="buttonBaseClick" />
</template>
</Dialog>
<SearchTable
ref="searchTableRef"
@searchTableSuccess="searchTableSuccess"
/>
</template>
<script setup lang="ts">
import * as defaultButtons from '@/utils/disposition/defaultButtons'
@ -260,6 +278,10 @@ import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import { getSupplierList } from '@/api/wms/supplier'
import * as RuleApi from '@/api/wms/rule'
import * as SupplierApi from '@/api/wms/supplier'
import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import * as ItembasicApi from '@/api/wms/itembasic'
import { Itembasic} from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
const { t } = useI18n() //
const message = useMessage() //
@ -588,6 +610,122 @@ const inputNumberBlur = () => {
formData.value.configurationRules = '1'
}
}
const warehouseType = ref()
const blurWarehouse = async ({module='config',type})=>{
//
let warehouseValue = formData.value.configuration[warehouseType.value]
let conditionObj = null
if(module=='condition'){
//
conditionObj = formData.value.condition.find(item=>item['ParamCode']==type)
if(conditionObj){
warehouseValue = conditionObj['Value']
}
}
if(!warehouseValue){
return
}
let verifyRes = []
if(module=='condition'&&type=='SupplierCode' || module=='config'&&warehouseType.value == 'SupplierCode'){
//
verifyRes = await SupplierApi.getSupplierListByCodes({
codes:warehouseValue
})
console.log('供应商verifyRes',verifyRes)
}else if(module=='condition'&&type=='ItemCode' || module=='config'&&warehouseType.value == 'ItemCode'){
//
verifyRes = await ItembasicApi.getItemListByCodes({
codes:warehouseValue
})
console.log('物料verifyRes',verifyRes)
}
if(verifyRes&&verifyRes.length>0){
let verifyList = verifyRes.map(item=>(item['code']))
if(module=='condition'){
//
let codeList = warehouseValue.split(',')
conditionObj['Value'] = codeList.filter(item=>verifyList.indexOf(item)>-1).join(',')
const str = codeList.filter(item => verifyList.indexOf(item) == -1).join(',')
if (str) {
message.alert('代码' + str + '没有找到对应数据')
}
}else{
//
let codeList = formData.value.configuration[warehouseType.value].split(',')
formData.value.configuration[warehouseType.value] = codeList.filter(item=>verifyList.indexOf(item)>-1).join(',')
const str = codeList.filter(item => verifyList.indexOf(item) == -1).join(',')
if (str) {
message.alert('代码' + str + '没有找到对应数据')
}
}
}else{
if(module=='condition'){
message.alert('代码' + conditionObj['Value'] + '没有找到对应数据')
//
conditionObj['Value'] = ''
}else{
message.alert('代码' + formData.value.configuration[warehouseType.value] + '没有找到对应数据')
formData.value.configuration[warehouseType.value] = ''
}
}
if(module!='condition'){
let fields = ['WarehouseCode','AreaCode','LocationGroupCode','LocationCode']
fields.forEach(item=>{
if(item!=warehouseType.value){
formData.value.configuration[item] = ''
}
})
}
}
//
const searchTableRef = ref()
const searchList = (type) => {
if (type == 'SupplierCode') {
searchTableRef.value.open(
'请选择供应商',
Supplier.allSchemas,
SupplierApi.getSupplierPage,
'SupplierCode',
'code',
true,
undefined,
undefined,
undefined
)
}else if (type == 'ItemCode') {
searchTableRef.value.open(
'请选择物料',
Itembasic.allSchemas,
ItembasicApi.getItembasicPage,
'ItemCode',
'code',
true,
undefined,
undefined,
undefined
)
}
}
const searchTableSuccess = (formField, searchField, val, type, row) => {
if(formField=='SupplierCode' || formField=='ItemCode'){
let transactionType = formData.value.condition.find(item=>item['ParamCode']== formField)
if(transactionType){
transactionType.Value = val.map(item=>(item['code'])).join(',')
}
return
}
formData.value.configuration[warehouseType.value] = val.map(item=>(item['code'])).join(',')
let fields = ['WarehouseCode','AreaCode','LocationGroupCode','LocationCode']
fields.forEach(item=>{
if(item!=warehouseType.value){
formData.value.configuration[item] = ''
}
})
}
</script>
<style scoped lang="scss">
.item {

280
src/views/wms/basicDataManage/strategySetting/strategy/warehouseStorageStrategy/AddForm.vue

@ -54,21 +54,21 @@
<el-col :span="24" v-for="(item, index) in formData.condition" :key="'规则条件col'+index">
<!-- 仓库 库区 库位组 库位 -->
<el-form-item :key="'规则条件formItem'+index" label="" label-width="0" class="err-130" v-if="index == 0">
<el-select :key="'规则条件select'+index"
<el-select key="仓库条件"
v-model="item.ParamCode"
placeholder=""
style="width: 120px; margin-right: 10px"
@change="changeWarehouse"
style="width: 110px; margin-right: 10px"
:disabled="formData.priority==0&&formType=='update'"
@change="item.Value = ''"
>
<el-option
:label="cur.label"
:label= "cur.label"
:value="cur.value"
v-for="(cur, index) in options.warehouseTypeOptions"
:key="'规则条件option'+index"
:key="'仓库'+cur.value"
/>
</el-select>
<el-select :key="'请选择范围select'+index"
<el-select key="供应商和客户Operator"
v-model="item.Operator"
placeholder="请选择范围"
style="width: 110px; margin-right: 10px"
@ -78,35 +78,44 @@
:label="cur.label"
:value="cur.value"
v-for="cur in options.RangeOptions"
:key="'选择范围option'+cur.value"
/>
</el-select>
<el-select :key="'规则条件Value'+index"
v-model="item.Value"
:placeholder="`请选择${
item.ParamCode == 'WarehouseCode'
? '仓库'
: item.ParamCode == 'AreaCode'
? '库区'
: item.ParamCode == 'LocationGroupCode'
? '库位组'
: item.ParamCode == 'LocationCode'
? '库位'
: ''
}`"
clearable
style="flex: 1"
multiple
collapse-tags
:disabled="formData.priority==0&&formType=='update'"
>
<el-option
v-for="cur in options.warehouseList"
:key="'规则条件option'+cur.code"
:label="cur.code"
:value="cur.code"
:key="'供应商和客户Operator'+cur.value"
/>
</el-select>
<!-- 仓库 -->
<el-input style="flex:1" v-show="item.ParamCode == 'WarehouseCode'" placeholder="请选择从仓库" v-model="item.Value" @blur="blurWarehouse({module:'condition',type:'WarehouseCode'})" :disabled="formData.priority==0&&formType=='update'">
<template #suffix>
<el-button type="text" plain style="color:var(--el-button-text-color)" @click.stop="searchWarehouse({module:'condition',type:'WarehouseCode'})">
<Icon icon="ep:search" class="mr-5px" />
</el-button>
</template>
</el-input>
<!-- 库区 -->
<el-input style="flex:1" v-show="item.ParamCode == 'AreaCode'" placeholder="请选择从库区" v-model="item.Value" @blur="blurWarehouse({module:'condition',type:'AreaCode'})">
<template #suffix>
<el-button type="text" plain style="color:var(--el-button-text-color)" @click="searchWarehouse({module:'condition',type:'AreaCode'})">
<Icon icon="ep:search" class="mr-5px" />
</el-button>
</template>
</el-input>
<!-- 库位组 -->
<el-input style="flex:1" v-show="item.ParamCode == 'LocationGroupCode'" placeholder="请选择从库位组" v-model="item.Value" @blur="blurWarehouse({module:'condition',type:'LocationGroupCode'})">
<template #suffix>
<el-button type="text" plain style="color:var(--el-button-text-color)" @click="searchWarehouse({module:'condition',type:'LocationGroupCode'})">
<Icon icon="ep:search" class="mr-5px" />
</el-button>
</template>
</el-input>
<!-- 库位 -->
<el-input style="flex:1" v-show="item.ParamCode == 'LocationCode'" placeholder="请选择从库位" v-model="item.Value" @blur="blurWarehouse({module:'condition',type:'LocationCode'})">
<template #suffix>
<el-button type="text" plain style="color:var(--el-button-text-color)" @click="searchWarehouse({module:'condition',type:'LocationCode'})">
<Icon icon="ep:search" class="mr-5px" />
</el-button>
</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
@ -231,14 +240,24 @@
<TableHead :HeadButttondata="Butttondata" @buttonBaseClick="buttonBaseClick" />
</template>
</Dialog>
<SearchTable
ref="searchTableRef"
@searchTableSuccess="searchTableSuccess"
/>
</template>
<script setup lang="ts">
import * as defaultButtons from '@/utils/disposition/defaultButtons'
defineOptions({ name: 'UpShelfStrategyAddForm' })
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 WarehouseApi from '@/api/wms/warehouse'
import { Warehouse } from '@/views/wms/basicDataManage/factoryModeling/warehouse/warehouse.data'
import * as AreaApi from '@/api/wms/areabasic'
import { Area } from '@/views/wms/basicDataManage/factoryModeling/areabasic/areabasic.data'
import * as LocationgroupApi from '@/api/wms/locationgroup'
import { Locationgroup } from '@/views/wms/basicDataManage/factoryModeling/locationgroup/locationgroup.data'
import * as LocationApi from '@/api/wms/location'
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data'
import * as RuleApi from '@/api/wms/rule'
import { isString } from '@/utils/is'
@ -461,6 +480,193 @@ const open = async (type: string, strategyCode: string, id?: number) => {
]
}
}
const searchTableRef = ref()
const searchTableModule = ref('') // 条件 / 配置
const searchWarehouse = ({module='config',type})=>{
searchTableModule.value = module
// module: config condition
if( module=='condition'&&type=='WarehouseCode' || module=='config'&&warehouseType.value == 'WarehouseCode'){
//
searchTableRef.value.open(
'请选择仓库',
Warehouse.allSchemas,
WarehouseApi.getWarehousePage,
'WarehouseCode',
'code',
true,
undefined,
undefined,
undefined
)
}else if(module=='condition'&&type=='AreaCode' || module=='config'&&warehouseType.value == 'AreaCode'){
searchTableRef.value.open(
'请选择库区',
Area.allSchemas,
AreaApi.getAreaPage,
'WarehouseCode',
'code',
true,
undefined,
undefined,
undefined
)
}else if(module=='condition'&&type=='LocationGroupCode' || module=='config'&&warehouseType.value == 'LocationGroupCode'){
searchTableRef.value.open(
'请选择库位组',
Locationgroup.allSchemas,
LocationgroupApi.getLocationgroupPage,
'WarehouseCode',
'code',
true,
undefined,
undefined,
undefined
)
}else if(module=='condition'&&type=='LocationCode' || module=='config'&&warehouseType.value == 'LocationCode'){
searchTableRef.value.open(
'请选择库位',
Location.allSchemas,
LocationApi.getLocationPage,
'WarehouseCode',
'code',
true,
undefined,
undefined,
undefined
)
}
}
const warehouseType = ref('')
const blurWarehouse = async ({module='config',type})=>{
//
let warehouseValue = formData.value.configuration[warehouseType.value]
let conditionObj = null
if(module=='condition'){
//
conditionObj = formData.value.condition.find(item=>item['ParamCode']==type)
if(conditionObj){
warehouseValue = conditionObj['Value']
}
// { value: 'WarehouseCode', label: '' },
// { value: 'AreaCode', label: '' },
// { value: 'LocationGroupCode', label: '' },
// { value: 'LocationCode', label: '' }
}
if(!warehouseValue){
return
}
let verifyRes = []
console.log(222,warehouseValue)
if(module=='condition'&&type=='WarehouseCode' || module=='config'&&warehouseType.value == 'WarehouseCode'){
//
verifyRes = await WarehouseApi.verifyWarehouse({
code:warehouseValue
})
console.log('仓库verifyRes',verifyRes)
}else if(module=='condition'&&type=='AreaCode' || module=='config'&&warehouseType.value == 'AreaCode'){
//
verifyRes = await AreaApi.verifyAreaList({
code:warehouseValue
})
console.log('库区verifyRes',verifyRes)
}else if(module=='condition'&&type=='LocationGroupCode' || module=='config'&&warehouseType.value == 'LocationGroupCode'){
//
verifyRes = await LocationgroupApi.verifyLocationgroup({
code:warehouseValue
})
console.log('库位组verifyRes',verifyRes)
}else if(module=='condition'&&type=='LocationCode' || module=='config'&&warehouseType.value == 'LocationCode'){
//
verifyRes = await LocationApi.verifyLocation({
code:warehouseValue
})
console.log('库位verifyRes',verifyRes)
}
if(verifyRes&&verifyRes.length>0){
let verifyList = verifyRes.map(item=>(item['code']))
if(module=='condition'){
//
let codeList = warehouseValue.split(',')
conditionObj['Value'] = codeList.filter(item=>verifyList.indexOf(item)>-1).join(',')
const str = codeList.filter(item => verifyList.indexOf(item) == -1).join(',')
if (str) {
message.alert('代码' + str + '没有找到对应数据')
}
}else{
//
let codeList = formData.value.configuration[warehouseType.value].split(',')
formData.value.configuration[warehouseType.value] = codeList.filter(item=>verifyList.indexOf(item)>-1).join(',')
const str = codeList.filter(item => verifyList.indexOf(item) == -1).join(',')
if (str) {
message.alert('代码' + str + '没有找到对应数据')
}
}
}else{
if(module=='condition'){
message.alert('代码' + conditionObj['Value'] + '没有找到对应数据')
//
conditionObj['Value'] = ''
}else{
message.alert('代码' + formData.value.configuration[warehouseType.value] + '没有找到对应数据')
formData.value.configuration[warehouseType.value] = ''
}
}
if(module!='condition'){
let fields = ['WarehouseCode','AreaCode','LocationGroupCode','LocationCode']
fields.forEach(item=>{
if(item!=warehouseType.value){
formData.value.configuration[item] = ''
}
})
}
}
const searchTableSuccess = (formField, searchField, val, type, row) => {
// let searchTableTitle = warehouseType.value == 'WarehouseCode'?'':warehouseType.value == 'AreaCode'?'':warehouseType.value == 'LocationGroupCode'?'':warehouseType.value == 'LocationCode'?'':''
console.log('searchTableSuccess',formField, searchField, val, type, row)
console.log(val.map(item=>(item['code'])).join(','))
// if(formField=='BusinessType'){
// let BusinessType = formData.value.condition.find(item=>item['ParamCode']=='BusinessType')
// if(BusinessType){
// BusinessType.Value = val.map(item=>(item['code'])).join(',')
// }
// return
// }else
if(formField=='BusinessType'){
console.log('condition',formData.value.condition)
let businessType = formData.value.condition.find(item=>item['ParamCode']=='BusinessType')
console.log('businessType',businessType)
if(businessType){
businessType.Value = val.map(item=>(item['code'])).join(',')
}
return
}else if(searchTableModule.value == 'condition'){
// module: config condition
//
let conditionObj = formData.value.condition.find(item=>['WarehouseCode','AreaCode','LocationGroupCode','LocationCode'].includes(item['ParamCode']))
conditionObj['Value'] = val.map(item=>(item['code'])).join(',')
}else{
//
//
formData.value.configuration[warehouseType.value] = val.map(item=>(item['code'])).join(',')
let fields = ['WarehouseCode','AreaCode','LocationGroupCode','LocationCode']
fields.forEach(item=>{
if(item!=warehouseType.value){
formData.value.configuration[item] = ''
}
})
}
}
defineExpose({ open }) // open
/** 提交表单 */

Loading…
Cancel
Save