From 7afaad5061747de548961aeae22a743c67ed6e90 Mon Sep 17 00:00:00 2001 From: zhang_li <2235006734@qqq.com> Date: Tue, 26 Nov 2024 17:05:22 +0800 Subject: [PATCH] =?UTF-8?q?YT-1295=E7=BB=B4=E4=BF=AE=E5=A4=87=E4=BB=B6?= =?UTF-8?q?=E9=A2=86=E7=94=A8=E7=94=B3=E8=AF=B7=E6=98=8E=E7=BB=86=E4=B8=AD?= =?UTF-8?q?=E4=B8=8D=E5=BA=94=E8=AF=A5=E6=9C=89=E6=96=B0=E5=A2=9E=EF=BC=8C?= =?UTF-8?q?=E7=BC=96=E8=BE=91=EF=BC=8C=E5=88=A0=E9=99=A4=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/inventoryManage/balance/index.vue | 123 ++++++++++++++---- 1 file changed, 98 insertions(+), 25 deletions(-) diff --git a/src/views/wms/inventoryManage/balance/index.vue b/src/views/wms/inventoryManage/balance/index.vue index 0f9a3798f..2b7e655ef 100644 --- a/src/views/wms/inventoryManage/balance/index.vue +++ b/src/views/wms/inventoryManage/balance/index.vue @@ -82,8 +82,8 @@ import dayjs from 'dayjs' import download from '@/utils/download' +import { cloneDeep } from 'lodash-es' import * as BalanceApi from '@/api/wms/balance' import * as PackageApi from '@/api/wms/package' import BasicForm from '@/components/BasicForm/src/BasicForm.vue' -import { Balance, TransactionTab, BalanceRules } from './balance.data' +import { Balance, TransactionTab, BalanceRules,BalancePackage,BalancePackageRules } from './balance.data' import * as defaultButtons from '@/utils/disposition/defaultButtons' import TableHead from '@/components/TableHead/src/TableHead.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue' @@ -118,10 +119,14 @@ import { getAccessToken } from '@/utils/auth' import { getJmreportBaseUrl } from '@/utils/systemParam' import { formatDate } from '@/utils/formatTime' import { usePageLoading } from '@/hooks/web/usePageLoading' +import * as ItembasicApi from '@/api/wms/itembasic' +import * as SupplieritemApi from '@/api/wms/supplieritem' +import * as ProductionlineitemApi from '@/api/wms/productionlineitem' import { SupplierdeliverRequestPackage, SupplierdeliverRequestPackageRules } from '@/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data' + console.log(222,SupplierdeliverRequestPackage) const { loadStart, loadDone } = usePageLoading() // 库存余额 @@ -137,6 +142,8 @@ const tableColumns = ref(Balance.allSchemas.tableColumns) const tabsExtend = ref(false) const apiPage = ref() const tableObjectExtend = ref() +const detailListTableColumns =cloneDeep(BalancePackage.allSchemas) +const detailListTableColumnsRules =cloneDeep(BalancePackageRules) //字段设置 更新主列表字段 const updataTableColumns = (val) => { @@ -348,28 +355,86 @@ const handlePoint = async (row) => { } const searchTableRef = ref() +const enableBuyOrenableMake = ref()//是可制造还是可采购 const getLabelDetailPage = async (row, useToPackingNumber) => { ////英泰项目没有包装号 所以只能通过物料号,批次,到库位代码去查询对应的包装 - let defaultParams = { - moduleName: 'move', - recordNumber: '', - itemCode: row.itemCode, - packQty: row.packQty, - batch: row.batch - } - const { tableObject: tableObjectPrint, tableMethods } = useTable({ - defaultParams, - getListApi: PackageApi.getLabelDetailPage // 分页接口 - }) - // 获得表格的各种操作 - const { getList: getListPrint } = tableMethods - await getListPrint() - tableObject.loading = false - const tableColumns = SupplierdeliverRequestPackage.allSchemas.tableFormColumns - tableColumns.forEach((item) => { - item.width = item.table?.width || 150 + // let defaultParams = { + // moduleName: 'move', + // recordNumber: '', + // itemCode: row.itemCode, + // packQty: row.packQty, + // batch: row.batch + // } + // const { tableObject: tableObjectPrint, tableMethods } = useTable({ + // defaultParams, + // getListApi: PackageApi.getLabelDetailPage // 分页接口 + // }) + // // 获得表格的各种操作 + // const { getList: getListPrint } = tableMethods + // await getListPrint() + // tableObject.loading = false + // const tableColumns = SupplierdeliverRequestPackage.allSchemas.tableFormColumns + // tableColumns.forEach((item) => { + // item.width = item.table?.width || 150 + // }) + // detatableData1.value = tableObjectPrint.tableList + + await ItembasicApi.getItembasicPage({ + pageSize: 10, + pageNo: 1, + code: row.itemCode, + sort: '', + by: 'ASC', + }).then(res => { + if (res.list.length > 0) { + // 判断物料 可采购 + detailListTableColumnsRules.value = cloneDeep(detailListTableColumnsRules) + enableBuyOrenableMake.value = res.list[0].enableBuy == "TRUE" ? 'enableBuy' : res.list[0].enableMake == "TRUE" ? 'enableMake' :'' + if (res.list[0].enableBuy == "TRUE") { + detailListTableColumns.tableFormColumns = BalancePackage.allSchemas.tableFormColumns.filter(item=>item.field != 'productionLineCodePackage') + delete detailListTableColumnsRules.value.productionLineCodePackage + // 修改 tableform 属性 + detailListTableColumns.tableFormColumns.map(itemColumns => { + if(itemColumns.field == 'supplierItemCode') { + SupplieritemApi.getSupplieritemPage({ + pageSize: 10, + pageNo: 1, + itemCode: row.itemCode, + sort: '', + by: 'ASC', + }).then(response => { + row.supplierItemCode = response.list[0].supplierCode + }) + } + }) + } + // 判断物料 可制造 + if (res.list[0].enableMake == "TRUE") { + // 修改 tableform 属性 + detailListTableColumns.tableFormColumns = BalancePackage.allSchemas.tableFormColumns.filter(item=>item.field != 'supplierItemCode') + delete detailListTableColumnsRules.value.supplierItemCode + detailListTableColumns.tableFormColumns.map(itemColumns => { + if(itemColumns.field == 'productionLineCodePackage') { + ProductionlineitemApi.getProductionlineitemPage({ + pageNo: 1, + itemCode: row.itemCode, + sort: '', + by: 'ASC', + }).then(response => { + row.supplierItemCode = response.list[0].supplierCode + }) + } + }) + } + } else { + message.warning('没有查询到物料代码:【' + row.itemCode + '】') + return + } + }) - detatableData1.value = tableObjectPrint.tableList + + detatableData1.value=[]//不走打印详情接口,用主数据 + detatableData1.value.push(row) detatableData1.value.forEach(item => { item.printQty =row.qty if (!item.batch) { @@ -504,10 +569,13 @@ const pointLabel = async () => { // }) const obj = { itemCode:detatableData1.value[0].itemCode, - packingNumber:detatableData1.value[0].number, batch:detatableData1.value[0].batch, printQty:detatableData1.value[0].printQty, + packUnit:detatableData1.value[0].packUnit, packQty:detatableData1.value[0].packQty, + uom:detatableData1.value[0].uom, + productionLineCodePackage:detatableData1.value[0].productionLineCodePackage, + supplierItemCode:detatableData1.value[0].supplierItemCode, } // const isHave = detatableData1.value.find(item => parseFloat(item.printQty) <= 0) if(!parseFloat(obj.printQty) ){ @@ -515,8 +583,13 @@ const pointLabel = async () => { return; } await PackageApi.batchPrintingBalanceLableForCreate(obj).then(res => { - const src = ref(BASE_URL + '/jmreport/view/922734157577715712?token=' + getAccessToken()) - window.open(src.value+'&asn_number='+res) + let src =ref('') + if (enableBuyOrenableMake.value == 'enableBuy') { + src.value = BASE_URL + '/jmreport/view/1016234988731322368?token=' + getAccessToken()+'&id='+res//采购标签模板 + } else if(enableBuyOrenableMake.value == 'enableMake') { + src.value = BASE_URL + '/jmreport/view/922734157577715712?token=' + getAccessToken()+'&asn_number='+res//制造标签模板 + } + window.open(src.value) }).catch(err => { console.log(err) message.error('创建标签失败')