diff --git a/src/api/wms/bomDismantle/index.ts b/src/api/wms/bomDismantle/index.ts index 981af0fdb..99b3050d8 100644 --- a/src/api/wms/bomDismantle/index.ts +++ b/src/api/wms/bomDismantle/index.ts @@ -41,6 +41,10 @@ export const getProductscrapBomRecordPageBatch = async (params1) => { } } +export const getChangeBomQtyPage = async (params) => { + return await request.get({ url: `/wms/productscrap-request-main/pageBom`, params }) +} + // 查询制品报废申请子列表 export const getProductscrapBomDismantleRecordPage = async (params) => { return await request.get({ url: `/wms/productscrap-record-main/bomPage`, params }) diff --git a/src/api/wms/productscrapRequestMain/index.ts b/src/api/wms/productscrapRequestMain/index.ts index 2a0a38edd..f003dc322 100644 --- a/src/api/wms/productscrapRequestMain/index.ts +++ b/src/api/wms/productscrapRequestMain/index.ts @@ -103,6 +103,12 @@ export const updateProductscrapDetailRequestBom = async (id, data) => { return await request.post({ url: `/wms/productscrap-request-main/updateBom?id=`+id, data }) } + +// 修改制品报废BOM数据 +export const updateChangeBomRequest = async (data) => { + return await request.post({ url: `/wms/productscrap-request-main/updateBomQty`, data }) +} + // 编辑 export const editReturnNew = async (params) => { return await request.get({ url: `/wms/productscrap-request-main/editReturnNew`, params }) diff --git a/src/views/wms/productionManage/productscrap/productscrapRequestMain/index.vue b/src/views/wms/productionManage/productscrap/productscrapRequestMain/index.vue index 2829b4934..d6d803a05 100644 --- a/src/views/wms/productionManage/productscrap/productscrapRequestMain/index.vue +++ b/src/views/wms/productionManage/productscrap/productscrapRequestMain/index.vue @@ -121,6 +121,40 @@ + + + + + @@ -134,7 +168,9 @@ import { ProductscrapRequestMain, ProductscrapRequestDetail, ProductscrapRequestDetailRules, ProdcutscrapBomScrap, - ProdcutscrapBomScrapRules } from './productscrapRequestMain.data' + ProdcutscrapBomScrapRules, + ChangeBomQty, + ChangeBomQtyRules } from './productscrapRequestMain.data' import * as ProductscrapRequestMainApi from '@/api/wms/productscrapRequestMain' import * as ProductscrapRequestDetailApi from '@/api/wms/productscrapRequestDetail' import * as StdcostpriceApi from '@/api/wms/stdcostprice' @@ -260,6 +296,8 @@ const bomSearchClick = ()=>{ } } + + const banchBomPage = async (fromLocationCode,item) => { const params = { location_code:fromLocationCode, @@ -692,9 +730,61 @@ const buttonTableClick = async (val, row) => { openForm('update', row) } else if (val == 'delete') { // 删除 handleDelete(row.masterId) + }else if (val == 'updateBomQty'){ // 更改BOM数量 + handleChangeBom(row) } } +// 修改Bom数量 窗口 +const changeBomTableList = ref([]) +const detailChangeBomRef =ref() +const { tableObject: changeBomTableObject, tableMethods: changeBomTableMethods } =useTable({ + getListApi: BomDismantleApi.getChangeBomQtyPage +}) +const { getList:getDetailListChangeBom } = changeBomTableMethods +const handleChangeBom = async (row)=>{ + changeBomTableObject.params = { + number: row.number + } + await getDetailListChangeBom() + changeBomTableList.value = changeBomTableObject.tableList + detailChangeBomRef.value.open('create', row, null,'viewDetail')//查看明细数据 +} +// 查询 +const ChangeBomSearchData = ref({ + parentItemCode:'', // 父物料代码 + childItemCode:'' // 子物料代码 +}) +const changeBomSearchClick = ()=>{ + ChangeBomSearchData.value.parentItemCode = ChangeBomSearchData.value.parentItemCode.trim() + ChangeBomSearchData.value.childItemCode = ChangeBomSearchData.value.childItemCode.trim() + let parentItemCodeList = ChangeBomSearchData.value.parentItemCode?ChangeBomSearchData.value.parentItemCode.split(','):[] + let childItemCodeList = ChangeBomSearchData.value.childItemCode?ChangeBomSearchData.value.childItemCode.split(','):[] + console.log('parentItemCodeList',parentItemCodeList) + console.log('childItemCodeList',childItemCodeList) + changeBomTableList.value = changeBomTableObject.tableList.filter(item=>{ + console.log(parentItemCodeList.includes(item.parentItemCode)) + console.log(childItemCodeList.includes(item.childItemCode)) + if((parentItemCodeList.includes(item.parentItemCode)||parentItemCodeList.length==0)&&(childItemCodeList.includes(item.childItemCode)||childItemCodeList.length==0)){ + return true + } else { + return false + } + }) +} +// bom 列表 表单 按钮 +const buttonBaseClickChangeBom = (val) => { + // 保存 + if (val == 'save') { + ProductscrapRequestMainApi.updateChangeBomRequest(changeBomTableList.value) + message.success(t('common.updateSuccess')) + detailChangeBomRef.value.dialogVisible = false + } + // 关闭 + else if (val == 'close') { + detailChangeBomRef.value.dialogVisible = false + } +} /** 关闭按钮操作 */ const handleClose = async (id: number) => { try{ diff --git a/src/views/wms/productionManage/productscrap/productscrapRequestMain/productscrapRequestMain.data.ts b/src/views/wms/productionManage/productscrap/productscrapRequestMain/productscrapRequestMain.data.ts index 829c83855..87216603b 100644 --- a/src/views/wms/productionManage/productscrap/productscrapRequestMain/productscrapRequestMain.data.ts +++ b/src/views/wms/productionManage/productscrap/productscrapRequestMain/productscrapRequestMain.data.ts @@ -1689,3 +1689,97 @@ export const ProdcutscrapBomScrap = useCrudSchemas(reactive([ export const ProdcutscrapBomScrapRules = reactive({ }) + + +/** + * @returns {Array} bom 拆解 + */ +export const ChangeBomQty = useCrudSchemas(reactive([ + // { + // label: '行标记', + // field: 'rowId', + // isTableForm: false, + // isForm: false, + // tableForm:{ + // disabled: true + // }, + // table: { + // show: false + // } + // }, + { + label: '父物料代码', + field: 'parentItemCode', + tableForm:{ + disabled: true + } + }, + { + label: '父物料数量', + field: 'parentQty', + tableForm: { + disabled: true, + type: 'InputNumber', + min: 0, + precision: 6 + } + }, + { + label: '子物料代码', + field: 'childItemCode', + tableForm:{ + disabled: true + } + }, + { + label: 'Bom数量', + field: 'bomQty', + tableForm: { + disabled: true, + type: 'InputNumber', + min: 0, + precision: 6 + } + }, + { + label: '子物料数量', + field: 'qty', + tableForm: { + disabled: false, + type: 'InputNumber', + min: 0, + precision: 6 + } + }, + { + label: 'Bom版本', + field: 'bomVersion', + tableForm:{ + disabled: true + } + }, + { + label: '批次', + field: 'batch', + sort: 'custom', + table: { + width: 150 + }, + tableForm:{ + disabled:true, + // isInpuFocusShow: true, // 开启查询弹窗 + searchListPlaceholder: '请选择批次', + searchField: 'batch', + searchTitle: '库存余额信息', + searchAllSchemas: Balance.allSchemas, + searchPage: BalanceApi.getBalancePage, + } + } +])) + +//表单校验 +export const ChangeBomQtyRules = reactive({ + qty:[ + { validator:validateQty, message: '数量必须大于0', trigger: 'change'} + ], +})