Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dev
zhangsiqi 8 months ago
parent
commit
0284e47284
  1. 5
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java
  2. 77
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomerQuote.java
  3. 16
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomerQuoteChild.java
  4. 2
      ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml
  5. 441
      ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html
  6. 3
      ruoyi-admin/src/main/resources/templates/system/makeorderpick/makeorderpick.html

5
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java

@ -409,8 +409,9 @@ public class SysCustomerController extends BaseController
Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
String processInstanceId = task.getProcessInstanceId(); String processInstanceId = task.getProcessInstanceId();
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
SysCustomerVo erpMaterialVo = sysCustomerService.selectSysCustomerById(new Long(processInstance.getBusinessKey())); SysCustomerVo sysCustomerVo = sysCustomerService.selectSysCustomerById(new Long(processInstance.getBusinessKey()));
mmap.put("formData", erpMaterialVo); sysCustomerVo.setTaskId(taskId);
mmap.put("formData", sysCustomerVo);
mmap.put("taskId", taskId); mmap.put("taskId", taskId);
String verifyName = task.getTaskDefinitionKey().substring(0, 1).toUpperCase() + task.getTaskDefinitionKey().substring(1); String verifyName = task.getTaskDefinitionKey().substring(0, 1).toUpperCase() + task.getTaskDefinitionKey().substring(1);
return prefix + "/task" + verifyName; return prefix + "/task" + verifyName;

77
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomerQuote.java

@ -8,6 +8,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.poi.hpsf.Decimal; import org.apache.poi.hpsf.Decimal;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -54,35 +55,35 @@ public class SysCustomerQuote extends BaseEntity
private String confirmFax; private String confirmFax;
/** 国内汇率 */ /** 国内汇率 */
@Excel(name = "国内汇率") @Excel(name = "国内汇率")
private Double rmbTax; private BigDecimal rmbTax;
/** 美元汇率 */ /** 美元汇率 */
@Excel(name = "美元汇率") @Excel(name = "美元汇率")
private Double usdTax; private BigDecimal usdTax;
/** 不含税总价(RMB) */ /** 不含税总价(RMB) */
@Excel(name = "不含税总价(RMB)") @Excel(name = "不含税总价(RMB)")
private Double noRmbSum; private BigDecimal noRmbSum;
@Excel(name = "不含税单价(RMB)") @Excel(name = "不含税单价(RMB)")
private Double noRmb; private BigDecimal noRmb;
@Excel(name = "含税单价(RMB)") @Excel(name = "含税单价(RMB)")
private Double rmb; private BigDecimal rmb;
/** 含税总价(RMB) */ /** 含税总价(RMB) */
@Excel(name = "含税总价(RMB)") @Excel(name = "含税总价(RMB)")
private Double rmbSum; private BigDecimal rmbSum;
/** 不含税单价(美元) */ /** 不含税单价(美元) */
@Excel(name = "不含税单价(美元)") @Excel(name = "不含税单价(美元)")
private Double noUsd; private BigDecimal noUsd;
/** 不含税总价(美元) */ /** 不含税总价(美元) */
@Excel(name = "不含税总价(美元)") @Excel(name = "不含税总价(美元)")
private Double noUsdSum; private BigDecimal noUsdSum;
/** 含税总价(美元) */ /** 含税总价(美元) */
@Excel(name = "含税单价(美元)") @Excel(name = "含税单价(美元)")
private Double usd; private BigDecimal usd;
/** 含税总价(美元) */ /** 含税总价(美元) */
@Excel(name = "含税总价(美元)") @Excel(name = "含税总价(美元)")
private Double usdSum; private BigDecimal usdSum;
private String businessMembers; private String businessMembers;
@Excel(name = "审核标志: 0未审核 1审核成功 2审核拒绝") @Excel(name = "审核标志: 0未审核 1审核成功 2审核拒绝")
@ -200,91 +201,91 @@ public class SysCustomerQuote extends BaseEntity
this.commonCurrency = commonCurrency; this.commonCurrency = commonCurrency;
} }
public Double getRmbTax() { public void setEnterpriseSum(Double enterpriseSum) {
return rmbTax; this.enterpriseSum = enterpriseSum;
} }
public void setRmbTax(Double rmbTax) { public Double getEnterpriseSum() {
this.rmbTax = rmbTax; return enterpriseSum;
} }
public Double getUsdTax() { public BigDecimal getRmbTax() {
return usdTax; return rmbTax;
} }
public void setUsdTax(Double usdTax) { public void setRmbTax(BigDecimal rmbTax) {
this.usdTax = usdTax; this.rmbTax = rmbTax;
} }
public void setEnterpriseSum(Double enterpriseSum) { public BigDecimal getUsdTax() {
this.enterpriseSum = enterpriseSum; return usdTax;
} }
public Double getEnterpriseSum() { public void setUsdTax(BigDecimal usdTax) {
return enterpriseSum; this.usdTax = usdTax;
} }
public Double getNoRmbSum() { public BigDecimal getNoRmbSum() {
return noRmbSum; return noRmbSum;
} }
public void setNoRmbSum(Double noRmbSum) { public void setNoRmbSum(BigDecimal noRmbSum) {
this.noRmbSum = noRmbSum; this.noRmbSum = noRmbSum;
} }
public Double getNoRmb() { public BigDecimal getNoRmb() {
return noRmb; return noRmb;
} }
public void setNoRmb(Double noRmb) { public void setNoRmb(BigDecimal noRmb) {
this.noRmb = noRmb; this.noRmb = noRmb;
} }
public Double getRmb() { public BigDecimal getRmb() {
return rmb; return rmb;
} }
public void setRmb(Double rmb) { public void setRmb(BigDecimal rmb) {
this.rmb = rmb; this.rmb = rmb;
} }
public Double getRmbSum() { public BigDecimal getRmbSum() {
return rmbSum; return rmbSum;
} }
public void setRmbSum(Double rmbSum) { public void setRmbSum(BigDecimal rmbSum) {
this.rmbSum = rmbSum; this.rmbSum = rmbSum;
} }
public Double getNoUsd() { public BigDecimal getNoUsd() {
return noUsd; return noUsd;
} }
public void setNoUsd(Double noUsd) { public void setNoUsd(BigDecimal noUsd) {
this.noUsd = noUsd; this.noUsd = noUsd;
} }
public Double getNoUsdSum() { public BigDecimal getNoUsdSum() {
return noUsdSum; return noUsdSum;
} }
public void setNoUsdSum(Double noUsdSum) { public void setNoUsdSum(BigDecimal noUsdSum) {
this.noUsdSum = noUsdSum; this.noUsdSum = noUsdSum;
} }
public Double getUsd() { public BigDecimal getUsd() {
return usd; return usd;
} }
public void setUsd(Double usd) { public void setUsd(BigDecimal usd) {
this.usd = usd; this.usd = usd;
} }
public Double getUsdSum() { public BigDecimal getUsdSum() {
return usdSum; return usdSum;
} }
public void setUsdSum(Double usdSum) { public void setUsdSum(BigDecimal usdSum) {
this.usdSum = usdSum; this.usdSum = usdSum;
} }

