From c9a53c60493db942d8751ce632eed6e8a23c29c0 Mon Sep 17 00:00:00 2001 From: chenjianan Date: Wed, 5 Jun 2019 09:41:08 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=A6=BB=E7=BA=BF=E7=A8=8E=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/PurchasingCenter/OfflineContract.js | 8 +- .../OfflineContract/index.vue | 78 ++++++++++++++++--- 2 files changed, 72 insertions(+), 14 deletions(-) diff --git a/src/api/PurchasingCenter/OfflineContract.js b/src/api/PurchasingCenter/OfflineContract.js index 11414bc7..37be21be 100644 --- a/src/api/PurchasingCenter/OfflineContract.js +++ b/src/api/PurchasingCenter/OfflineContract.js @@ -135,26 +135,26 @@ export function deleteMateriel(num) { }) } // 保存离线合同 -export function saveOfflineContact(contractNum, total, partGroup, numGroup, priceGroup, dateGroup, remarkGroup) { +export function saveOfflineContact(contractNum, total, partGroup, numGroup, priceGroup, dateGroup, remarkGroup, taxRate) { return request({ url: '', method: 'post', data: { type: '2', name: '采购管理_离线合同_保存合同', - param: `离线合同流水号=${contractNum}&合同总额=${total}&离线合同明细流水号组=${partGroup}&数量组=${numGroup}&单价组=${priceGroup}&交货期要求组=${dateGroup}&备注组=${remarkGroup}` + param: `离线合同流水号=${contractNum}&合同总额=${total}&离线合同明细流水号组=${partGroup}&数量组=${numGroup}&单价组=${priceGroup}&交货期要求组=${dateGroup}&备注组=${remarkGroup}&税率=${taxRate}` } }) } // 生成离线合同 -export function doneOfflineContact(contractNum, total, partGroup, numGroup, priceGroup, dateGroup, remarkGroup) { +export function doneOfflineContact(contractNum, total, partGroup, numGroup, priceGroup, dateGroup, remarkGroup, taxRate) { return request({ url: '', method: 'post', data: { type: '2', name: '采购管理_离线合同_生成合同', - param: `离线合同流水号=${contractNum}&合同总额=${total}&离线合同明细流水号组=${partGroup}&数量组=${numGroup}&单价组=${priceGroup}&交货期要求组=${dateGroup}&备注组=${remarkGroup}` + param: `离线合同流水号=${contractNum}&合同总额=${total}&离线合同明细流水号组=${partGroup}&数量组=${numGroup}&单价组=${priceGroup}&交货期要求组=${dateGroup}&备注组=${remarkGroup}&税率=${taxRate}` } }) } diff --git a/src/views/PurchasingCenter/OfflineContract/index.vue b/src/views/PurchasingCenter/OfflineContract/index.vue index 0f7f426b..4cbe4b4f 100644 --- a/src/views/PurchasingCenter/OfflineContract/index.vue +++ b/src/views/PurchasingCenter/OfflineContract/index.vue @@ -344,6 +344,17 @@ @current-change="handleCurrentChange2"/> 生成 保存 + + + + +

税率:

