From c3eee8c10fcd663f0e4d315d8a33f243760fd298 Mon Sep 17 00:00:00 2001 From: yufei_wang <2267742828@qq.com> Date: Wed, 9 Oct 2024 13:24:37 +0800 Subject: [PATCH] =?UTF-8?q?HL-6164WMS=E9=87=87=E8=B4=AD=E6=94=B6=E8=B4=A7?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E9=92=88=E5=AF=B9EDI=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9D=A5=E6=BA=90=E7=94=9F=E6=88=90=E6=A0=87=E7=AD=BE=E6=97=B6?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E5=90=8C=E6=97=B6=E7=94=9F=E6=88=90=E6=89=98?= =?UTF-8?q?=E6=A0=87=E7=AD=BE&=E7=AE=B1=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/LabelForm/index.ts | 3 + src/components/LabelForm/src/LabelForm.vue | 622 ++++++++++++++++++ .../purchasereceiptRequestMain/index.vue | 174 ++++- .../purchasereceiptRequestMain.data.ts | 155 +---- 4 files changed, 803 insertions(+), 151 deletions(-) create mode 100644 src/components/LabelForm/index.ts create mode 100644 src/components/LabelForm/src/LabelForm.vue diff --git a/src/components/LabelForm/index.ts b/src/components/LabelForm/index.ts new file mode 100644 index 000000000..d8d8c4173 --- /dev/null +++ b/src/components/LabelForm/index.ts @@ -0,0 +1,3 @@ +import LabelForm from './src/LabelForm.vue' + +export { LabelForm } diff --git a/src/components/LabelForm/src/LabelForm.vue b/src/components/LabelForm/src/LabelForm.vue new file mode 100644 index 000000000..a51ca0c70 --- /dev/null +++ b/src/components/LabelForm/src/LabelForm.vue @@ -0,0 +1,622 @@ + + + \ No newline at end of file diff --git a/src/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRequestMain/index.vue b/src/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRequestMain/index.vue index 5a13c2864..7710bb23a 100644 --- a/src/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRequestMain/index.vue +++ b/src/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRequestMain/index.vue @@ -106,15 +106,22 @@ @success="getList" :tableAllSchemas="PurchasereceiptRequestDetailLabel.allSchemas" :tableFormRules="PurchasereceiptRequestDetailRules" - :tableData="detatableDataLabel.tableList" + :tableData="detatableData1" :isBusiness="true" :isShowButton="false" + @searchTableSuccess="searchTableSuccessLabel" :isShowReduceButton="false" + @clearInput="clearInput" + :footButttondata="footButttondata" + @footButtonClick="footButtonClick" + @formSelectChange="formSelectChangeLabel" + /> + - { openForm('update', row) } else if(val == 'ssbq'){ // 生成标签 // 生成标签 - detatableDataLabel.params = { - masterId:row.masterId - } - genLabelId.value = row.masterId + // detatableDataLabel.params = { + // masterId:row.masterId + // } + // genLabelId.value = row.masterId // 数据来源是EDI默认让输入生产日期 if (row.sourceType == 'EDI') { PurchasereceiptRequestDetailLabel.allSchemas.tableFormColumns.forEach(item => { @@ -455,7 +463,8 @@ const buttonTableClick = async (val, row) => { } }) } - await getDetailListList() + await getGenerateLabelList(row) + count.value++ formLabelRef.value.open('create', row, null,'createLabel')//创建标签页面 createLabel 标题 }else if (val == 'point') { // 标签打印 @@ -481,7 +490,6 @@ const checkQualityReport = async (row)=>{ } // 生成标签 -const isCreateLabel = ref(false) const formLabelRef = ref() const { tableObject: detatableData, tableMethods: detatableMethods } =useTable({ getListApi: PurchasereceiptRequestDetailApi.getPurchasereceiptRequestDetailPage @@ -489,34 +497,142 @@ const { tableObject: detatableData, tableMethods: detatableMethods } =useTable({ const { getList:getDetailList } = detatableMethods -const { tableObject: detatableDataLabel, tableMethods: detatableMethodLabels } =useTable({ - getListApi: PurchasereceiptRequestDetailApi.getPurchasereceiptRequestDetailLabelList -}) -const { getList:getDetailListList } = detatableMethodLabels - +// const { tableObject: detatableDataLabel, tableMethods: detatableMethodLabels } =useTable({ +// getListApi: PurchasereceiptRequestDetailApi.getPurchasereceiptRequestDetailLabelList +// }) +// const { getList:getDetailListList } = detatableMethodLabels +const count = ref(0) +const footButttondata = ref([ + defaultButtons.formNextStepBtn(null), // BOM下一步 + defaultButtons.formCloseBtn(null) // BOM关闭 +]) +const detatableData1 = ref([]) +// 获取箱规格 +const getGenerateLabelList = async (row) => { + const params1 = { + masterId: row.masterId, + pageSize: '500', + pageNo: '1', + sort: '', + by: 'ASC' + } + await PurchasereceiptRequestDetailApi.getPurchasereceiptRequestDetailLabelList(params1).then((res) => { + detatableData1.value = res + detatableData1.value.forEach((item) => { + // console.log(3333, item?.boxPackaging[0]) + item.boxPackaging = item.boxPackaging ? item.boxPackaging : [] + item.packUnitInitOptions = item.boxPackaging + item.secondPackUnitInitOptions = item.palletPackaging || [] + let obj = item?.boxPackaging[0] + if (obj) { + item.packUnit = obj.packUnit + item.packQty = obj.packQty + } + // 有托规格显示托规格,没有显示第一条规格 + item.secondPackUnit = obj?.parentPackUnit + ? obj.parentPackUnit + : item?.secondPackUnitInitOptions[0]?.packUnit + item.secondPackQty = obj?.parentPackUnit + ? obj.parentPackQty + : item?.secondPackUnitInitOptions[0]?.packQty + }) + }) +} -// 生成标签按钮操作 -const submitFormLabel = async (formType, submitData) => { - let data = {...submitData} - if(data.masterId){ - data.id = data.masterId +const clearInput = async (field, row, index) => { + row[field] = '' + row['secondPackQty'] = '' + PurchasereceiptRequestDetailRules.secondPackQty[0].required = false +} +// 下一步 +const labelFormRef = ref() +const footButtonClick = async (val) => { + if (val == 'nextStep') { + const validateForm = await formLabelRef.value.tableFormRef.validateForm() + if (!validateForm) { + return + } + let isNext = detatableData1.value.some((item) => { + return !item.packUnit || !item.packQty + }) + if (isNext) { + message.warning('有数据没有选择箱规格') + return + } + let isNext1 = detatableData1.value.some((item) => { + return ( + item.secondPackQty && + item.packQty && + parseFloat(item.packQty) > parseFloat(item.secondPackQty) + ) + }) + if (isNext1) { + message.warning('托的包装数量要大于箱的包装数量,请修改') + return + } + const data = JSON.parse(JSON.stringify(detatableData1.value)) + labelFormRef.value.openLabel(data) + } else if (val == 'close') { + formLabelRef.value.dialogVisible = false } +} +// 选择箱规格 拖规格 +const formSelectChangeLabel = (field, val, row) => { + if (field == 'packUnit') { + let obj = row.boxPackaging.find((item) => item.packUnit == val) + if (obj) { + row.packQty = obj.packQty + // 获取托规格 + const params1 = { + itemCode: row.itemCode, + packUnit: row.packUnit + } + SupplierdeliverRequestDetailApi.getGenerateLabelParentList(params1).then((res) => { + if (res?.length > 0) { + row.secondPackUnit = res[0].packUnit + row.secondPackQty = res[0].packQty + } else { + row.secondPackUnit = row?.secondPackUnitInitOptions[0]?.packUnit + row.secondPackQty = row?.secondPackUnitInitOptions[0]?.packQty + } + }) + } else { + row.packQty = '' + row.secondPackUnit = '' + row.secondPackQty = '' + } + } + // 设置托 + if (field == 'secondPackUnit') { + let obj = row.secondPackUnitInitOptions.find((item) => item.packUnit == val) + if (obj) { + row.secondPackQty = obj.packQty + } else { + row.secondPackQty = '' + } + } +} +// 生成标签按钮操作 +const submitFormLabel = async (list) => { try { - console.log("formType==",formType) - console.log("data==",data) - data.subList = detatableData.tableList - console.log("detatableData",detatableData) + const data = { + subList: list + } await message.confirm(t('ts.是否为此数据生成标签?')) - await PurchasereceiptRequestMainApi.genLabel(data) //genLabelId.value - isCreateLabel.value = true - message.success('创建标签成功') + labelFormRef.value.isLoading = true + await PurchasereceiptRequestMainApi.genLabel(data) + message.success(t('ts.创建标签成功')) + getList() } finally { formLabelRef.value.formLoading = false formLabelRef.value.dialogVisible = false - buttonBaseClick('refresh',null); + labelFormRef.value.formLoading = false + labelFormRef.value.dialogTableVisible = false + labelFormRef.value.isLoading = false } } + const BASE_URL = getJmreportBaseUrl() const src = ref(BASE_URL + '/jmreport/view/922729953438072832?token=' + getAccessToken()) diff --git a/src/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRequestMain/purchasereceiptRequestMain.data.ts b/src/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRequestMain/purchasereceiptRequestMain.data.ts index 31f3f898c..dee8a1ac0 100644 --- a/src/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRequestMain/purchasereceiptRequestMain.data.ts +++ b/src/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRequestMain/purchasereceiptRequestMain.data.ts @@ -2351,7 +2351,23 @@ export const PurchasereceiptRequestDetailLabel = useCrudSchemas(reactive