diff --git a/src/views/wms/inventoryjobManage/unplannedreceipt/unplannedreceiptRequestMain/index.vue b/src/views/wms/inventoryjobManage/unplannedreceipt/unplannedreceiptRequestMain/index.vue index c4c89bfc5..449d9cf68 100644 --- a/src/views/wms/inventoryjobManage/unplannedreceipt/unplannedreceiptRequestMain/index.vue +++ b/src/views/wms/inventoryjobManage/unplannedreceipt/unplannedreceiptRequestMain/index.vue @@ -131,6 +131,7 @@ const tableColumns = ref(UnplannedreceiptRequestMain.allSchemas.tableColumns) const detailListTableColumns = UnplannedreceiptRequestDetailLabel.allSchemas const isCreateLabel = ref(false) const formLabelRef = ref() +const labelType = ref('') // 标签类别 采购还是制造等 const { tableObject: detatableData, tableMethods: detatableMethods } =useTable({ getListApi: UnplannedreceiptRequestDetailApi.getUnplannedreceiptRequestDetailPage }) @@ -141,19 +142,56 @@ const updataTableColumns = (val) => { tableColumns.value = val } +// 判断 物料类型是否与其他物料类型一致 +const isItemType = async (itemCode, labelTypeParams) => { + let isType = false + const labelTypeOld = JSON.parse(JSON.stringify(labelType.value)) + await ItembasicApi.getItembasicPage({ + pageSize: 10, + pageNo: 1, + code: itemCode, + sort: '', + by: 'ASC', + }).then(res => { + if (res.list.length > 0) { + // 判断物料 可采购 可制造 + if (res.list[0].enableMake == "FALSE") { + labelType.value = 'cg' + if (labelTypeParams == 'cg') { + isType = true + } + } else { + labelType.value = 'zz' + if (labelTypeParams == 'zz') { + isType = true + } + } + if(labelTypeParams == '') isType = true + } + }) + // 当第二次选择为不同类型时 类型要重置到第一次选择的结果 + if (!isType) labelType.value = labelTypeOld + return isType +} + // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { - nextTick(() => { + nextTick(async () => { if (type == 'tableForm') { // 明细查询页赋值 if(formField == 'toLocationCode'){ row['toLocationCode'] = val[0]['code'] + } else if(formField == 'itemCode'){ + const isType = await isItemType(val[0]['code'], labelType.value) + if(!isType){ + message.warning('当前物料可制造与其他数据不一致,请重新选择!') + } else { + row['itemCode'] = val[0]['code'] + row['uom'] = val[0]['uom'] + } + } else { + row[formField] = val[0][searchField] } - if(formField == 'itemCode'){ - row['itemCode'] = val[0]['code'] - row['uom'] = val[0]['uom'] - } - row[formField] = val[0][searchField] } else { const setV = {} setV[formField] = val[0][searchField] @@ -323,8 +361,8 @@ const buttonTableClick = async (val, row) => { by: 'ASC', }).then(res => { if (res.list.length > 0) { - // 判断物料类型 是否 原料 - if (res.list[0].type == "RAW") { + // 判断物料 可采购 可制造 + if (res.list[0].enableMake == "FALSE") { // 修改 tableform 属性 detailListTableColumns.tableFormColumns.map(item => { if(item.field == 'productionLineCodePackage') { diff --git a/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/index.vue b/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/index.vue index d1bd1f0b7..4d06233be 100644 --- a/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/index.vue +++ b/src/views/wms/issueManage/productionreturn/productionreturnRequestMain/index.vue @@ -125,6 +125,7 @@ const updataTableColumns = (val) => { // 判断 物料类型是否与其他物料类型一致 const isItemType = async (itemCode, labelTypeParams) => { let isType = false + const labelTypeOld = JSON.parse(JSON.stringify(labelType.value)) await ItembasicApi.getItembasicPage({ pageSize: 10, pageNo: 1, @@ -133,8 +134,8 @@ const isItemType = async (itemCode, labelTypeParams) => { by: 'ASC', }).then(res => { if (res.list.length > 0) { - // 判断物料类型 是否 原料 - if (res.list[0].type == "RAW") { + // 判断物料 可采购 可制造 + if (res.list[0].enableMake == "FALSE") { labelType.value = 'cg' if (labelTypeParams == 'cg') { isType = true @@ -148,6 +149,8 @@ const isItemType = async (itemCode, labelTypeParams) => { if(labelTypeParams == '') isType = true } }) + // 当第二次选择为不同类型时 类型要重置到第一次选择的结果 + if (!isType) labelType.value = labelTypeOld return isType } @@ -159,7 +162,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => if(formField == 'itemCode') { const isType = await isItemType(val[0]['itemCode'], labelType.value) if(!isType){ - message.warning('当前物料类型与其他数据不一致,请重新选择!') + message.warning('当前物料可制造与其他数据不一致,请重新选择!') } else { row['itemCode'] = val[0]['itemCode'] row['uom'] = val[0]['uom'] @@ -194,7 +197,7 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { if(formField == 'itemCode') { const isType = await isItemType(val[0]['itemCode'], labelType.value) if(!isType){ - message.warning('当前物料类型与其他数据不一致,请重新选择!') + message.warning('当前物料可制造与其他数据不一致,请重新选择!') } else { setV['itemCode'] = val[0]['itemCode'] setV['uom'] = val[0]['uom'] @@ -363,8 +366,8 @@ const buttonTableClick = async (val, row) => { by: 'ASC', }).then(res => { if (res.list.length > 0) { - // 判断物料类型 是否 原料 - if (res.list[0].type == "RAW") { + // 判断物料 可采购 可制造 + if (res.list[0].enableMake == "FALSE") { // 修改 tableform 属性 detailListTableColumns.tableFormColumns.map(itemColumns => { if(itemColumns.field == 'productionLineCodePackage') { diff --git a/src/views/wms/issueManage/productionreturn/productionreturnRequestMainNo/index.vue b/src/views/wms/issueManage/productionreturn/productionreturnRequestMainNo/index.vue index 8c2ccf198..2b099bab0 100644 --- a/src/views/wms/issueManage/productionreturn/productionreturnRequestMainNo/index.vue +++ b/src/views/wms/issueManage/productionreturn/productionreturnRequestMainNo/index.vue @@ -128,6 +128,7 @@ const updataTableColumns = (val) => { // 判断 物料类型是否与其他物料类型一致 const isItemType = async (itemCode, labelTypeParams) => { let isType = false + const labelTypeOld = JSON.parse(JSON.stringify(labelType.value)) await ItembasicApi.getItembasicPage({ pageSize: 10, pageNo: 1, @@ -136,8 +137,8 @@ const isItemType = async (itemCode, labelTypeParams) => { by: 'ASC', }).then(res => { if (res.list.length > 0) { - // 判断物料类型 是否 原料 - if (res.list[0].type == "RAW") { + // 判断物料 可采购 可制造 + if (res.list[0].enableMake == "FALSE") { labelType.value = 'cg' if (labelTypeParams == 'cg') { isType = true @@ -151,6 +152,8 @@ const isItemType = async (itemCode, labelTypeParams) => { if(labelTypeParams == '') isType = true } }) + // 当第二次选择为不同类型时 类型要重置到第一次选择的结果 + if (!isType) labelType.value = labelTypeOld return isType } @@ -162,7 +165,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => if(formField == 'itemCode') { const isType = await isItemType(val[0]['itemCode'], labelType.value) if(!isType){ - message.warning('当前物料类型与其他数据不一致,请重新选择!') + message.warning('当前物料可制造与其他数据不一致,请重新选择!') } else { row['batch'] = val[0]['batch']==''?formatTime(new Date(), 'yyyyMMdd'):val[0]['batch'] row['itemCode'] = val[0]['itemCode'] @@ -200,7 +203,7 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { if(formField == 'itemCode') { const isType = await isItemType(val[0]['itemCode'], labelType.value) if(!isType){ - message.warning('当前物料类型与其他数据不一致,请重新选择!') + message.warning('当前物料可制造与其他数据不一致,请重新选择!') } else { setV['batch'] = val[0]['batch'] setV['itemCode'] = val[0]['itemCode'] @@ -370,8 +373,8 @@ const buttonTableClick = async (val, row) => { by: 'ASC', }).then(res => { if (res.list.length > 0) { - // 判断物料类型 是否 原料 - if (res.list[0].type == "RAW") { + // 判断物料 可采购 可制造 + if (res.list[0].enableMake == "FALSE") { // 修改 tableform 属性 detailListTableColumns.tableFormColumns.map(itemColumns => { if(itemColumns.field == 'productionLineCodePackage') { diff --git a/src/views/wms/productionManage/productreceipt/productreceiptRequestMain/index.vue b/src/views/wms/productionManage/productreceipt/productreceiptRequestMain/index.vue index 16dfa335f..93581787d 100644 --- a/src/views/wms/productionManage/productreceipt/productreceiptRequestMain/index.vue +++ b/src/views/wms/productionManage/productreceipt/productreceiptRequestMain/index.vue @@ -352,8 +352,8 @@ const buttonTableClick = async (val, row) => { by: 'ASC', }).then(res => { if (res.list.length > 0) { - // 判断物料类型 是否 原料 - if (res.list[0].type == "RAW") { + // 判断物料 可采购 可制造 + if (res.list[0].enableMake == "FALSE") { // 修改 tableform 属性 detailListTableColumns.tableFormColumns.map(itemColumns => { if(itemColumns.field == 'productionLineCodePackage') {