@@ -381,14 +392,26 @@ {{ scope.row.参考价格 }} - + - + + + + + + + @@ -669,6 +692,8 @@ export default { name: '', // 离线合同 data() { return { + hasTax: '含税', + taxRate: 0.13, source: [ { text: 'BZ', @@ -1052,7 +1077,10 @@ export default { searchMateriel(this.offlineContractNum).then(response => { this.tableData3 = response.data this.tableData3.map(v => { + this.$set(v, '未税总额', 0) + this.$set(v, '含税总额', 0) !v.单价 ? v.单价 = v.参考价格 : v.单价 + this.$set(v, '未税单价', v.单价 / (1 + this.taxRate)) }) }) } else { this.$message.error('数据占用,删除失败') } @@ -1124,7 +1152,10 @@ export default { console.log(response.data) this.tableData3 = response.data this.tableData3.map(v => { + this.$set(v, '未税总额', 0) + this.$set(v, '含税总额', 0) !v.单价 ? v.单价 = v.参考价格 : v.单价 + this.$set(v, '未税单价', v.单价 / (1 + this.taxRate)) }) }) Number(row.离线合同状态) !== 1 ? this.disable = true : this.disable = false // 是否为编辑模式 @@ -1135,8 +1166,23 @@ export default { columns.forEach((column, index) => { if (index === 0) { sums[index] = '总价' - } else if (index === 7) { - const values = data.map(item => Number(Number(item['单价']) * Number(item['数量']))) + } else if (index === 9) { + const values = data.map(item => Number(item['未税总额'])) + if (!values.every(value => isNaN(value))) { + sums[index] = values.reduce((prev, curr) => { + const value = Number(curr) + if (!isNaN(value)) { + return Number((prev + curr).toFixed(2)) + } else { + return Number((prev).toFixed(2)) + } + }, 0) + sums[index] += ' 元' + } else { + sums[index] = 'N/A' + } + } else if (index === 10) { + const values = data.map(item => Number(item['含税总额'])) if (!values.every(value => isNaN(value))) { sums[index] = values.reduce((prev, curr) => { const value = Number(curr) @@ -1168,7 +1214,10 @@ export default { searchMateriel(this.offlineContractNum).then(response => { this.tableData3 = response.data this.tableData3.map(v => { + this.$set(v, '未税总额', 0) + this.$set(v, '含税总额', 0) !v.单价 ? v.单价 = v.参考价格 : v.单价 + this.$set(v, '未税单价', v.单价 / (1 + this.taxRate)) }) }) } else { this.$message.error('选入失败') } @@ -1187,7 +1236,10 @@ export default { searchMateriel(this.offlineContractNum).then(response => { this.tableData3 = response.data this.tableData3.map(v => { + this.$set(v, '未税总额', 0) + this.$set(v, '含税总额', 0) !v.单价 ? v.单价 = v.参考价格 : v.单价 + this.$set(v, '未税单价', v.单价 / (1 + this.taxRate)) }) }) } else { this.$message.error('移除失败') } @@ -1215,18 +1267,21 @@ export default { this.totalPrice += this.tableData3[i].数量 * this.tableData3[i].单价 this.partGroup.push(this.tableData3[i].离线合同明细流水号) this.numGroup.push(this.tableData3[i].数量) - this.priceGroup.push(this.tableData3[i].单价) + this.hasTax === '含税' ? this.priceGroup.push(this.tableData3[i].单价) : this.priceGroup.push(this.tableData3[i].未税单价 * (1 + this.taxRate)) dateGroup.push(this.tableData3[i].交货期要求) remarkGroup.push(this.tableData3[i].备注) } - saveOfflineContact(this.offlineContractNum, this.totalPrice, this.partGroup, this.numGroup, this.priceGroup, dateGroup, remarkGroup).then(response => { + saveOfflineContact(this.offlineContractNum, this.totalPrice, this.partGroup, this.numGroup, this.priceGroup, dateGroup, remarkGroup, this.taxRate * 100).then(response => { if (response.data[0].result === '1') { this.$message.success('离线合同保存成功') this.searchTable2() searchMateriel(this.offlineContractNum).then(response => { this.tableData3 = response.data this.tableData3.map(v => { + this.$set(v, '未税总额', 0) + this.$set(v, '含税总额', 0) !v.单价 ? v.单价 = v.参考价格 : v.单价 + this.$set(v, '未税单价', v.单价 / (1 + this.taxRate)) }) }) } else { this.$message.error('离线合同保存失败') } @@ -1254,18 +1309,21 @@ export default { this.totalPrice += this.tableData3[i].数量 * this.tableData3[i].单价 this.partGroup.push(this.tableData3[i].离线合同明细流水号) this.numGroup.push(this.tableData3[i].数量) - this.priceGroup.push(this.tableData3[i].单价) + this.hasTax === '含税' ? this.priceGroup.push(this.tableData3[i].单价) : this.priceGroup.push(this.tableData3[i].未税单价 * (1 + this.taxRate)) dateGroup.push(this.tableData3[i].交货期要求) remarkGroup.push(this.tableData3[i].备注) } - doneOfflineContact(this.offlineContractNum, this.totalPrice, this.partGroup, this.numGroup, this.priceGroup, dateGroup, remarkGroup).then(response => { + doneOfflineContact(this.offlineContractNum, this.totalPrice, this.partGroup, this.numGroup, this.priceGroup, dateGroup, remarkGroup, this.taxRate * 100).then(response => { if (response.data[0].result === '1') { this.$message.success('离线合同生成成功') this.searchTable2() searchMateriel(this.offlineContractNum).then(response => { this.tableData3 = response.data this.tableData3.map(v => { + this.$set(v, '未税总额', 0) + this.$set(v, '含税总额', 0) !v.单价 ? v.单价 = v.参考价格 : v.单价 + this.$set(v, '未税单价', v.单价 / (1 + this.taxRate)) }) this.disable = true // 是否为编辑模式 }) From 13d9ed148a4503677dcbaae121c6db81e5c5dc66 Mon Sep 17 00:00:00 2001 From: chenjianan Date: Wed, 5 Jun 2019 11:04:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8A=A0=E5=B7=A5=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debug.log | 1 + src/api/ManufacturingCenter/ProcessingStatus.js | 2 +- src/views/ManufacturingCenter/ProcessingStatus/index.vue | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/debug.log b/debug.log index af455d92..d69cf9be 100644 --- a/debug.log +++ b/debug.log @@ -1,3 +1,4 @@ [0301/083149.303:ERROR:http_transport_win.cc(273)] WinHttpSendRequest: ɹɡ (0x0) [0515/102246.688:ERROR:http_transport_win.cc(276)] WinHttpSendRequest: ɹɡ (0x0) [0531/081503.881:ERROR:http_transport_win.cc(276)] WinHttpSendRequest: ɹɡ (0x0) +[0605/094355.406:ERROR:http_transport_win.cc(276)] WinHttpSendRequest: ɹɡ (0x0) diff --git a/src/api/ManufacturingCenter/ProcessingStatus.js b/src/api/ManufacturingCenter/ProcessingStatus.js index aa1e8c88..317e62b8 100644 --- a/src/api/ManufacturingCenter/ProcessingStatus.js +++ b/src/api/ManufacturingCenter/ProcessingStatus.js @@ -75,7 +75,7 @@ inner join 车间生产管理工艺_零件工艺计划 on 当前加工工序表. inner join 车间生产管理工艺_零件工序 on 当前加工工序表.工艺计划流水号 = 车间生产管理工艺_零件工序.工艺计划流水号 and 当前加工工序表.待加工工序顺序 = 车间生产管理工艺_零件工序.工序顺序 inner join 车间生产管理工艺_基础表_工艺名称 on 车间生产管理工艺_基础表_工艺名称.工艺编号 = 车间生产管理工艺_零件工序.工艺编号 inner join 车间生产管理工艺_零件工序_视图 on 车间生产管理工艺_零件工序_视图.工艺计划流水号 = 车间生产管理工艺_零件工艺计划.工艺计划流水号 and 当前加工工序表.待加工工序顺序 = 车间生产管理工艺_零件工序_视图.工序顺序 -where 组件流水号 = ${num}` +where 机床流水号 = ${num}` } }) } diff --git a/src/views/ManufacturingCenter/ProcessingStatus/index.vue b/src/views/ManufacturingCenter/ProcessingStatus/index.vue index 73b88622..d9e850ea 100644 --- a/src/views/ManufacturingCenter/ProcessingStatus/index.vue +++ b/src/views/ManufacturingCenter/ProcessingStatus/index.vue @@ -391,11 +391,11 @@ export default { })) }, exportExcel() { - if (!this.Group) { - this.$message.warning('请选择分组') + if (!this.Machine) { + this.$message.warning('请选择机床') return } - getExport(this.Group).then(res => { + getExport(this.Machine).then(res => { console.log(res.data) import('@/vendor/Export2Excel').then(excel => { const tHeader = ['机床', '组号', '图号及规格', '制品名称', '计划数', '材料', '当前工序名']