From f8bda453dc2599a7cadfbbbfdbfaca0c645a1623 Mon Sep 17 00:00:00 2001 From: yufei_wang <2267742828@qq.com> Date: Fri, 20 Sep 2024 14:46:57 +0800 Subject: [PATCH] =?UTF-8?q?HL-5957=E7=94=9F=E4=BA=A7=E9=80=80=E6=96=99?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=9A=84=E4=BF=AE=E6=94=B91=EF=BC=9A?= =?UTF-8?q?=E4=B8=BB=E6=95=B0=E6=8D=AE=E4=B8=AD=E5=A2=9E=E5=8A=A0=E5=88=B0?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E9=80=89=E9=A1=B9=EF=BC=9B2=EF=BC=9A?= =?UTF-8?q?=E5=9C=A8=E7=94=B3=E8=AF=B7=E4=B8=AD=E4=B8=8D=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=E5=BA=93=E4=BD=8D=EF=BC=8C=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=AE=8C=E7=94=9F=E6=88=90=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=9C=A8=E4=BB=BB=E5=8A=A1=E4=B8=AD=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E4=B8=8A=E6=9E=B6=E7=AD=96=E7=95=A5=E4=B8=BA=E9=80=80?= =?UTF-8?q?=E5=9B=9E=E7=9A=84=E5=8C=85=E8=A3=85=E5=9C=A8=E7=9B=AE=E6=A0=87?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E4=B8=8B=E6=8E=A8=E8=8D=90=E7=9B=AE=E6=A0=87?= =?UTF-8?q?=E5=BA=93=E4=BD=8D=EF=BC=8C=E5=8F=AF=E4=BB=A5=E5=8F=82=E8=80=83?= =?UTF-8?q?=E5=90=88=E6=A0=BC=E8=BD=AC=E9=9A=94=E7=A6=BB=E6=97=B6=E6=8E=A8?= =?UTF-8?q?=E8=8D=90=E7=9B=AE=E6=A0=87=E5=BA=93=E4=BD=8D=E7=9A=84=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../productionreturnRequestMain/index.vue | 123 +- .../productionreturnRequestMain.data.ts | 516 ++++-- .../productionreturnRequestMainNo/index.vue | 2 +- .../productionreturnRequestMain.data.ts | 1527 +++++++++++++++++ 4 files changed, 1967 insertions(+), 201 deletions(-) create mode 100644 src/views/wms/issueManage/productionreturn/productionreturnRequestMainNo/productionreturnRequestMain.data.ts diff --git a/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/index.vue b/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/index.vue index 9cb5a44f7..79d3b6643 100644 --- a/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/index.vue +++ b/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/index.vue @@ -43,7 +43,7 @@ @@ -88,7 +89,7 @@ :isShowButton="false" @handleAddTable="handleAddTable" @handleDeleteTable="handleDeleteTable" - @searchTableSuccess="searchTableSuccess" + @searchTableSuccess="searchTableSuccessLabel" @submitForm="submitFormLabel" /> @@ -183,9 +184,28 @@ const isItemType = async (itemCode, labelTypeParams) => { if (!isType) labelType.value = labelTypeOld return isType } +const clearSearchInput = (formField) => { + if(formField=='workshopCode'){ + //车间 + formRef.value.formRef.setValues({ + productionLineCode:'',//生产线代码 + workStationCode:'',//工位代码 + fromLocationCode:'',//来源库位 + }) + tableData.value = [] + }else if(formField=='productionLineCode'){ + //生产线代码 + formRef.value.formRef.setValues({ + workStationCode:'',//工位代码 + fromLocationCode:'',//来源库位 + }) + tableData.value = [] + } +} // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { + console.log('searchTableSuccess',formRef.formModel) nextTick(async () => { if (type == 'tableForm') { // 明细查询页赋值 @@ -194,23 +214,37 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => message.warning(`物料${val[0]['itemCode']}已经存在`) return } - - const isType = await isItemType(val[0]['itemCode'], labelType.value) - if(!isType){ - message.warning('当前物料可制造与其他数据不一致,请重新选择!') - } else { - row['itemCode'] = val[0]['itemCode'] - row['uom'] = val[0]['uom'] - row['inventoryStatus'] = val[0]['inventoryStatus'] - row['qty'] = val[0]['qty'] + let enableBuy = val[0]['enableBuy'] + if(tableData.value.length>0){ + enableBuy = tableData.value[0]['enableBuy'] + } + //被过滤的数组 + let noList = val.filter(item=>item['enableBuy']!=enableBuy) + if(noList&&noList.length>0){ + let itemCodes = noList.map(item=>item['itemCode']) + console.log(itemCodes) + message.warning(`${itemCodes.join(',')}与其他数据制造类型不一致,被过滤!`) + } + val = val.filter(item=>item['enableBuy']==enableBuy) + + val.forEach(item=>{ + const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) + newRow['itemCode'] = item['itemCode'] + newRow['enableBuy'] = item['enableBuy'] + newRow['uom'] = item['uom'] + newRow['inventoryStatus'] = item['inventoryStatus'] + newRow['qty'] = item['qty'] // 如果有批次 赋值库存余额批次 无批次 赋值 000000 - if (val[0]['batch'] !== '') { - row['batch'] = val[0]['batch'] + if (item['batch'] !== '') { + newRow['batch'] = item['batch'] } else { - row['batch'] = '000000' + newRow['batch'] = '000000' } - row['packUnit'] = val[0]['packUnit'] - row['packQty'] = val[0]['packQty'] + newRow['packUnit'] = item['packUnit'] + newRow['packQty'] = item['packQty'] + tableData.value.push(newRow) + }) + // HL-4885 聂喜婷:@邱晨 @王宇飞 先把数量的校验拿掉 // 修改 tableform 属性 数量最大值设置为库存余额中数量 // TODO: tableFormColumns 修改属性目前只限于整个列 并不满足行要求 例如: 第一条数据最大10 第二条数据最大20 那么第一条数据会变成最大20限制 @@ -219,16 +253,17 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => // item.tableForm.max = val[0]['qty'] // } // }) - } - } else if(formField == 'workStationCode') { - // 明细查询页赋值 - val.forEach(item=>{ - const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) - newRow['workStationCode'] = item['code'] - newRow['fromLocationCode'] = item['rawLocationCode'] - tableData.value.push(newRow) - }) - } + // } + } + // else if(formField == 'workStationCode') { + // // 明细查询页赋值 + // val.forEach(item=>{ + // const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) + // newRow['workStationCode'] = item['code'] + // newRow['fromLocationCode'] = item['rawLocationCode'] + // tableData.value.push(newRow) + // }) + // } // else if(formField == 'packUnit') { // row['packUnit'] = val[0]['packUnit'] // row['packQty'] = val[0]['packQty'] @@ -239,11 +274,43 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => } else { const setV = {} setV[formField] = val[0][searchField] + if(formField=='workshopCode'){ + //车间 + setV['productionLineCode'] = ''//生产线代码 + setV['workStationCode'] = ''//工位代码 + setV['fromLocationCode'] = ''//来源库位 + + tableData.value = [] + }else if(formField=='productionLineCode'){ + //生产线代码 + setV['workStationCode'] = ''//工位代码 + setV['fromLocationCode'] = ''//来源库位 + tableData.value = [] + } + if(formField == 'workStationCode') { + // 来源工位代码 + setV['workStationCode'] = val[0]['code'] + setV['fromLocationCode'] = val[0]['rawLocationCode'] + } tableData.value = [] // 重置明细数据 formRef.setValues(setV) } }) } +// 查询页面返回 +const searchTableSuccessLabel = (formField, searchField, val, formRef, type, row ) => { + console.log('searchTableSuccessLabel',formField, searchField, val, formRef, type, row) + nextTick(async () => { + if (type == 'tableForm') { + // 明细查询页赋值 + row[formField] = val[0][searchField] + } else { + const setV = {} + setV[formField] = val[0][searchField] + formRef.setValues(setV) + } + }) +} // 查询页面返回——详情 const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { nextTick(async () => { @@ -654,6 +721,10 @@ const submitForm = async (formType, submitData) => { if(data.masterId){ data.id = data.masterId } + tableData.value.forEach((item:any)=>{ + item['workStationCode'] = data.workStationCode + item['fromLocationCode'] = data.fromLocationCode + }) data.subList = tableData.value // 拼接子表数据参数 let isZC = true // 数量和标包数量 是否整除 data.subList.forEach(item => { diff --git a/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/productionreturnRequestMain.data.ts b/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/productionreturnRequestMain.data.ts index 995d146a5..a3e6bc720 100644 --- a/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/productionreturnRequestMain.data.ts +++ b/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/productionreturnRequestMain.data.ts @@ -24,7 +24,8 @@ import * as SupplieritemApi from '@/api/wms/supplieritem' import { Supplieritem } from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data' import * as LocationApi from '@/api/wms/location' import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' - +import { Warehouse } from "@/views/wms/basicDataManage/factoryModeling/warehouse/warehouse.data"; +import * as WarehouseApi from "@/api/wms/warehouse"; const { t } = useI18n() // 国际化 // 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值 @@ -116,7 +117,7 @@ export const ProductionreturnRequestMain = useCrudSchemas(reactive }, }, { - label: '生产线代码', + label: '生产线', field: 'productionLineCode', sort: 'custom', table: { @@ -171,6 +172,155 @@ export const ProductionreturnRequestMain = useCrudSchemas(reactive }] }, }, + { + label: '工位', + field: 'workStationCode', + sort: 'custom', + table: { + width: 150 + }, + isForm: true, + form: { + // labelMessage: '信息提示说明!!!', + componentProps: { + enterSearch: true, + isSearchList: true, // 开启查询弹窗 + searchListPlaceholder: '请选择工位代码', // 输入框占位文本 + searchField: 'code', // 查询弹窗赋值字段 + searchTitle: '工位信息', // 查询弹窗标题 + searchAllSchemas: Workstation.allSchemas, // 查询弹窗所需类 + searchPage: WorkstationApi.getWorkstationPage, // 查询弹窗所需分页方法 + searchCondition:[{ + key: 'available', + value: 'TRUE', + isMainValue: false + },{ + key: 'workshopCode', + value: 'workshopCode', + message: '请选择车间信息!', + isMainValue: true + },{ + key: 'productionLineCode', + value: 'productionLineCode', + message: '请选择生产线信息!', + isMainValue: true, + isOptional:true, // isMainValue=true情况,添加参数可选可空的判断 + }], + verificationParams: [{ + key: 'code', + action: '==', + value: '', + isMainValue: false, + isSearch: true, + isFormModel: true, + }], // 失去焦点校验参数 + + } + }, + tableForm:{ + multiple:true, + disabled:true, + // isInpuFocusShow: true, + searchListPlaceholder: '请选择工位代码', // 输入框占位文本 + searchField: 'code', // 查询弹窗赋值字段 + searchTitle: '工位信息', // 查询弹窗标题 + searchAllSchemas: Workstation.allSchemas, // 查询弹窗所需类 + searchPage: WorkstationApi.getWorkstationPage, // 查询弹窗所需分页方法 + searchCondition: [ + { + key: 'available', + value: 'TRUE', + action: '==', // 查询拼接条件 + isSearch: true, // 使用自定义拼接条件 + isMainValue: false + }, + { + key: 'workshopCode', + value: 'workshopCode', + message: '请选择车间信息!', + action: '==', // 查询拼接条件 + isSearch: true, // 使用自定义拼接条件 + isMainValue: false, // 拼接条件必须要 false 同时不能与 isMainValue: true 同用 + isFormModel:true, // filters中添加筛选的数据--取于formModel + required:true, // 前置添加必有,和isFormModel结合使用 + }, + { + key: 'productionLineCode', // 查询列表中字段 + value: 'productionLineCode', // 指查询具体值 + action: '==', // 查询拼接条件 + isSearch: true, // 使用自定义拼接条件 + isMainValue: false, // 拼接条件必须要 false 同时不能与 isMainValue: true 同用 + isFormModel:true, // filters中添加筛选的数据--取于formModel + required:false, // 前置添加必有,和isFormModel结合使用 + }, + ], + verificationPage: WorkstationApi.getWorkstationByCodes, // 校验数去焦点输入是否正确的方法 + isShowTableFormSearch: true, + isRepeat: true,//是否可以重复添加该条数据 + verificationParams: [{ + key: 'code', + action: '==', + value: '', + isMainValue: false, + isSearch: true, + isFormModel: true, + }], // 失去焦点校验参数 + }, + }, + { + label: '来源库位', + field: 'fromLocationCode', + sort: 'custom', + table: { + width: 150 + }, + tableForm: { + disabled: true + }, + form: { + componentProps: { + disabled: true + } + }, + isDetail:false, + isTable:true, + isTableForm: true, + isForm: true, + }, + { + label: '到仓库', + field: 'toWarehouseCode', + sort: 'custom', + table: { + width: 150, + }, + isForm:true, + form: { + // labelMessage: '信息提示说明!!!', + componentProps: { + enterSearch: true, + isSearchList: true, + searchListPlaceholder: '请选择仓库代码', + searchField: 'code', + searchTitle: '仓库信息', + searchAllSchemas: Warehouse.allSchemas, + searchPage: WarehouseApi.getWarehousePage, + searchCondition: [{ + key: 'available', + value: 'TRUE', + isMainValue: false + }], + verificationParams: [{ + key: 'code', + action: '==', + value: '', + isMainValue: false, + isSearch: true, + isFormModel: true, + }], // 失去焦点校验参数 + } + } + }, { label: '申请时间', field: 'requestTime', @@ -524,6 +674,12 @@ export const ProductionreturnRequestMainRules = reactive({ // productionLineCode: [ // { required: true, message: '请选择生产线代码', trigger: 'change' } // ], + workStationCode: [ + { required: true, message: '请选择工位代码', trigger: 'change' } + ], + toWarehouseCode: [ + { required: true, message: '请选择到仓库', trigger: 'change' } + ], }) /** @@ -579,161 +735,161 @@ export const ProductionreturnRequestDetail = useCrudSchemas(reactive { //表单校验 export const ProductionreturnRequestDetailRules = reactive({ - workStationCode: [ - { required: true, message: '请选择工位代码', trigger: 'change' } - ], - toLocationCode: [ - { required: true, message: '请选择目标库位', trigger: 'change' } - ], + + // toLocationCode: [ + // { required: true, message: '请选择目标库位', trigger: 'change' } + // ], productionLineCode: [ { required: true, message: '请选择生产线代码', trigger: 'change' } ], diff --git a/src/views/wms/issueManage/productionreturn/productionreturnRequestMainNo/index.vue b/src/views/wms/issueManage/productionreturn/productionreturnRequestMainNo/index.vue index 1515e519a..bb512fad1 100644 --- a/src/views/wms/issueManage/productionreturn/productionreturnRequestMainNo/index.vue +++ b/src/views/wms/issueManage/productionreturn/productionreturnRequestMainNo/index.vue @@ -101,7 +101,7 @@