16
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomerQuoteChild.java

@ -70,12 +70,12 @@ public class SysCustomerQuoteChild extends BaseEntity
@Excel(name = "物料的对外售价") @Excel(name = "物料的对外售价")
private BigDecimal materialSole; private BigDecimal materialSole;
/** 物料的含税单价(RMB) */ /** 物料的含税单价(RMB) */
@Excel(name = "物料的含税单价(RMB) ") @Excel(name = "物料的含税单价(RMB) ")
private BigDecimal materialRmb; private BigDecimal materialRmb;
/** 物料的含税单价(RMB) */ /** 物料的含税单价(RMB) */
@Excel(name = "物料的含税单价(RMB)") @Excel(name = "物料的含税单价(RMB)")
private BigDecimal materialNoRmb; private BigDecimal materialNoRmb;
/** 物料的不含税单价(USD) */ /** 物料的不含税单价(USD) */
@ -94,12 +94,12 @@ public class SysCustomerQuoteChild extends BaseEntity
@Excel(name = "物料的不含税总价(USD)") @Excel(name = "物料的不含税总价(USD)")
private BigDecimal materialNoUsdSum; private BigDecimal materialNoUsdSum;
/** 物料的含税总价(RMB) */
@Excel(name = "物料的含税总价(RMB)")
private BigDecimal materialNoRmbSum;
/** 物料的不含税总价(RMB) */ /** 物料的不含税总价(RMB) */
@Excel(name = "物料的不含税总价(RMB)") @Excel(name = "物料的不含税总价(RMB)")
private BigDecimal materialNoRmbSum;
/** 物料的含税总价(RMB) */
@Excel(name = "物料的含税总价(RMB)")
private BigDecimal materialRmbSum; private BigDecimal materialRmbSum;
/** 审核状态 */ /** 审核状态 */

