diff --git a/src/views/PurchasingManagement/OrderInquiry/index.vue b/src/views/PurchasingManagement/OrderInquiry/index.vue index 7c88a7a8..de4d60af 100644 --- a/src/views/PurchasingManagement/OrderInquiry/index.vue +++ b/src/views/PurchasingManagement/OrderInquiry/index.vue @@ -470,7 +470,7 @@ @@ -711,6 +711,10 @@ export default { limit: 20, Data: {}, upload: url, + uploadSaving: false, + uploadFileTotal: 0, + uploadFileFinished: 0, + uploadFileFailed: 0, consignee: '', receiverTelephoneNumber: '', loading: false, // 数据加载 @@ -1025,10 +1029,15 @@ export default { now.getSeconds().toString().padStart(2, '0') + now.getMilliseconds().toString().padStart(3, '0') const suffix = file.name.split('.').pop() || 'jpg' - const savePath = MESUploadFileNew_BasePath + '\\OrderInquiry\\' + timestamp + '-' + this.purchaseContractID + '.' + suffix + const lastDotIndex = file.name.lastIndexOf('.') + const fileName = lastDotIndex > -1 ? file.name.slice(0, lastDotIndex) : file.name + const sqlFileName = fileName.replace(/'/g, "''") + const sqlSuffix = suffix.replace(/'/g, "''") + const uniqueCode = Math.random().toString(36).slice(2, 8) + const savePath = MESUploadFileNew_BasePath + '\\OrderInquiry\\' + timestamp + '-' + this.purchaseContractID + '-' + uniqueCode + '.' + suffix // 构造SQL语句 - const sqlStatement = `update 采购管理_采购合同查询_图片 set 文件内容 = NULL, 文件路径 = N'${savePath}' where id = (select top 1 id from 采购管理_采购合同查询_图片 where 采购合同流水号 = ${this.purchaseContractID} and 文件路径 is null order by 操作时间 desc)` + const sqlStatement = `update 采购管理_采购合同查询_图片 set 文件内容 = NULL, 文件路径 = N'${savePath}' where id = (select top 1 id from 采购管理_采购合同查询_图片 where 采购合同流水号 = ${this.purchaseContractID} and 文件名称 = N'${sqlFileName}' and 文件后缀 = N'${sqlSuffix}' and 文件路径 is null order by 操作时间 desc, id desc); IF @@ROWCOUNT <> 1 RAISERROR(N'图片路径回填失败', 16, 1)` // 调用新接口保存文件 const formData = new FormData() @@ -1042,10 +1051,24 @@ export default { if (response.data && response.data[0] && response.data[0].result === '1') { console.log('文件保存成功:', savePath) } else { + this.uploadFileFailed++ console.error('文件保存失败:', response.data) } }).catch(err => { + this.uploadFileFailed++ console.error('文件保存异常:', err) + }).finally(() => { + this.uploadFileFinished++ + if (this.uploadFileFinished >= this.uploadFileTotal) { + this.uploadSaving = false + if (this.uploadFileFailed === 0) { + this.$message.success('图片上传成功') + this.dialogFormVisible2 = false + this.$refs.upload.clearFiles() + } else { + this.$message.error('部分图片上传失败,请重新上传失败图片') + } + } }) // this.dialogFormVisible2 = false @@ -1060,6 +1083,14 @@ export default { // } }, submitPicture() { + if (!this.$refs.upload || this.$refs.upload.uploadFiles.length === 0) { + this.$message.warning('请选择图片') + return + } + this.uploadSaving = true + this.uploadFileTotal = this.$refs.upload.uploadFiles.length + this.uploadFileFinished = 0 + this.uploadFileFailed = 0 var param = [] param[0] = ['采购合同流水号', this.purchaseContractID] param[1] = ['文件名称', ''] @@ -1068,8 +1099,6 @@ export default { var Data1 = this.CreateData('15', '采购合同查询_上传图片', param) this.Data.param = Data1 this.$refs.upload.submit() - this.dialogFormVisible2 = false - this.$refs.upload.clearFiles() }, exportTable(row) { this.supplier = row.供应商 @@ -1469,31 +1498,13 @@ export default { if (this.arrivalTableData.length === 0) { this.$message.info('该合同下没有物料明细') } - // 生成入库单号:RK + 年月日 + 采购合同流水号 + 当天自增序号 - this.generate入库单号() + // 从后端获取入库单号 + if (response.data.length > 0 && response.data[0].入库单号) { + this.入库单号 = response.data[0].入库单号 + } }) }, - generate入库单号() { - var now = new Date() - var year = now.getFullYear() - var month = (now.getMonth() + 1).toString().padStart(2, '0') - var day = now.getDate().toString().padStart(2, '0') - var dateStr = '' + year + month + day - var storageKey = 'RK_SEQ_' + dateStr - var currentSeq = parseInt(localStorage.getItem(storageKey) || '0') + 1 - var seqStr = currentSeq.toString().padStart(1, '0') - this.入库单号 = 'RK' + dateStr + this.arrivalContractNo + seqStr - }, - increment入库单号Seq() { - var now = new Date() - var year = now.getFullYear() - var month = (now.getMonth() + 1).toString().padStart(2, '0') - var day = now.getDate().toString().padStart(2, '0') - var dateStr = '' + year + month + day - var storageKey = 'RK_SEQ_' + dateStr - var currentSeq = parseInt(localStorage.getItem(storageKey) || '0') + 1 - localStorage.setItem(storageKey, currentSeq.toString()) - }, + submitArrivalNotice() { const arrivalData = this.arrivalTableData.filter(item => item.到货数量 > 0) if (arrivalData.length === 0) { @@ -1528,7 +1539,6 @@ export default { duration: 3000 }) this.searchLeftTable() - this.increment入库单号Seq() this.dialogFormVisible4 = false } else { this.$message.error('通知失败') diff --git a/src/views/PurchasingManagement/PurchaseOrder/index.vue b/src/views/PurchasingManagement/PurchaseOrder/index.vue index 0b7751f7..e6bcacaf 100644 --- a/src/views/PurchasingManagement/PurchaseOrder/index.vue +++ b/src/views/PurchasingManagement/PurchaseOrder/index.vue @@ -1302,10 +1302,15 @@ export default { now.getSeconds().toString().padStart(2, '0') + now.getMilliseconds().toString().padStart(3, '0') const suffix = file.name.split('.').pop() || 'jpg' - const savePath = MESUploadFileNew_BasePath + '\\OrderInquiry\\' + timestamp + '-' + this.purchaseContractID + '.' + suffix + const lastDotIndex = file.name.lastIndexOf('.') + const fileName = lastDotIndex > -1 ? file.name.slice(0, lastDotIndex) : file.name + const sqlFileName = fileName.replace(/'/g, "''") + const sqlSuffix = suffix.replace(/'/g, "''") + const uniqueCode = Math.random().toString(36).slice(2, 8) + const savePath = MESUploadFileNew_BasePath + '\\OrderInquiry\\' + timestamp + '-' + this.purchaseContractID + '-' + uniqueCode + '.' + suffix // 构造SQL语句 - const sqlStatement = `update 采购管理_采购合同查询_图片 set 文件内容 = NULL, 文件路径 = N'${savePath}' where id = (select top 1 id from 采购管理_采购合同查询_图片 where 采购合同流水号 = ${this.purchaseContractID} order by 操作时间 desc)` + const sqlStatement = `update 采购管理_采购合同查询_图片 set 文件内容 = NULL, 文件路径 = N'${savePath}' where id = (select top 1 id from 采购管理_采购合同查询_图片 where 采购合同流水号 = ${this.purchaseContractID} and 文件名称 = N'${sqlFileName}' and 文件后缀 = N'${sqlSuffix}' and 文件路径 is null order by 操作时间 desc, id desc); IF @@ROWCOUNT <> 1 RAISERROR(N'图片路径回填失败', 16, 1)` // 调用新接口保存文件 const formData = new FormData() diff --git a/src/views/SalesManagement/DeliveryRecord/index.vue b/src/views/SalesManagement/DeliveryRecord/index.vue index 0a167873..892d8c69 100644 --- a/src/views/SalesManagement/DeliveryRecord/index.vue +++ b/src/views/SalesManagement/DeliveryRecord/index.vue @@ -297,10 +297,15 @@ export default { now.getSeconds().toString().padStart(2, '0') + now.getMilliseconds().toString().padStart(3, '0') const suffix = file.name.split('.').pop() || 'jpg' - const savePath = MESUploadFileNew_BasePath + '\\DeliveryRecord\\' + timestamp + '-' + this.listValue + '.' + suffix + const lastDotIndex = file.name.lastIndexOf('.') + const fileName = lastDotIndex > -1 ? file.name.slice(0, lastDotIndex) : file.name + const sqlFileName = fileName.replace(/'/g, "''") + const sqlSuffix = suffix.replace(/'/g, "''") + const uniqueCode = Math.random().toString(36).slice(2, 8) + const savePath = MESUploadFileNew_BasePath + '\\DeliveryRecord\\' + timestamp + '-' + this.listValue + '-' + uniqueCode + '.' + suffix // 构造SQL语句:清空文件内容,更新文件路径 - const sqlStatement = `update 发货管理_发货单_图片 set 文件内容 = NULL, 文件路径 = N'${savePath}' where id = (select top 1 id from 发货管理_发货单_图片 where 发货单流水号 = ${this.listValue} order by 操作时间 desc)` + const sqlStatement = `update 发货管理_发货单_图片 set 文件内容 = NULL, 文件路径 = N'${savePath}' where id = (select top 1 id from 发货管理_发货单_图片 where 发货单流水号 = ${this.listValue} and 文件名称 = N'${sqlFileName}' and 文件后缀 = N'${sqlSuffix}' and 文件路径 is null order by 操作时间 desc, id desc); IF @@ROWCOUNT <> 1 RAISERROR(N'图片路径回填失败', 16, 1)` // 调用新接口保存文件到磁盘 const formData = new FormData() @@ -563,4 +568,3 @@ export default { width: 50px!important; } - diff --git a/src/views/SalesManagement/ProductDelivery/index.vue b/src/views/SalesManagement/ProductDelivery/index.vue index 62e9fcd2..8a003bfc 100644 --- a/src/views/SalesManagement/ProductDelivery/index.vue +++ b/src/views/SalesManagement/ProductDelivery/index.vue @@ -1280,10 +1280,15 @@ export default { now.getSeconds().toString().padStart(2, '0') + now.getMilliseconds().toString().padStart(3, '0') const suffix = file.name.split('.').pop() || 'jpg' - const savePath = MESUploadFileNew_BasePath + '\\DeliveryRecord\\' + timestamp + '-' + this.listValue + '.' + suffix + const lastDotIndex = file.name.lastIndexOf('.') + const fileName = lastDotIndex > -1 ? file.name.slice(0, lastDotIndex) : file.name + const sqlFileName = fileName.replace(/'/g, "''") + const sqlSuffix = suffix.replace(/'/g, "''") + const uniqueCode = Math.random().toString(36).slice(2, 8) + const savePath = MESUploadFileNew_BasePath + '\\DeliveryRecord\\' + timestamp + '-' + this.listValue + '-' + uniqueCode + '.' + suffix // 构造SQL语句:清空文件内容,更新文件路径 - const sqlStatement = `update 发货管理_发货单_图片 set 文件内容 = NULL, 文件路径 = N'${savePath}' where id = (select top 1 id from 发货管理_发货单_图片 where 发货单流水号 = ${this.listValue} order by 操作时间 desc)` + const sqlStatement = `update 发货管理_发货单_图片 set 文件内容 = NULL, 文件路径 = N'${savePath}' where id = (select top 1 id from 发货管理_发货单_图片 where 发货单流水号 = ${this.listValue} and 文件名称 = N'${sqlFileName}' and 文件后缀 = N'${sqlSuffix}' and 文件路径 is null order by 操作时间 desc, id desc); IF @@ROWCOUNT <> 1 RAISERROR(N'图片路径回填失败', 16, 1)` // 调用新接口保存文件到磁盘 const formData = new FormData() diff --git a/src/views/SeikoWorkshop/WorkshopAssignment/index.vue b/src/views/SeikoWorkshop/WorkshopAssignment/index.vue index 49a9416d..097533d1 100644 --- a/src/views/SeikoWorkshop/WorkshopAssignment/index.vue +++ b/src/views/SeikoWorkshop/WorkshopAssignment/index.vue @@ -957,6 +957,7 @@ export default { param[1] = ['数量', row.数量] param[2] = ['工艺任务流水号', row.工艺任务流水号] param[3] = ['退货人', this.id] + param[4] = ['订单流水号', row.订单流水号] // 参数数量与名称要与存储过程对应 var Data = this.CreateData('12', '车间生产管理工艺_零件工序_取消派工', param) this.ExecDatabase(Data).then(response => { diff --git a/src/views/TechnologyCenter/MaterialMaintain/index.vue b/src/views/TechnologyCenter/MaterialMaintain/index.vue index 2adab4d8..39dfdfcf 100644 --- a/src/views/TechnologyCenter/MaterialMaintain/index.vue +++ b/src/views/TechnologyCenter/MaterialMaintain/index.vue @@ -37,9 +37,9 @@ style="margin-left:10px" @click="pageCurrent=1;searchTable()">查询 - + 采购变更申请 @@ -209,6 +209,7 @@ style="margin-right: 10px" @click="handleEdit(scope.row)"/> + + + + + + + + +