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 42e1a754..db5fdf3d 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html @@ -49,7 +49,7 @@
- +
@@ -65,7 +65,7 @@
- +
@@ -210,6 +210,7 @@ $("input[name='rmbTax']").val(data.taxRate); $("input[name='confirmFax']").val(data.confirmTax); commonCurrency = $("#commonCurrency_add option:selected").val(); + console.log("commonCurrency",commonCurrency); }); $(function() { var options = { @@ -266,17 +267,16 @@ { title: '物料的不含税单价(RMB)', field: 'materialNoRmb', align: 'center', - editable: commonCurrency == '1'?false:true, + editable: commonCurrency == 1?false:true, }, {title: '物料的不含税单价(USD)', field: 'materialNoUsd', align: 'center', - editable: commonCurrency == '2'?false:true, + editable: commonCurrency == 2?false:true, }, { title: '物料的含税单价(USD)', field: 'materialUsd', - align: 'center' - + align: 'center', }, { title: '物料的含税总价(USD)', field: 'materialUsdSum', @@ -343,34 +343,29 @@ } ], onEditableSave:function(field, row, oldValue, $el){ - if(field =="materialNum" && row.materialNum != '' && currentCurrency == '1'){ - $("#bootstrap-sub-table-quoteChild").bootstrapTable('updateByUniqueId', { - id: row.id, - row: { - materialNoRmb : row.materialNoRmb, - materialRmb : row.materialNoRmb * (1 + $("#rmbTax").val()), - materialNoUsd : row.materialNoRmb / $("#rmbTax").val(), - materialNoUsdSum : row.materialNoRmb / $("#rmbTax").val(), - materialUsd : row.materialNum * (row.materialNoRmb / $("#rmbTax").val()), - materialUsdSum : row.materialNum * (row.materialNoRmb / $("#rmbTax").val()), - materialNoRmbSum : row.materialNum * row.materialNoRmb, - materialRmbSum : row.materialNum * row.materialRmb - } - }); + commonCurrency = $("#commonCurrency_add option:selected").val(); + var Double = function(value) { + this.value = Number(value); + }; + var rmb1 = new Double($("#rmbTax").val()); + var rmb = rmb1 / 100; + var usd = new Double($("#usdTax").val()); + console.log(commonCurrency); + if(commonCurrency == 1){ + row.materialRmb = Number(row.materialNoRmb) * (1 + rmb); + row.materialNoUsd = Number(row.materialNoRmb) / rmb; + row.materialNoUsdSum = Number(row.materialNum) * Number(row.materialNoUsd); + row.materialUsd = Number(row.materialNoUsd); + row.materialUsdSum = Number(row.materialNum) * Number(row.materialUsd); + row.materialNoRmbSum = Number(row.materialNum) * Number(row.materialNoRmb); } - else if(field =="materialNum" && row.materialNum != '' && currentCurrency == '2'){ - $("#bootstrap-sub-table-quoteChild").bootstrapTable('updateByUniqueId', { - id: row.id, - row: { - materialUsd : row.materialNoUsd, - materialUsdSum : row.materialNum * row.materialUsd, - materialNoUsdSum : row.materialNoUsd * row.materialNum, - materialNoRmb : $("#usdTax").val() * row.materialNoUsd, - materialRmb : $("#usdTax").val() * row.materialNoUsd * (1 + $("#rmbTax").val()), - materialNoRmbSum : row.materialNoRmb * row.materialNum, - materialRmbSum : row.materialRmb * row.materialNum - } - }); + else if( commonCurrency == 2){ + row.materialUsd = Number(row.materialNoUsd); + row.materialUsdSum = Number(row.materialNum) * Number(row.materialUsd); + row.materialNoUsdSum = Number(row.materialNoUsd) * Number(row.materialNum); + row.materialNoRmb = usd * Number(row.materialNoUsd); + row.materialRmb = usd * Number(row.materialNoUsd) * (1 + rmb); + row.materialNoRmbSum = Number(row.materialNoRmb) * Number(row.materialNum); } getTotalAmount() }, 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 72f6a1c9..a12fbf6f 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/edit.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/edit.html @@ -43,7 +43,7 @@
- @@ -52,7 +52,7 @@
- +
@@ -68,7 +68,7 @@
- +
@@ -97,7 +97,7 @@
- +
@@ -140,6 +140,7 @@ var userName = [[${@permission.getPrincipalProperty('userName')}]]; var sysCustomerQuote = [[${sysCustomerQuote}]]; var prefix = ctx + "system/customerQuote" + var commonCurrency = $("#commonCurrency_edit option:selected").val(); $("#form-customerQuote-edit").validate({ focusCleanup: true, }); @@ -169,7 +170,6 @@ $("input[name='customerFax']").change(function () { if ($("input[name='customerFax']").val() == "1") { var taxRate = $("input[name='rmbTax']").val(); - $("input[name='rmbTax']").val(taxRate / 100); } else { $("input[name='rmbTax']").val(0); } @@ -190,7 +190,6 @@ showColumns: false, showPaginationSwitch: false, model: "物料报价信息", - onEditableSave: onEditableSave, columns: [ {checkbox: true}, {title: '序号',align: 'center', @@ -230,14 +229,14 @@ {title: '美元汇率',field: 'usdTax', align: 'center',editable: true}, {title: '对外售价',field: 'materialSole',editable: true}, {title: '物料的数量',field: 'materialNum',align: 'center',editable: true}, - {title: '物料的不含税单价(RMB)',field: 'materialNoRmb',align: 'center',editable: true,editable: true}, - {title: '物料的不含税单价(美元)',field: 'materialNoUsd',align: 'center',editable: true,editable: true}, - {title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center',editable: true}, - {title: '物料的含税总价(RMB)',field: 'materialNoRmbSum',align: 'center',editable: true}, - {title: '物料的不含税总价(RMB)',field: 'materialRmbSum',align: 'center',editable: true}, - {title: '物料的含税单价(美元)',field: 'materialUsd',align: 'center',editable: true}, - {title: '物料的含税总价(美元)',field: 'materialUsdSum',align: 'center',editable: true}, - {title: '物料的不含税总价(美元)', field: 'materialNoUsdSum',align: 'center',editable: true}, + {title: '物料的不含税单价(RMB)',field: 'materialNoRmb',align: 'center',editable: commonCurrency==1?true:false}, + {title: '物料的不含税单价(美元)',field: 'materialNoUsd',align: 'center',editable: commonCurrency==2?true:false}, + {title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center'}, + {title: '物料的含税总价(RMB)',field: 'materialNoRmbSum',align: 'center'}, + {title: '物料的不含税总价(RMB)',field: 'materialRmbSum',align: 'center'}, + {title: '物料的含税单价(美元)',field: 'materialUsd',align: 'center'}, + {title: '物料的含税总价(美元)',field: 'materialUsdSum',align: 'center'}, + {title: '物料的不含税总价(美元)', field: 'materialNoUsdSum',align: 'center'}, {field: 'remark',align: 'center',title: '备注',visible: false}, {title: '操作', align: 'center', formatter: function (value, row, index) { @@ -246,7 +245,34 @@ return actions.join(''); } } - ] + ], + onEditableSave:function(field, row, oldValue, $el){ + commonCurrency = $("#commonCurrency_add option:selected").val(); + var Double = function(value) { + this.value = Number(value).toFixed(2); + }; + var rmb1 = new Double($("#rmbTax_edit").val()); + var rmb = rmb1 / 100; + var usd = new Double($("#usdTax_edit").val()); + console.log(commonCurrency); + if(commonCurrency == 1){ + row.materialRmb = Number(row.materialNoRmb * (1 + rmb)).toFixed(2); + row.materialNoUsd = Number(row.materialNoRmb / rmb).toFixed(2); + row.materialNoUsdSum = Number(row.materialNum * row.materialNoUsd).toFixed(2); + row.materialUsd = Number(row.materialNoUsd).toFixed(2); + row.materialUsdSum = Number(row.materialNum * row.materialUsd).toFixed(2); + row.materialNoRmbSum = Number(row.materialNum* row.materialNoRmb).toFixed(2); + } + else if( commonCurrency == 2){ + row.materialUsd = Number(row.materialNoUsd).toFixed(2); + row.materialUsdSum = Number(row.materialNum * row.materialUsd).toFixed(2); + row.materialNoUsdSum = Number(row.materialNoUsd * row.materialNum).toFixed(2); + row.materialNoRmb = Number(usd * row.materialNoUsd).toFixed(2); + row.materialRmb = usd * Number(row.materialNoUsd * (1 + rmb)).toFixed(2); + row.materialNoRmbSum = Number(row.materialNoRmb * row.materialNum).toFixed(2); + } + getTotalAmount() + }, }; $.table.init(options); }); @@ -374,39 +400,7 @@ $("#usdSum").val(usdSum); } // 结算金额 - function onEditableSave(field, row, oldValue, $el){ - const commonCurrency = $("#commonCurrency:checked").val(); - if(field =="materialNum" && row.materialNum != "" && commonCurrency =="1"){ - $("#bootstrap-table-Quote-child").bootstrapTable('updateByUniqueId', { - id: row.id, - row: { - materialNoRmb : row.materialNoRmb, - materialRmb : row.materialNoRmb * (1 + $("#rmbTax").val()), - materialNoUsd : row.materialNoRmb / $("#rmbTax").val(), - materialNoUsdSum : row.materialNoRmb / $("#rmbTax").val(), - materialUsd : row.materialNum * (row.materialNoRmb / $("#rmbTax").val()), - materialUsdSum : row.materialNum * (row.materialNoRmb / $("#rmbTax").val()), - materialNoRmbSum : row.materialNum * row.materialNoRmb, - materialRmbSum : row.materialNum * row.materialRmb - } - }); - } - else if(field =="materialNum" && row.materialNum != "" && commonCurrency =="2"){ - $("#bootstrap-table-Quote-child").bootstrapTable('updateByUniqueId', { - id: row.id, - row: { - materialUsd : row.materialNoUsd, - materialUsdSum : row.materialNum * row.materialUsd, - materialNoUsdSum : row.materialNoUsd * row.materialNum, - materialNoRmb : $("#usdTax").val() * row.materialNoUsd, - materialRmb : $("#usdTax").val() * row.materialNoUsd * (1 + $("#rmbTax").val()), - materialNoRmbSum : row.materialNoRmb * row.materialNum, - materialRmbSum : row.materialRmb * row.materialNum - } - }); - } - getTotalAmount() - } + \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java index a424e9df..65b49107 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java @@ -336,4 +336,15 @@ public class RedisCache String serialNum = String.format("%03d",no); return codeKey+serialNum; } + public String generateUUNo(String prefix) { + String codeKey = prefix; + Long no = 0L; + //获取每日流水 + no = incr(codeKey, 1); + if (no == null) { + throw new RuntimeException("Redis单据编号流水递增失败"); + } + String serialNum = String.format("%03d",no); + return codeKey+serialNum; + } }