Browse Source

隔离退料申请、生产退料申请,批量添加同一工位提示代码已存在,添加明细可以多次添加同一库位

hella_online_20240829
zhang_li 4 months ago
parent
commit
2b44edc47d
  1. 3
      README.md
  2. 67
      src/api/wms/business/inputBlur.ts
  3. 1
      src/views/wms/issueManage/productionreturn/productionreturnRequestMain/productionreturnRequestMain.data.ts
  4. 1
      src/views/wms/issueManage/productionreturn/productionreturnRequestMainNo/productionreturnRequestMainNo.data.ts

3
README.md

@ -48,6 +48,7 @@ form: {
isMainValue: false // 表示查询条件不是主表的字段的值
}
],
isRepeat: true,//是否可以重复添加该条数据
// 失去焦点校验参数
verificationParams: [{
key: 'code',
@ -55,7 +56,7 @@ form: {
value: '',
isMainValue: false,
isSearch: 'true',
isFormModel: true
isFormModel: true,
}]
}
}

67
src/api/wms/business/inputBlur.ts

@ -742,15 +742,14 @@ export const FormBlur = async (field, val, routeName, formRef, detailData, formS
// 根据下方输入框失去焦点校验信息
export const getListByBottonInput = async (headerItem, val, row, routeName, formRef, detailData, tableData, callback) => {
let tableFormSchemaObj = headerItem?.tableForm
const tableFormSchemaObj = headerItem?.tableForm
console.log(333, tableFormSchemaObj)
if (tableFormSchemaObj.searchPage && tableFormSchemaObj.verificationParams) {
if (!val) return;
let params = ref({})
let list = ref([])
console.log(3344)
let searchCondition1 = headerItem.tableForm.searchCondition //获取data.ts参数信息
let verificationParams = headerItem.tableForm.verificationParams //获取data.ts参数信息
const params = ref({})
const list = ref([])
const searchCondition1 = headerItem.tableForm.searchCondition //获取data.ts参数信息
const verificationParams = headerItem.tableForm.verificationParams //获取data.ts参数信息
// 循环参数设置参数为key:value格式
if (searchCondition1 && searchCondition1.length > 0) {
for (let i = 0; i < searchCondition1.length; i++) {
@ -813,7 +812,6 @@ export const getListByBottonInput = async (headerItem, val, row, routeName, form
}
}
}
console.log(999, verificationParams)
if (verificationParams && verificationParams.length > 0) {
for (let i = 0; i < verificationParams.length; i++) {
console.log(54565, verificationParams[i].key)
@ -821,23 +819,10 @@ export const getListByBottonInput = async (headerItem, val, row, routeName, form
params.value[verificationParams[i].key1] = val
}
}
await tableFormSchemaObj.verificationPage(params.value).then(async (res) => {
list.value = res ? res : []
let arr1 = val.split(',').map(item => item.trim())
if (arr1.length != res.length) {
let arr2 = res.map((item) => item[headerItem.tableForm.searchField])
let str = [
...arr1.filter((item) => !arr2.includes(item)),
...arr2.filter((item) => !arr1.includes(item))
].join(',')
console.log(arr1.filter((item) => arr2.includes(item)))
console.log(22, str)
if (str) {
message.alert('代码' + str + '没有找到对应数据')
return
}
}
let repeatCode = []
const arr1 = val.split(',').map(item => item.trim())
// 判断代码是否存在
if (!headerItem?.tableForm.isRepeat) {
const repeatCode = []
if (tableData.length > 0) {
tableData.forEach((item) => {
const findIndex = arr1.findIndex(valItem => valItem == item[headerItem.field])
@ -851,15 +836,31 @@ export const getListByBottonInput = async (headerItem, val, row, routeName, form
message.warning(`${t('ts.代码')}${repeatCode.join(',')}${t('ts.已经存在')}`);
return;
}
console.log(list.value)
}
await tableFormSchemaObj.verificationPage(params.value).then(async (res) => {
list.value = res ? res : []
if (arr1.length != res.length) {
const arr2 = res.map((item) => item[headerItem.tableForm.searchField])
const str = [
...arr1.filter((item) => !arr2.includes(item)),
...arr2.filter((item) => !arr1.includes(item))
].join(',')
console.log(arr1.filter((item) => arr2.includes(item)))
console.log(22, str)
if (str) {
message.alert('代码' + str + '没有找到对应数据')
return
}
}
callback(list.value)
})
return
} else {
let pageApi = ref()
let params = ref({})
let list = ref([])
let field = 'itemCode'
const pageApi = ref()
const params = ref({})
const list = ref([])
const field = 'itemCode'
// scp采购订单
if (!val) return;
@ -904,17 +905,17 @@ export const getListByBottonInput = async (headerItem, val, row, routeName, form
await pageApi.value(params.value).then(async (res) => {
list.value = res ? res : []
let arr1 = val.split(',').map(item => item.trim())
const arr1 = val.split(',').map(item => item.trim())
if (arr1.length != res.length) {
let arr2 = res.map((item) => item[field])
let str = [
const arr2 = res.map((item) => item[field])
const str = [
...arr1.filter((item) => !arr2.includes(item)),
...arr2.filter((item) => !arr1.includes(item))
].join(',')
message.alert('代码' + str + '没有找到对应数据')
return
} else {
let repeatCode = []
const repeatCode = []
if (tableData.length > 0) {
tableData.forEach((item) => {
const findIndex = arr1.findIndex(valItem => valItem == item[field])

1
src/views/wms/issueManage/productionreturn/productionreturnRequestMain/productionreturnRequestMain.data.ts

@ -628,6 +628,7 @@ export const ProductionreturnRequestDetail = useCrudSchemas(reactive<CrudSchema[
}],
verificationPage: WorkstationApi.getWorkstationByCodes, // 校验数去焦点输入是否正确的方法
isShowTableFormSearch: true,
isRepeat: true,//是否可以重复添加该条数据
verificationParams: [{
key: 'code',
action: '==',

1
src/views/wms/issueManage/productionreturn/productionreturnRequestMainNo/productionreturnRequestMainNo.data.ts

@ -130,6 +130,7 @@ export const ProductionreturnRequestDetail = useCrudSchemas(reactive<CrudSchema[
}],
verificationPage: WorkstationApi.getWorkstationByCodes, // 校验数去焦点输入是否正确的方法
isShowTableFormSearch: true,
isRepeat: true,//是否可以重复添加该条数据
verificationParams: [{
key: 'code',
action: '==',

Loading…
Cancel
Save