2
ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml

@ -70,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delivery_address_id,delivery_customer_person,delivery_customer_phone, delivery_address_id,delivery_customer_person,delivery_customer_phone,
delivery_address,delivery_customer_postal,delivery_customer_fax,business_members, delivery_address,delivery_customer_postal,delivery_customer_fax,business_members,
identifying_people,first_add_time,update_info_time, create_time ,audit_status,use_status,update_by, identifying_people,first_add_time,update_info_time, create_time ,audit_status,use_status,update_by,
apply_user,apply_time from sys_customer apply_user,apply_time , instance_id , instance_type from sys_customer
</sql> </sql>
<select id="selectSysCustomerToList" parameterType="SysCustomer" resultMap="SysCustomerResult"> <select id="selectSysCustomerToList" parameterType="SysCustomer" resultMap="SysCustomerResult">

441
ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html

@ -49,9 +49,9 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label">美元汇率:</label> <label class="col-sm-4 control-label is-required">美元汇率:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="usdTax" id="usdTax_add" class="form-control" type="number" placeholder="美元对人民币汇率"> <input name="usdTax" id="usdTax_add" class="form-control" type="number" placeholder="美元对人民币汇率" required>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -89,7 +89,34 @@
<textarea name="remark" class="form-control" readonly></textarea> <textarea name="remark" class="form-control" readonly></textarea>
</div> </div>
</div> </div>
<div class="container">
<h4 class="form-header h4">计算</h4>
<div class="col-xs-12 form-row">
<label class=" col-sm-2">物料合计:</label><input class="col-sm-4" name="enterprise" id="enterprise_edit" type="text" readonly/>
<label class=" col-sm-2">数量合计:</label><input class="col-sm-4" name="enterpriseSum" id="enterpriseSum_edit" type="number" readonly/>
</div>
<div class="col-xs-12 form-row">
<label class="col-sm-2"> 不含税单价:</label><input placeholder="RMB" class="col-sm-4" name="noRmb" id="noRmb_edit" type="number" readonly/>
<label class="col-sm-2"> 不含税总价:</label><input placeholder="RMB" class="col-sm-4" name="noRmbSum" id="noRmbSum_edit" type="number" readonly/>
</div>
<div class="col-xs-12 form-row">
<label class="col-sm-2"> 含税单价:</label><input placeholder="RMB" class="col-sm-4" name="rmb" id="rmb_edit" type="number" readonly/>
<label class="col-sm-2"> 含税总价:</label><input placeholder="RMB" class="col-sm-4" name="rmbSum" id="rmbSum_edit" type="number" readonly/>
</div>
<div class="col-xs-12">
<label class="col-sm-2">不含税单价:</label><input placeholder="美元" class="col-sm-4" name="noUsd" id="noUsd_edit" type="number" readonly/>
<label class="col-sm-2">不含税总价:</label><input placeholder="美元" class="col-sm-4" name="noUsdSum" id="noUsdSum_edit" type="number" readonly/>
</div>
<div class="col-xs-12">
<label class="col-sm-2">含税单价:</label><input placeholder="美元" class="col-sm-4" name="usd" id="usd_edit" type="number" readonly/>
<label class="col-sm-2">含税总价:</label><input placeholder="美元" class="col-sm-4" name="usdSum" id="usdSum_edit" type="number" readonly/>
</div>
</div>
</form> </form>
<div class="container"> <div class="container">
<div class="form-row"> <div class="form-row">
<div class="btn-group-sm" id="toolbar" role="group"> <div class="btn-group-sm" id="toolbar" role="group">
@ -97,7 +124,7 @@
<a class="btn btn-success" onclick="insertRow()"> <a class="btn btn-success" onclick="insertRow()">
<i class="fa fa-plus"></i> 添加物料 <i class="fa fa-plus"></i> 添加物料
</a> </a>
<a class="btn btn-danger multiple disabled" onclick="insertNRow()"> <a class="btn btn-danger multiple" onclick="insertNoMaterialNoRow()">
<i class="fa fa-remove"></i> 添加无料号物料 <i class="fa fa-remove"></i> 添加无料号物料
</a> </a>
</div> </div>
@ -228,6 +255,43 @@
commonCurrency = $("#commonCurrency_add option:selected").val(); commonCurrency = $("#commonCurrency_add option:selected").val();
console.log("commonCurrency",commonCurrency); console.log("commonCurrency",commonCurrency);
}); });
//添加收款明细
function insertNoMaterialNoRow() {
// 生成一个简单的唯一标识,这里使用时间戳作为示例
var uniqueId = new Date().getTime();
// 创建一个新行数据模板,这里仅为示例,具体根据表格列来定义
var newRow = {
materialId:uniqueId,
materialCode: "",
materialName: "",
materialType: "",
describe: "",
brand: "",
unit: "",
processMethod: "",
photoUrl: "",
};
// 使用Bootstrap Table的API插入新行
$('#bootstrap-sub-table-quoteChild').bootstrapTable('append', newRow);
}
// // 逻辑删除收款凭证前端的一行数据
// function removeRow(receivablesRecordsId){
// console.log(receivablesRecordsId);
// // 直接使用 receivablesRecordsId 值进行删除操作
// $("#bootstrap-receivablesVoucher-table").bootstrapTable('remove', {
// field: 'receivablesRecordsId',
// values: receivablesRecordsId
// });
// }
$(function() { $(function() {
var options = { var options = {
id:'bootstrap-sub-table-quoteChild', id:'bootstrap-sub-table-quoteChild',
@ -287,23 +351,25 @@
} }
} }
}, },
{title: '国内税率',field: 'countTax',align: 'center',},
{ title: '美元汇率',field: 'usdTax', align: 'center',}, { title: '最新报价',field: 'materialSole',
{field: 'materialNum',align: 'center',title: '物料的数量', editable: {
editable:{ type: 'number',
type : 'text',
mode: 'inline', mode: 'inline',
title : '物料的数量', title: '对外售价',
validate : function(value) { validate: function (value) {
if (!value) { if (!value) {
return '用量不能为空'; return '对外售价不能为空';
} }
if (isNaN(value)) { if (isNaN(value)) {
return '用量必须为数字'; return '对外售价必须为数字';
} }
} }
}, }
}, },
{title: '国内税率',field: 'countTax',align: 'center',},
{ title: '美元汇率',field: 'usdTax', align: 'center',},
{ title: '物料的不含税单价(RMB)', { title: '物料的不含税单价(RMB)',
field: 'materialNoRmb', field: 'materialNoRmb',
align: 'center', align: 'center',
@ -332,6 +398,24 @@
} }
} }
}, },
{ title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center',},
{field: 'materialNum',align: 'center',title: '物料的数量',
editable:{
type : 'text',
mode: 'inline',
title : '物料的数量',
validate : function(value) {
if (!value) {
return '用量不能为空';
}
if (isNaN(value)) {
return '用量必须为数字';
}
}
},
},
{title: '物料的不含税总价(RMB)',field: 'materialNoRmbSum',align: 'center',},
{ title: '物料的含税总价(RMB)',field: 'materialRmbSum',align: 'center',},
{title: '物料的不含税单价(美元)', {title: '物料的不含税单价(美元)',
field: 'materialNoUsd', field: 'materialNoUsd',
align: 'center', align: 'center',
@ -363,9 +447,6 @@
{ title: '物料的含税单价(美元)',field: 'materialUsd',align: 'center',}, { title: '物料的含税单价(美元)',field: 'materialUsd',align: 'center',},
{ title: '物料的含税总价(美元)',field: 'materialUsdSum', align: 'center',}, { title: '物料的含税总价(美元)',field: 'materialUsdSum', align: 'center',},
{ title: '物料的不含税总价(美元)',field: 'materialNoUsdSum',align: 'center',}, { title: '物料的不含税总价(美元)',field: 'materialNoUsdSum',align: 'center',},
{ title: '物料的含税总价(RMB)',field: 'materialRmb',align: 'center',},
{ title: '物料的含税总价(RMB)',field: 'materialNoRmbSum',align: 'center',},
{title: '物料的不含税总价(RMB)',field: 'materialRmbSum',align: 'center',},
{field: 'createBy', align: 'center',title: '录入人',visible: false}, {field: 'createBy', align: 'center',title: '录入人',visible: false},
{field: 'createTime',align: 'center',title: '录入时间',visible: false}, {field: 'createTime',align: 'center',title: '录入时间',visible: false},
{field: 'updateBy',align: 'center',title: '更新人',visible: false}, {field: 'updateBy',align: 'center',title: '更新人',visible: false},
@ -383,45 +464,75 @@
} }
} }
], ],
onEditableSave:function(field, row, oldValue, $el){
var commonCurrency1 = $("#commonCurrency_add option:selected").val(); onClickCell: function(field, value, row, $element) {
var rmb1 = $("#rmbTax_add").val(); // 根据物料号是否存在决定是否允许编辑
if (rmb1 =='' || rmb1== null){ if (field !== 'index' && field !== 'materialCode' && field !== 'photoUrl' && field !== 'operation') {
rmb1 = 0; var isEditable = !row.materialCode; // 如果物料号不存在,则允许编辑
}else{ // 判断是否已有编辑框,避免重复打开
rmb1 = $("#rmbTax_add").val(); if (isEditable && !$element.find('.editable-input').length) {
} // 模拟开启编辑
var rmb = parseFloat(rmb1); var input = $('<input type="text" class="form-control editable-input" value="' + value + '">');
var usd = $("#usdTax_add").val(); $element.empty().append(input);
if (usd =='' || usd== null){ input.focus();
usd = 0; input.blur(function() {
}else{ // 用户离开输入框时,手动保存编辑值并关闭编辑状态
usd = parseFloat(usd); var newValue = input.val();
// 这里你需要添加代码来实际更新表格数据和关闭编辑状态
row[field] = newValue; // 更新数据模型
$element.text(newValue).removeClass('editing');
});
$element.addClass('editing');
}
} }
console.log(commonCurrency1); },
if(commonCurrency1 == 1){
row.materialNoRmb = parseFloat(row.materialNoRmb).toFixed(2); onEditableSave: function(field, row, oldValue, $el) {
row.materialRmb = parseFloat(row.materialNoRmb * parseFloat(1 + rmb)).toFixed(2); var commonCurrency1 = $("#commonCurrency_add option:selected").val();
row.materialNoRmbSum = parseFloat(row.materialNum * parseFloat(row.materialNoRmb)).toFixed(2); //把上面输入的百分比国内汇率由整数转换成小数
row.materialRmbSum = parseFloat(row.materialRmb * row.materialNum).toFixed(2); var rmbRateInput = parseFloat($("#rmbTax_add").val()) || 0;
row.materialNoUsd = parseFloat(row.materialNoRmb / usd).toFixed(2); var rmbRate = rmbRateInput / 100; // 将输入的百分比转换为小数
row.materialNoUsdSum = parseFloat(row.materialNum * row.materialNoUsd).toFixed(2); rmbRate = parseFloat(rmbRate.toFixed(2)); // 确保rmbRate转换为两位小数的浮点数
row.materialUsd = parseFloat(row.materialNoUsd).toFixed(2); var usdRate = parseFloat($("#usdTax_add").val()) || 0;
row.materialUsdSum = parseFloat(row.materialNum * row.materialUsd).toFixed(2);
var testMaterialNum = parseFloat(row.materialNum) || 0;
console.log("rmbRate:",rmbRate)
console.log("usdRate:",usdRate)
console.log("testMaterialNum:",testMaterialNum)
// // 确保计算使用的是正确的数值类型
// var noTaxValue = field === 'materialNoRmb' ? parseFloat(row.materialNoRmb) : parseFloat(row.materialNoUsd);
//
// // 计算不含税价格
// var noTaxPrice = noTaxValue.toFixed(2);
// 根据选择的货币类型计算其他值
if (commonCurrency1 === '1') {
// RMB为基准货币
row.materialRmb = (parseFloat(row.materialNoRmb) * (1 + rmbRate)).toFixed(2);
row.materialRmbSum = (parseFloat(row.materialRmb) * testMaterialNum).toFixed(2);
row.materialNoRmbSum = (parseFloat(row.materialNoRmb) * testMaterialNum).toFixed(2);
row.materialNoUsd = (parseFloat(row.materialNoRmb) / usdRate).toFixed(2);
row.materialUsd = row.materialNoUsd; // 保持一致,除非有特别的计算逻辑
row.materialUsdSum = (parseFloat(row.materialUsd) * testMaterialNum).toFixed(2);
row.materialNoUsdSum = (parseFloat(row.materialNoUsd) * testMaterialNum).toFixed(2);
} else if (commonCurrency1 === '2') {
// USD为基准货币
row.materialUsd = row.materialNoUsd
row.materialUsdSum = (parseFloat(row.materialUsd) * testMaterialNum).toFixed(2);
row.materialNoUsdSum = (parseFloat(row.materialNoUsd) * testMaterialNum).toFixed(2);
row.materialNoRmb = (parseFloat(row.materialNoUsd) * usdRate).toFixed(2);
row.materialRmb = (parseFloat(row.materialNoRmb) * (1 + rmbRate)).toFixed(2);
row.materialNoRmbSum = (parseFloat(row.materialNoRmb) * testMaterialNum).toFixed(2);
row.materialRmbSum = (parseFloat(row.materialRmb) * testMaterialNum).toFixed(2);
} }
else if( commonCurrency1 == 2){
row.materialNoUsd = parseFloat(row.materialNoUsd).toFixed(2); // 确保getTotalAmount函数存在且正确引用
row.materialUsd = parseFloat(row.materialNoUsd).toFixed(2); if (typeof getTotalAmount === 'function') {
row.materialUsdSum = parseFloat(row.materialNum * row.materialUsd).toFixed(2); getTotalAmount();
row.materialNoUsdSum = parseFloat(row.materialNoUsd * row.materialNum).toFixed(2);
row.materialNoRmb = parseFloat(row.materialNoUsd * usd).toFixed(2);
row.materialRmb = parseFloat(row.materialNoRmb * (1 + rmb)).toFixed(2);
row.materialNoRmbSum = parseFloat(row.materialNoRmb * row.materialNum).toFixed(2);
row.materialRmbSum = parseFloat(row.materialRmb * row.materialNum).toFixed(2);
} }
getTotalAmount() }
},
}; };
$.table.init(options); $.table.init(options);
}); });
@ -504,10 +615,18 @@
$.modal.alertWarning("请先选择客户"); $.modal.alertWarning("请先选择客户");
return; return;
} }
if ($("#usdTax_add").val() == null || $("#usdTax_add").val() == '') {
$.modal.alertWarning("请输入美元汇率");
return;
}
if ($("#rmbTax_add").val() == null || $("#rmbTax_add").val() == '') { if ($("#rmbTax_add").val() == null || $("#rmbTax_add").val() == '') {
$.modal.alertWarning("请先选择输入国内的税率"); $.modal.alertWarning("请输入国内的税率");
return; return;
} }
var url = ctx + "erp/material/select"; var url = ctx + "erp/material/select";
var options = { var options = {
title: '选择料号', title: '选择料号',
@ -529,96 +648,148 @@
autoclose: true autoclose: true
}); });
//计算金额 //计算金额
// function getTotalAmount() {
// // 获取表格数据
// const data = $("#bootstrap-sub-table-quoteChild").bootstrapTable('getData', true);
// // 初始化汇总对象,减少代码重复并提高清晰度
// const sums = {
// enterprise: "", // 用于拼接物料名称和数量
// enterpriseSum: 0, // 物料总数量
// currencies: {
// noRmb: { total: 0, single: 0 }, // 非人民币数量与总金额
// rmb: { total: 0, single: 0 }, // 人民币
// noUsd: { total: 0, single: 0 }, // 非美元
// usd: { total: 0, single: 0 } // 美元
// }
// };
// // 遍历数据进行计算
// for (let i = 0; i < data.length; i++) {
// const item = data[i];
// // 拼接物料信息
// sums.enterprise += "" + item.materialName + ": 数量 : " + item.materialNum;
// sums.enterpriseSum += parseFloat(item.materialNum); // 累加物料数量
// // 分别累加各货币的单个金额和总金额
// ['noRmb', 'rmb', 'noUsd', 'usd'].forEach(currency => {
// sums.currencies[currency].single += parseFloat(item['material' + [currency] ]);
// sums.currencies[currency].total += parseFloat(item['material' + [currency] + 'Sum']);
// });
// }
// updateFormValues(sums);
// }
// function updateFormValues(sums) {
// // 物料合计与数量合计没有在sums中直接给出,这里假设它们需要单独处理或已存在于页面其他部分
// $("#enterprise_add").val(sums.enterprise);
// $("#enterpriseSum_add").val(sums.enterpriseSum);
//
// // 更新不含税单价和总价
// $("#noRmb_add").val(sums.currencies.noRmb.single);
// $("#noRmbSum_add").val(sums.currencies.noRmb.total);
//
// $("#rmb_add").val(sums.currencies.rmb.single);
// $("#rmbSum_add").val(sums.currencies.rmb.total);
//
// $("#noUsd_add").val(sums.currencies.noUsd.single);
// $("#noUsdSum_add").val(sums.currencies.noUsd.total);
//
// $("#usd_add").val(sums.currencies.usd.single);
// $("#usdSum_add").val(sums.currencies.usd.total);
// }
// $(document).ready(function() {
// // 监听货币选项变化
// $("#commonCurrency_add").on("change", function() {
// var isEditable = $(this).val() === "1";
// var fieldName = "";
// var materialColumnCells = $('#bootstrap-sub-table-quoteChild tbody tr td [field=" '+ fieldName+' "]');
// // 根据是否可编辑,添加或移除xEditable
// materialColumnCells.each(function() {
// var cell = $(this);
// var currentValue = cell.text().trim(); // 获取当前单元格的值
//
// if (isEditable) {
// // 如果允许编辑且尚未添加xEditable
// if (!cell.hasClass('editable')) {
// cell.addClass('editable'); // 添加标记类,以便跟踪状态
// cell.editable({
// type: 'text',
// pk: cell.closest('tr').data('id'), // 假设每行有唯一ID
// title: '物料的数量',
// validate: function(value) {
// if (!value) return '金额不能为空';
// if (isNaN(value)) return '金额必须为数字';
// return true;
// },
// success: function(response, newValue) {
// // 成功后的回调,这里可以根据需要处理服务器响应
// }
// });
// }
// } else {
// // 如果不允许编辑且已添加了xEditable
// if (cell.hasClass('editable')) {
// cell.removeClass('editable');
// // 这里简化处理,实际中可能需要更复杂的逻辑来销毁xEditable实例
// cell.off('.editable'); // 移除xEditable绑定的事件
// cell.text(currentValue); // 还原原始文本
// }
// }
// });
// });
//
// // 初始化时触发一次,根据默认状态设置可编辑性
// $("#commonCurrency_add").trigger("change");
// });
function getTotalAmount() { function getTotalAmount() {
// 获取表格数据 var getData = $("#bootstrap-sub-table-quoteChild").bootstrapTable('getData');
const data = $("#bootstrap-sub-table-quoteChild").bootstrapTable('getData', true); var enterprise = 0;
// 初始化汇总对象,减少代码重复并提高清晰度 var enterpriseSum = 0;
const sums = { var noRmb = 0;
enterprise: "", // 用于拼接物料名称和数量 var rmb = 0;
enterpriseSum: 0, // 物料总数量 var noRmbSum = 0;
currencies: { var rmbSum = 0;
noRmb: { total: 0, single: 0 }, // 非人民币数量与总金额 var noUsd = 0;
rmb: { total: 0, single: 0 }, // 人民币 var usd = 0;
noUsd: { total: 0, single: 0 }, // 非美元 var noUsdSum = 0;
usd: { total: 0, single: 0 } // 美元 var usdSum = 0;
}
};
// 遍历数据进行计算
for (let i = 0; i < data.length; i++) {
const item = data[i];
// 拼接物料信息
sums.enterprise += "" + item.materialName + ": 数量 : " + item.materialNum;
sums.enterpriseSum += parseFloat(item.materialNum); // 累加物料数量
// 分别累加各货币的单个金额和总金额
['noRmb', 'rmb', 'noUsd', 'usd'].forEach(currency => {
sums.currencies[currency].single += parseFloat(item['material' + [currency] ]);
sums.currencies[currency].total += parseFloat(item['material' + [currency] + 'Sum']);
});
}
updateFormValues(sums);
}
function updateFormValues(sums) {
// 物料合计与数量合计没有在sums中直接给出,这里假设它们需要单独处理或已存在于页面其他部分
$("#enterprise_add").val(sums.enterprise);
$("#enterpriseSum_add").val(sums.enterpriseSum);
// 更新不含税单价和总价 // 计算企业数量和物料数量总和
$("#noRmb_add").val(sums.currencies.noRmb.single); enterprise = getData.length; // 直接获取数据长度
$("#noRmbSum_add").val(sums.currencies.noRmb.total); enterpriseSum = getData.reduce((sum, item) => sum + (parseInt(item.materialNum) || 0), 0);
$("#rmb_add").val(sums.currencies.rmb.single); // 先累加数值,toFixed在累加后应用以避免精度损失
$("#rmbSum_add").val(sums.currencies.rmb.total); for (let i = 0; i < getData.length; i++) {
noRmb += parseFloat(getData[i].materialNoRmb) || 0;
rmb += parseFloat(getData[i].materialRmb) || 0;
noRmbSum += parseFloat(getData[i].materialNoRmbSum) || 0;
rmbSum += parseFloat(getData[i].materialRmbSum) || 0;
noUsd += parseFloat(getData[i].materialNoUsd) || 0;
usd += parseFloat(getData[i].materialUsd) || 0;
noUsdSum += parseFloat(getData[i].materialNoUsdSum) || 0;
usdSum += parseFloat(getData[i].materialUsdSum) || 0;
}
$("#noUsd_add").val(sums.currencies.noUsd.single); // 将累加的结果格式化为两位小数
$("#noUsdSum_add").val(sums.currencies.noUsd.total); noRmb = noRmb.toFixed(2);
rmb = rmb.toFixed(2);
noRmbSum = noRmbSum.toFixed(2);
rmbSum = rmbSum.toFixed(2);
noUsd = noUsd.toFixed(2);
usd = usd.toFixed(2);
noUsdSum = noUsdSum.toFixed(2);
usdSum = usdSum.toFixed(2);
$("#usd_add").val(sums.currencies.usd.single); // 设置表单输入值
$("#usdSum_add").val(sums.currencies.usd.total); $("input[name='enterprise']").val(enterprise);
$("input[name='enterpriseSum']").val(enterpriseSum);
$("input[name='noRmb']").val(noRmb);
$("input[name='noRmbSum']").val(noRmbSum);
$("input[name='rmb']").val(rmb);
$("input[name='rmbSum']").val(rmbSum);
$("input[name='noUsd']").val(noUsd);
$("input[name='noUsdSum']").val(noUsdSum);
$("input[name='usd']").val(usd);
$("input[name='usdSum']").val(usdSum);
} }
$(document).ready(function() {
// 监听货币选项变化
$("#commonCurrency_add").on("change", function() {
var isEditable = $(this).val() === "1";
var fieldName = "";
var materialColumnCells = $('#bootstrap-sub-table-quoteChild tbody tr td [field=" '+ fieldName+' "]');
// 根据是否可编辑,添加或移除xEditable
materialColumnCells.each(function() {
var cell = $(this);
var currentValue = cell.text().trim(); // 获取当前单元格的值
if (isEditable) {
// 如果允许编辑且尚未添加xEditable
if (!cell.hasClass('editable')) {
cell.addClass('editable'); // 添加标记类,以便跟踪状态
cell.editable({
type: 'text',
pk: cell.closest('tr').data('id'), // 假设每行有唯一ID
title: '物料的数量',
validate: function(value) {
if (!value) return '金额不能为空';
if (isNaN(value)) return '金额必须为数字';
return true;
},
success: function(response, newValue) {
// 成功后的回调,这里可以根据需要处理服务器响应
}
});
}
} else {
// 如果不允许编辑且已添加了xEditable
if (cell.hasClass('editable')) {
cell.removeClass('editable');
// 这里简化处理,实际中可能需要更复杂的逻辑来销毁xEditable实例
cell.off('.editable'); // 移除xEditable绑定的事件
cell.text(currentValue); // 还原原始文本
}
}
});
});
// 初始化时触发一次,根据默认状态设置可编辑性
$("#commonCurrency_add").trigger("change");
});
</script> </script>
</body> </body>
</html> </html>

3
ruoyi-admin/src/main/resources/templates/system/makeorderpick/makeorderpick.html

@ -38,9 +38,6 @@
</div> </div>
<div class="btn-group-sm" id="toolbar" role="group"> <div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:makeorderpick:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:makeorderpick:edit"> <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:makeorderpick:edit">
<i class="fa fa-edit"></i> 修改 <i class="fa fa-edit"></i> 修改
</a> </a>

Loading…
Cancel
Save