diff --git a/ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html b/ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html index 9ff58600..3d58390d 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html @@ -732,7 +732,7 @@ return new Promise((resolve, reject) => { // 使用AJAX请求从服务器获取最近的报价信息 $.ajax({ - url: prefix + '/queryLatestRecentQuotation', // 假设这是你的API路径 + url: prefix + '/queryLatestRecentQuotation', type: 'GET', data: { materialNo: materialNo, customerCode: $("#customerCode").val() }, success: function (data) { diff --git a/ruoyi-admin/src/main/resources/templates/system/customerQuote/edit.html b/ruoyi-admin/src/main/resources/templates/system/customerQuote/edit.html index 5cf6f49d..580f4825 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/edit.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/edit.html @@ -502,7 +502,7 @@ return new Promise((resolve, reject) => { // 使用AJAX请求从服务器获取最近的报价信息 $.ajax({ - url: prefix + '/queryLatestRecentQuotation', // 假设这是你的API路径 + url: prefix + '/queryLatestRecentQuotation', type: 'GET', data: { materialNo: materialNo, customerCode: $("#customerCode").val() }, success: function (data) { diff --git a/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskModifyApply.html b/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskModifyApply.html index 532f4474..c09d3a44 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskModifyApply.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskModifyApply.html @@ -563,7 +563,7 @@ return new Promise((resolve, reject) => { // 使用AJAX请求从服务器获取最近的报价信息 $.ajax({ - url: prefix + '/queryLatestRecentQuotation', // 假设这是你的API路径 + url: prefix + '/queryLatestRecentQuotation', type: 'GET', data: { materialNo: materialNo, customerCode: $("#customerCode").val() }, success: function (data) { diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html index 4e962ad2..ae29ab92 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html @@ -332,7 +332,7 @@ id:'bootstrap-sub-table-order', pagination: false, sidePagination: "client", - model: "物料报价信息", + model: "物料信息", fixedColumns: true, // 启用冻结列 fixedRightNumber: 1, // 冻结右列个数 columns: [ @@ -994,7 +994,7 @@ return new Promise((resolve, reject) => { // 使用AJAX请求从服务器获取最近的报价信息 $.ajax({ - url: ctx + 'system/customerQuote/queryLatestRecentQuotation', // 假设这是你的API路径 + url: ctx + 'system/customerQuote/queryLatestRecentQuotation', type: 'GET', data: { materialNo: materialNo, customerCode: $("#enterpriseCode").val() }, success: function (data) { diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/detail.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/detail.html index b6a9e32b..3527f379 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/detail.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/detail.html @@ -338,7 +338,7 @@ showToggle: false, showColumns: false, pagination: false, // 设置不分页 - model: "物料报价信息", + model: "物料信息", columns: [ {checkbox: true}, {field: 'index',align: 'center', title: "序号", @@ -356,6 +356,17 @@ { title: '单位',field: 'unit',align: 'center', formatter: function(value, row, index) {return $.table.selectDictLabel(sysUnitClassDatas, value);}}, {title: '半成品类型',field: 'processMethod',align: 'center',formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);}}, { title: '对外售价',field: 'materialSole'}, + { title: '最新报价(RMB)',field: 'recentQuotationRMB',align: 'center',}, + { title: '最新报价(美元)',field: 'recentQuotationUSD',align: 'center',}, + { title: '最新报价历史',align: 'center', + + formatter: function (value, row, index) { + var actions = []; + actions.push('最新报价历史 '); + return actions.join(''); + } + }, + {title: '国内税率',field: 'countTax',align: 'center'}, { title: '美元汇率',field: 'usdTax', align: 'center'}, { title: '物料的不含税单价(RMB)', @@ -629,6 +640,19 @@ autoclose: true }); // 结算金额 + + + //最新报价历史 + function recentQuotationHistory(materialCode){ + var customerCode = $("#enterpriseCode").val(); + var queryParams = new URLSearchParams(); + queryParams.append("materialCode", materialCode); + queryParams.append("customerCode", encodeURIComponent(customerCode)); + var url = ctx +'system/customerQuote/recentQuotationHistory?'+queryParams.toString(); + + $.modal.open("最新报价历史", url); + } + diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/edit.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/edit.html index 542852a9..3c58ff1f 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/edit.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/edit.html @@ -348,7 +348,7 @@ queryParams: queryParams, sidePagination: "client", uniqueId: "index", - model: "物料报价信息", + model: "物料信息", fixedColumns: true, // 启用冻结列 rightFixedColumns:1, fixedRightNumber: 1, // 冻结右列个数 @@ -748,6 +748,10 @@ } layer.close(index); } + + + + function insertRow() { var url = ctx + "erp/material/select"; var options = { diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/taskModifyApply.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/taskModifyApply.html index c4694bc6..359b4342 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/taskModifyApply.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/taskModifyApply.html @@ -372,6 +372,16 @@ } }, { title: '对外售价',field: 'materialSole',editable: true}, + { title: '最新报价(RMB)',field: 'recentQuotationRMB',align: 'center',}, + { title: '最新报价(美元)',field: 'recentQuotationUSD',align: 'center',}, + { title: '最新报价历史',align: 'center', + + formatter: function (value, row, index) { + var actions = []; + actions.push('最新报价历史 '); + return actions.join(''); + } + }, {title: '国内税率',field: 'countTax',align: 'center',editable: true}, { title: '美元汇率',field: 'usdTax', align: 'center',editable: true}, {field: 'materialNum',align: 'center',title: '物料的数量',editable: true}, @@ -546,51 +556,88 @@ } function doSubmit(index, layero,uniqueId){ var iframeWin = window[layero.find('iframe')[0]['name']]; - var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0]; - console.log("rowData:"+rowData); - var totalNum = $("#bootstrap-select-table").bootstrapTable('getData').length; - var rmb1 = $("#taxRate_edit").val(); - if (rmb1 =='' || rmb1== null){ - rmb1 = 0; - }else{ - rmb1 = $("#taxRate_edit").val(); - } - var rmb = Number(rmb1).toFixed(2) / 100; - var usd = $("#usdTax_edit").val(); - if (usd =='' || usd== null){ - usd = 0; - }else{ - usd = Number(usd).toFixed(2); + var selectedRows = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections'); + + if (selectedRows.length == 0){ + $.modal.alertWarning("请选择至少一条物料信息"); + return; } - $("#bootstrap-sub-table-editOrder4").bootstrapTable('insertRow', { - index: 1, - row: { - id:'', - materialId:rowData.id, - materialCode: rowData.materialNo, - materialName: rowData.materialName, - materialType: rowData.materialType, - describe: rowData.describe, - brand: rowData.brand, - photoUrl: rowData.photoUrl, - unit: rowData.unit, - processMethod: rowData.processMethod, - countTax:rmb, - usdTax: usd, - materialSole: rowData.materialSole, - materialNum: 0, - materialNoRmb: 0.0, - materialNoUsd: 0.0, - materialRmb: 0.0, - materialNoRmbSum: 0.0, - materialRmbSum: 0, - materialUsd: 0.0, - materialUsdSum: 0.0, - materialNoUsdSum: 0.0, - remark: "", + + var existingData = $("#bootstrap-sub-table-order").bootstrapTable('getData'); + var materialCodesSet = new Set(); //使用Set来存储物料号 + + + //存储所有现有的物料号 + existingData.forEach(function(row){ + materialCodesSet.add(row.materialCode); + }); + + //存储所有即将插入的料号 + var newMaterialCodesSet = new Set(); + + var promises = selectedRows.map(rowData =>{ + //检查是否已经存在相同的料号 + if (materialCodesSet.has(rowData.materialNo) || newMaterialCodesSet.has(rowData.materialNo)){ + $.modal.alertError("不能选择已添加过的相同料号" + rowData.materialNo); + return Promise.reject("Duplicate material number: " + rowData.materialNo); } - }) - layer.close(index); + + //表记即将插入的物料号 + newMaterialCodesSet.add(rowData.materialNo); + + return queryRecentQuotation(rowData.materialNo) + .then(function(quotationData){ + return { + materialId: rowData.id, + materialCode: rowData.materialNo, + materialName: rowData.materialName, + materialType: rowData.materialType, + describe: rowData.describe, + brand: rowData.brand, + unit: rowData.unit, + processMethod: rowData.processMethod, + photoUrl: rowData.photoUrl, + warehouseDept: rowData.warehouseDept, + countTax: $("#taxRate_add").val(), + usdTax: $("#usdTax_add").val(), + materialSole: 0, + recentQuotationRMB: quotationData.data.materialRmb || '', + recentQuotationUSD: quotationData.data.materialUsd || '', + materialNum: "", + materialNoRmb: 0.00, + materialNoUsd: 0.00, + materialRmb: 0.00, + materialNoRmbSum: 0.00, + materialRmbSum: 0.00, + materialUsd: 0.00, + materialUsdSum: 0.00, + materialNoUsdSum: 0.00, + createBy: "", + createTime: "", + updateBy: "", + updateTime: "", + remark: "", + } + }) + + }); + + //使用promise.all来等待所有请求完成, 并将结果直接存入newRows + Promise.all(promises) + .then(function(newRows){ + + + //批量插入新行 + newRows.forEach(function(row){ + $("#bootstrap-sub-table-order").bootstrapTable('insertRow', {index: 1, row: row}); + }); + + layer.close(index); + }) + .catch(function(error){ + console.error('Some requests failed:', error); + layer.close(index); + }); } function insertRow() { var url = ctx + "erp/material/select"; @@ -685,6 +732,19 @@ } } } + + + //最新报价历史 + function recentQuotationHistory(materialCode){ + var customerCode = $("#enterpriseCode").val(); + var queryParams = new URLSearchParams(); + queryParams.append("materialCode", materialCode); + queryParams.append("customerCode", encodeURIComponent(customerCode)); + var url = ctx +'system/customerQuote/recentQuotationHistory?'+queryParams.toString(); + + $.modal.open("最新报价历史", url); + } + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/taskYwjlVerify.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/taskYwjlVerify.html index a8cb64e0..e0dd02b3 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/taskYwjlVerify.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/taskYwjlVerify.html @@ -356,6 +356,17 @@ { title: '单位',field: 'unit',align: 'center', formatter: function(value, row, index) {return $.table.selectDictLabel(sysUnitClassDatas, value);}}, {title: '半成品类型',field: 'processMethod',align: 'center',formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);}}, { title: '对外售价',field: 'materialSole'}, + { title: '最新报价(RMB)',field: 'recentQuotationRMB',align: 'center',}, + { title: '最新报价(美元)',field: 'recentQuotationUSD',align: 'center',}, + { title: '最新报价历史',align: 'center', + + formatter: function (value, row, index) { + var actions = []; + actions.push('最新报价历史 '); + return actions.join(''); + } + }, + {title: '国内税率',field: 'countTax',align: 'center'}, { title: '美元汇率',field: 'usdTax', align: 'center'}, { title: '物料的不含税单价(RMB)', @@ -512,6 +523,17 @@ $.operate.save(prefix + "/complete/" + taskId,formData); } } + + //最新报价历史 + function recentQuotationHistory(materialCode){ + var customerCode = $("#enterpriseCode").val(); + var queryParams = new URLSearchParams(); + queryParams.append("materialCode", materialCode); + queryParams.append("customerCode", encodeURIComponent(customerCode)); + var url = ctx +'system/customerQuote/recentQuotationHistory?'+queryParams.toString(); + + $.modal.open("最新报价历史", url); + } \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/taskYwzgVerify.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/taskYwzgVerify.html index 3a05c3b0..08713791 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/taskYwzgVerify.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/taskYwzgVerify.html @@ -355,6 +355,18 @@ { title: '单位',field: 'unit',align: 'center', formatter: function(value, row, index) {return $.table.selectDictLabel(sysUnitClassDatas, value);}}, {title: '半成品类型',field: 'processMethod',align: 'center',formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);}}, { title: '对外售价',field: 'materialSole'}, + { title: '最新报价(RMB)',field: 'recentQuotationRMB',align: 'center',}, + { title: '最新报价(美元)',field: 'recentQuotationUSD',align: 'center',}, + { title: '最新报价历史',align: 'center', + + formatter: function (value, row, index) { + var actions = []; + actions.push('最新报价历史 '); + return actions.join(''); + } + }, + + {title: '国内税率',field: 'countTax',align: 'center'}, { title: '美元汇率',field: 'usdTax', align: 'center'}, { title: '物料的不含税单价(RMB)', @@ -530,6 +542,17 @@ } } + //最新报价历史 + function recentQuotationHistory(materialCode){ + var customerCode = $("#enterpriseCode").val(); + var queryParams = new URLSearchParams(); + queryParams.append("materialCode", materialCode); + queryParams.append("customerCode", encodeURIComponent(customerCode)); + var url = ctx +'system/customerQuote/recentQuotationHistory?'+queryParams.toString(); + + $.modal.open("最新报价历史", url); + } + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/taskZozjVerify.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/taskZozjVerify.html index 5b6873d4..86727c4a 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/taskZozjVerify.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/taskZozjVerify.html @@ -356,6 +356,17 @@ { title: '单位',field: 'unit',align: 'center', formatter: function(value, row, index) {return $.table.selectDictLabel(sysUnitClassDatas, value);}}, {title: '半成品类型',field: 'processMethod',align: 'center',formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);}}, { title: '对外售价',field: 'materialSole'}, + { title: '最新报价(RMB)',field: 'recentQuotationRMB',align: 'center',}, + { title: '最新报价(美元)',field: 'recentQuotationUSD',align: 'center',}, + { title: '最新报价历史',align: 'center', + + formatter: function (value, row, index) { + var actions = []; + actions.push('最新报价历史 '); + return actions.join(''); + } + }, + {title: '国内税率',field: 'countTax',align: 'center'}, { title: '美元汇率',field: 'usdTax', align: 'center'}, { title: '物料的不含税单价(RMB)', @@ -532,6 +543,17 @@ } } + //最新报价历史 + function recentQuotationHistory(materialCode){ + var customerCode = $("#enterpriseCode").val(); + var queryParams = new URLSearchParams(); + queryParams.append("materialCode", materialCode); + queryParams.append("customerCode", encodeURIComponent(customerCode)); + var url = ctx +'system/customerQuote/recentQuotationHistory?'+queryParams.toString(); + + $.modal.open("最新报价历史", url); + } + \ No newline at end of file