|
|
@ -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('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="recentQuotationHistory(\'' + row.materialCode + '\')"><i class="fa fa-edit"></i>最新报价历史</a> '); |
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
</script> |
|
|
|
</body> |
|
|
|
</html> |