|
@ -9,7 +9,7 @@ |
|
|
<div class="col-xs-12"> |
|
|
<div class="col-xs-12"> |
|
|
<label class="col-sm-4 control-label">已选择采购计划:</label> |
|
|
<label class="col-sm-4 control-label">已选择采购计划:</label> |
|
|
<div class="col-sm-7"> |
|
|
<div class="col-sm-7"> |
|
|
<input id="purchasePlanCodes" th:value="${purchasePlanCodes}" name="purchasePlanCode" class="form-control" type="text"> |
|
|
<input id="purchasePlanCodes" name="purchasePlanCode" class="form-control" type="text"> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="container" id="material"> |
|
|
<div class="container" id="material"> |
|
@ -19,33 +19,33 @@ |
|
|
<div class="container"> |
|
|
<div class="container"> |
|
|
<div class="row"><h4 class="card-header">公司地址:</h4></div> |
|
|
<div class="row"><h4 class="card-header">公司地址:</h4></div> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label for="inputWarehouseID" class="col-sm-2 col-form-label">仓库ID:</label> |
|
|
<label for="stockNo" class="col-sm-2 col-form-label">仓库ID:</label> |
|
|
<div class="col-sm-4"> |
|
|
<div class="col-sm-4"> |
|
|
<input type="text" class="form-control" id="inputWarehouseID" placeholder="请输入仓库ID"> |
|
|
<select class="form-control" name="stockNo" id="stockNo" ></select> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label for="inputWarehouseName" class="col-sm-2 col-form-label">仓库名称:</label> |
|
|
<label for="stockName" class="col-sm-2 col-form-label">仓库名称:</label> |
|
|
<div class="col-sm-4"> |
|
|
<div class="col-sm-4"> |
|
|
<input type="text" class="form-control" id="inputWarehouseName" placeholder="请输入仓库名称"> |
|
|
<input type="text" class="form-control" name="stockName" id="stockName"> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label for="inputReceiver" class="col-sm-2 col-form-label">收货人:</label> |
|
|
<label for="stockContact" class="col-sm-2 col-form-label">收货人:</label> |
|
|
<div class="col-sm-4"> |
|
|
<div class="col-sm-4"> |
|
|
<input type="text" class="form-control" id="inputReceiver" placeholder="请输入收货人"> |
|
|
<input type="text" name="stockContact" class="form-control" id="stockContact" > |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label for="inputPhone" class="col-sm-2 col-form-label">收货电话:</label> |
|
|
<label for="stockPhone" class="col-sm-2 col-form-label">收货电话:</label> |
|
|
<div class="col-sm-4"> |
|
|
<div class="col-sm-4"> |
|
|
<input type="text" class="form-control" id="inputPhone" placeholder="请输入收货电话"> |
|
|
<input type="text" name="stockPhone" class="form-control" id="stockPhone" placeholder="请输入收货电话"> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label for="inputAddressDetails" class="col-sm-2 col-form-label">详细地址:</label> |
|
|
<label for="stockAddress" class="col-sm-2 col-form-label">详细地址:</label> |
|
|
<div class="col-sm-4"> |
|
|
<div class="col-sm-4"> |
|
|
<textarea class="form-control" id="inputAddressDetails"></textarea> |
|
|
<textarea class="form-control" name="stockAddress" id="stockAddress"></textarea> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
@ -89,6 +89,7 @@ |
|
|
$("#form-plan-purchaseOrder-add").validate({focusCleanup: true}); |
|
|
$("#form-plan-purchaseOrder-add").validate({focusCleanup: true}); |
|
|
var purchasePlanChildList = [[${purchasePlanChildList}]]; |
|
|
var purchasePlanChildList = [[${purchasePlanChildList}]]; |
|
|
var purchasePlanList = [[${purchasePlanList}]]; |
|
|
var purchasePlanList = [[${purchasePlanList}]]; |
|
|
|
|
|
var purchasePlanCodes = [[${purchasePlanCodes}]]; |
|
|
var formId = "form-plan-purchaseOrder-add"; |
|
|
var formId = "form-plan-purchaseOrder-add"; |
|
|
//根据物料物料数量添加物料分类表,自动生成类似的表单对象 |
|
|
//根据物料物料数量添加物料分类表,自动生成类似的表单对象 |
|
|
//初始根据采购计划单,涉及到物料做分类表 |
|
|
//初始根据采购计划单,涉及到物料做分类表 |
|
@ -101,6 +102,7 @@ |
|
|
//获取 |
|
|
//获取 |
|
|
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到 |
|
|
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到 |
|
|
$(function() { |
|
|
$(function() { |
|
|
|
|
|
$("#purchasePlanCodes").val(purchasePlanCodes); |
|
|
// 初始化表格 |
|
|
// 初始化表格 |
|
|
// 假设purchasePlanChildList已定义并包含了需要处理的数据 |
|
|
// 假设purchasePlanChildList已定义并包含了需要处理的数据 |
|
|
purchasePlanChildList.forEach(function (material, index) { |
|
|
purchasePlanChildList.forEach(function (material, index) { |
|
@ -109,78 +111,125 @@ |
|
|
tableIdList.push(tableId); |
|
|
tableIdList.push(tableId); |
|
|
// 创建物料信息的容器 |
|
|
// 创建物料信息的容器 |
|
|
var $tableWrapper = $('<div id="material-' + tableId + '""></div>'); |
|
|
var $tableWrapper = $('<div id="material-' + tableId + '""></div>'); |
|
|
|
|
|
// 将整个物料信息容器添加到页面 |
|
|
|
|
|
$('#material').append($tableWrapper); |
|
|
// 添加关联销售订单号信息 |
|
|
// 添加关联销售订单号信息 |
|
|
var $headerDiv = |
|
|
var $headerDiv = |
|
|
$('<div class="row">' + |
|
|
$('<div class="row">' + |
|
|
'<div class="col-xs-12">' + |
|
|
'<div class="col-xs-12">' + |
|
|
'<div class="row">' + |
|
|
'<h3>' + |
|
|
'<span><strong>物料 ' + index + ': </strong> ' + '<strong>关联订单号: </strong></span>' + '<span class="correlationCodes" id="correlateion-' + tableId + ' ">' + material.correlationCodes + '</span>' + |
|
|
'<span><strong>物料 ' + index + ': </strong> ' + '<strong>关联订单号: </strong></span>' + '<span class="correlationCodes" id="correlateion-' + tableId + ' ">' + material.correlationCodes + '</span>' + |
|
|
'</div>' + |
|
|
'</h3>' + |
|
|
'<div class="col-sm-12">' + |
|
|
'<div class="col-sm-12">' + |
|
|
'<table class="table-materialCode" id="' + materialTable + '">' + '<br />' + |
|
|
'<table class="table-materialCode" id="' + materialTable + '">' + '<table/>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>'); |
|
|
'</div>'); |
|
|
$tableWrapper.append($headerDiv); |
|
|
$tableWrapper.append($headerDiv); |
|
|
|
|
|
var materialObj = { |
|
|
|
|
|
purchasePlanCode: material.purchasePlanCode, |
|
|
|
|
|
materialCode: material.materialCode, |
|
|
|
|
|
photoUrl: material.photoUrl, |
|
|
|
|
|
materialName: material.materialName, |
|
|
|
|
|
materialType: material.materialType, |
|
|
|
|
|
describe: material.describe, |
|
|
|
|
|
brand: material.brand, |
|
|
|
|
|
processMethod: material.processMethod, |
|
|
|
|
|
unit: material.unit, |
|
|
|
|
|
materialNum: material.materialNum, |
|
|
|
|
|
}; |
|
|
|
|
|
var materialData = [materialObj]; // Bootstrap Table需要一个数组作为数据源 |
|
|
|
|
|
materialList.push(material); |
|
|
|
|
|
tables(materialTable, materialData); |
|
|
// 创建表格的容器 |
|
|
// 创建表格的容器 |
|
|
|
|
|
//如果物料下的供应商为空,则不需要添加供应商信息,并在容器中添加一个提示信息:暂无供应商信息,请先添加供应商信息。 |
|
|
|
|
|
const uniqueSuppliers = []; |
|
|
|
|
|
if (material.purchaseSupplierList.size == 0) { |
|
|
|
|
|
var $noSupplierDiv = $('<div class="no-supplier">暂无供应商信息,请先添加供应商信息。</div>'); |
|
|
|
|
|
$tableWrapper.append($noSupplierDiv); |
|
|
|
|
|
}else{ |
|
|
|
|
|
material.purchaseSupplierList.forEach(supplier => { |
|
|
|
|
|
const key = `${supplier.supplierCode}_${supplier.materialCode}`; |
|
|
|
|
|
if (!uniqueSuppliers.map(s => `${s.supplierCode}_${s.materialCode}`).includes(key)) { |
|
|
|
|
|
uniqueSuppliers.push(supplier); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
// 循环处理每个供应商的信息 |
|
|
// 循环处理每个供应商的信息 |
|
|
material.purchaseSupplierList.forEach(function (supplier, supplierIndex) { |
|
|
uniqueSuppliers.forEach(function (supplier, supplierIndex) { |
|
|
var $supplierInfo = $('<div class="card mt-12 supplier-card" ></div>'); // 卡片样式容器,用于包裹每个供应商的信息 |
|
|
//如果供应商相同,则不需要再次添加供应商信息 |
|
|
|
|
|
$supplierInfo = $('<div class="card supplier-card" id="supplierInfo-' + tableId +'-'+ supplierIndex + '"></div>'); |
|
|
|
|
|
// 卡片样式容器,用于包裹每个供应商的信息 |
|
|
// 构建供应商信息头部 |
|
|
// 构建供应商信息头部 |
|
|
var $headerContent = |
|
|
var $headerContent = |
|
|
$('<div class="card-header" id = "supplier-' + tableId + '>' + |
|
|
$('<div class="card-header" id = "supplier-' + tableId + '">' + |
|
|
'<h3 class="card-title">' + '供应商 ' + supplierIndex + ': ' + '</h3>' + |
|
|
'<div class="row">' + |
|
|
'<p class="card-text ">' + '<span class="supplierCode"">' + supplier.supplierCode + '</span>' + '-' + '<span class="supplierName">' + supplier.supplierName + '</span>' + '-最新不含税采购价: ' + '<span class="supplierMaterialNoRmb">' + supplier.materialNoRmb + '</span>' + ' RMB ' + ' 最新含税采购价: ' + '<span class="supplierMaterialRmb">' + supplier.materialRmb + '</span> RMB </p>' + |
|
|
'<div class="crad-text">'+ |
|
|
'<div class="card-body">' + |
|
|
'<h4>供应商 ' + supplierIndex + ':' + '</h4>' + |
|
|
'<div class="form-group">' + |
|
|
'<span class="supplierCode"">' + supplier.supplierCode + '</span>' + '-' + |
|
|
'<label class="col-sm-3"> 实际采购数: </label>' + |
|
|
'<span class="supplierName">' + supplier.supplierName + '</span>' + |
|
|
'<div class ="col-sm-8">' + |
|
|
'-最新不含税采购价: ' + |
|
|
|
|
|
'<span id="supplierMaterialNoRmb-' + tableId + '" class="supplierMaterialNoRmb">' + supplier.materialNoRmb + |
|
|
|
|
|
'</span>'+ ' RMB 最新含税采购价: ' + |
|
|
|
|
|
'<span class="supplierMaterialRmb">' + supplier.materialRmb + '</span> RMB ' + |
|
|
|
|
|
'<span class="supplierPurchasePlanCode" hidden="hidden" >' + material.purchasePlanCodes + '</span>' + |
|
|
|
|
|
'<span class="supplierCorrelationCode" hidden="hidden" >' + material.correlationCodes + '</span>' + |
|
|
|
|
|
'<span class="supplierPurchaseQuoteCode" hidden="hidden" >' + supplier.purchaseQuoteCode + '</span>' + |
|
|
|
|
|
'</div>' + |
|
|
|
|
|
'</div>' + |
|
|
|
|
|
'<div class="row">' + |
|
|
|
|
|
'<div class="form-row">' + |
|
|
|
|
|
'<label class="col-sm-2"> 实际采购数: </label>' + |
|
|
|
|
|
'<div class ="col-sm-4">' + |
|
|
'<input type="text" name="materialNum" class="form-control supplierMaterialNum" id="actualPurchaseNum_' + tableId + '">' + |
|
|
'<input type="text" name="materialNum" class="form-control supplierMaterialNum" id="actualPurchaseNum_' + tableId + '">' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'<div class="form-group">' + |
|
|
'<div class="form-row">' + |
|
|
'<label class="col-sm-3">计划交付时间:</label>' + |
|
|
'<label class="col-sm-2">计划交付时间: </label>' + |
|
|
'<div class ="col-sm-8">' + |
|
|
'<div class ="col-sm-4">' + |
|
|
'<div class="input-group date"> ' + |
|
|
'<div class="input-group date"> ' + |
|
|
'<input type="text" name="deliveryTime" class="form-control supplierDeliveryTime" id="deliveryTime_' + tableId + '">' + |
|
|
'<input type="text" name="deliveryTime" class="form-control supplierDeliveryTime" id="deliveryTime_' + tableId + '">' + |
|
|
'<span class="input-group-addon"><i class="fa fa-calendar"></i></span>' + |
|
|
'<span class="input-group-addon"><i class="fa fa-calendar"></i></span>' + |
|
|
'</div> ' + |
|
|
'</div> ' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
|
|
|
'</div>'); |
|
|
'</div>'); |
|
|
|
|
|
$tableWrapper.append($supplierInfo); |
|
|
$supplierInfo.append($headerContent); |
|
|
$supplierInfo.append($headerContent); |
|
|
// 构建供应商信息下的输入表单 |
|
|
// 构建供应商信息下的输入表单 |
|
|
$supplierForm = $('<div class="card-body" id="card_body_' + tableId + '"></div>'); |
|
|
$supplierForm = $('<div class="card-body" id="card_body_' + tableId + '"></div>'); |
|
|
// 实际采购数输入框 |
|
|
// 实际采购数输入框 |
|
|
// 其他表单项可以根据需要类似添加 |
|
|
// 其他表单项可以根据需要类似添加 |
|
|
$supplierInfo.append($supplierForm); |
|
|
$supplierInfo.append($supplierForm); |
|
|
$tableWrapper.append($supplierInfo); |
|
|
|
|
|
}); |
|
|
}); |
|
|
tableSetup($supplierForm, tableId); |
|
|
tableSetup($supplierInfo, tableId); |
|
|
// 将整个物料信息容器添加到页面 |
|
|
} |
|
|
$('#material').append($tableWrapper); |
|
|
|
|
|
var materialObj = { |
|
|
|
|
|
purchasePlanCode: material.purchasePlanCode, |
|
|
|
|
|
materialCode: material.materialCode, |
|
|
|
|
|
photoUrl: material.photoUrl, |
|
|
|
|
|
materialName: material.materialName, |
|
|
|
|
|
materialType: material.materialType, |
|
|
|
|
|
describe: material.describe, |
|
|
|
|
|
brand: material.brand, |
|
|
|
|
|
processMethod: material.processMethod, |
|
|
|
|
|
unit: material.unit, |
|
|
|
|
|
materialNum: material.materialNum, |
|
|
|
|
|
}; |
|
|
|
|
|
var materialData = [materialObj]; // Bootstrap Table需要一个数组作为数据源 |
|
|
|
|
|
materialList.push(materialObj); |
|
|
|
|
|
tables(materialTable, materialData); |
|
|
|
|
|
}); |
|
|
}); |
|
|
// 给实际采购数的输入框绑定事件处理器 |
|
|
// 给实际采购数的输入框绑定事件处理器 |
|
|
$('.supplierMaterialNum').off('keyup').on('keyup', function() { |
|
|
$('.supplierMaterialNum').off('keyup').on('keyup', function(event,element) { |
|
|
var tableId = $(this).closest('.table-materialCode').attr('id'); |
|
|
console.log(event); |
|
|
|
|
|
console.log(element); |
|
|
|
|
|
var tableId = $(element).closest('.table-materialCode').attr('id'); |
|
|
|
|
|
if (event.keyCode === 13) { |
|
|
|
|
|
// 获取当前供应商的采购数量 |
|
|
|
|
|
var purchaseNum = parseFloat($(event).val()) || 0; |
|
|
|
|
|
// 获取当前供应商的采购价格 |
|
|
|
|
|
var noRmbPrice = parseFloat($(event).closest('.supplier-card').find('.supplierMaterialNoRmb').text().trim()); |
|
|
|
|
|
var rmbPrice = parseFloat($(event).closest('.supplier-card').find('.supplierMaterialRmb').text().trim()); |
|
|
|
|
|
// 更新供应商采购总价 |
|
|
|
|
|
$(event).closest('.supplier-card').find('.supplierPurchaseTotal').text(purchaseNum * noRmbPrice); |
|
|
|
|
|
if (rmbPrice) { |
|
|
|
|
|
$(event).closest('.supplier-card').find('.supplierPurchaseTotalRmb').text(purchaseNum * rmbPrice); |
|
|
|
|
|
} |
|
|
|
|
|
if (purchaseNum > 0) { |
|
|
|
|
|
// 如果采购数量大于0,则显示供应商采购总价 |
|
|
|
|
|
$(event).closest('.supplier-card').find('.supplierPurchaseTotal').removeClass('hidden'); |
|
|
|
|
|
$(event).closest('.supplier-card').find('.supplierPurchaseTotalRmb').removeClass('hidden'); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 否则隐藏供应商采购总价 |
|
|
|
|
|
$(event).closest('.supplier-card').find('.supplierPurchaseTotal').addClass('hidden'); |
|
|
|
|
|
$(event).closest('.supplier-card').find('.supplierPurchaseTotalRmb').addClass('hidden');} |
|
|
|
|
|
} |
|
|
recalculateTotals(tableId); // 重新计算当前物料的合计 |
|
|
recalculateTotals(tableId); // 重新计算当前物料的合计 |
|
|
calculateGlobalTotals(); // 然后重新计算整个订单的合计 |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
// 新增函数:重新计算某物料的采购数量合计、不含税采购总价和含税采购总价 |
|
|
// 新增函数:重新计算某物料的采购数量合计、不含税采购总价和含税采购总价 |
|
@ -225,22 +274,22 @@ |
|
|
} |
|
|
} |
|
|
function tableSetup(element, tableId) { |
|
|
function tableSetup(element, tableId) { |
|
|
var $totalSection = $( |
|
|
var $totalSection = $( |
|
|
'<div class="card mt-8">' + |
|
|
'<div class="card">' + |
|
|
'<div class="card-body" class="supplierTotal_' + tableId + '">' + |
|
|
'<div class="card-body" class="supplierTotal_' + tableId + '">' + |
|
|
'<div class="form-row">' + |
|
|
'<div class="form-row">' + |
|
|
'<label for="actualPurchaseTotal" class="col-sm-3">实际采购数合计:</label>' + |
|
|
'<label for="actualPurchaseTotal" class="col-sm-4">实际采购数合计:</label>' + |
|
|
'<div class="col-sm-8">' + |
|
|
'<div class="col-sm-8">' + |
|
|
'<input type="number" name="materialAmountSum" class="form-control" id="materialNoRmbSum_' + tableId + '" readonly>' + |
|
|
'<input type="number" name="materialAmountSum" class="form-control" id="materialNoRmbSum_' + tableId + '" readonly>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'<div class="form-row">' + |
|
|
'<div class="form-row">' + |
|
|
'<label for="actualPurchaseTotal" class="col-sm-3">不含税采购总价:</label>' + |
|
|
'<label for="actualPurchaseTotal" class="col-sm-4">不含税采购总价:</label>' + |
|
|
'<div class="col-sm-8">' + |
|
|
'<div class="col-sm-8">' + |
|
|
'<input type="number" name="materialNoRmbSum" class="form-control" id="materialNoRmbSum_' + tableId + '" readonly>' + |
|
|
'<input type="number" name="materialNoRmbSum" class="form-control" id="materialNoRmbSum_' + tableId + '" readonly>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'<div class="form-row">' + |
|
|
'<div class="form-row">' + |
|
|
'<label for="actualPurchaseTotalTax" class="col-sm-3">含税采购总价:</label>' + |
|
|
'<label for="actualPurchaseTotalTax" class="col-sm-4">含税采购总价:</label>' + |
|
|
'<div class="col-sm-8">' + |
|
|
'<div class="col-sm-8">' + |
|
|
'<input type="number" name="materialRmbSum" class="form-control" id="materialRmbSum_' + tableId + '" readonly>' + |
|
|
'<input type="number" name="materialRmbSum" class="form-control" id="materialRmbSum_' + tableId + '" readonly>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
@ -292,13 +341,14 @@ |
|
|
function submitHandler() { |
|
|
function submitHandler() { |
|
|
if ($.validate.form()) { |
|
|
if ($.validate.form()) { |
|
|
var purchaseOrder = { |
|
|
var purchaseOrder = { |
|
|
supplierNum: 0, |
|
|
supplierNum: 0,materialNum: 0,materialNoRmbSum: 0,materialRmbSum: 0, |
|
|
materialNum: 0, |
|
|
stockNo: $("#stockNo").val(), |
|
|
materialNoRmbSum: 0, |
|
|
stockName: $("#stockName").val(), |
|
|
materialRmbSum: 0, |
|
|
stockAddress: $("#stockAddress").val(), |
|
|
purchaseOrderChildList: [] |
|
|
stockContact: $("#stockContact").val(), |
|
|
|
|
|
stockPhone: $("#stockPhone").val(), |
|
|
|
|
|
purchaseOrderChildList: [], |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
// 遍历每个物料容器 |
|
|
// 遍历每个物料容器 |
|
|
$('.table-materialCode').each(function(index, tableElement) { |
|
|
$('.table-materialCode').each(function(index, tableElement) { |
|
|
var tableId = tableIdList[index]; |
|
|
var tableId = tableIdList[index]; |
|
@ -306,7 +356,6 @@ |
|
|
if (typeof materialObj === 'undefined') return; |
|
|
if (typeof materialObj === 'undefined') return; |
|
|
$('#' + 'material-' + tableId).find('.supplier-card').each(function(supplierIndex, supplierCard) { |
|
|
$('#' + 'material-' + tableId).find('.supplier-card').each(function(supplierIndex, supplierCard) { |
|
|
var materialData = { |
|
|
var materialData = { |
|
|
purchasePlanCode: materialObj.purchasePlanCode, |
|
|
|
|
|
materialCode: materialObj.materialCode, |
|
|
materialCode: materialObj.materialCode, |
|
|
materialName: materialObj.materialName, |
|
|
materialName: materialObj.materialName, |
|
|
materialType: materialObj.materialType, |
|
|
materialType: materialObj.materialType, |
|
@ -319,9 +368,12 @@ |
|
|
materialNoRmb: parseFloat($(supplierCard).find('.supplierMaterialNoRmb').text().trim()), |
|
|
materialNoRmb: parseFloat($(supplierCard).find('.supplierMaterialNoRmb').text().trim()), |
|
|
materialRmb: parseFloat($(supplierCard).find('.supplierMaterialRmb').text().trim()), |
|
|
materialRmb: parseFloat($(supplierCard).find('.supplierMaterialRmb').text().trim()), |
|
|
materialNum: parseInt($(supplierCard).find('.supplierMaterialNum').val(), 10) || 0, |
|
|
materialNum: parseInt($(supplierCard).find('.supplierMaterialNum').val(), 10) || 0, |
|
|
deliveryTime: $(supplierCard).find('.supplierDeliveryTime').val() |
|
|
deliveryTime: $(supplierCard).find('.supplierDeliveryTime').val(), |
|
|
|
|
|
purchasePlanCode:$(supplierCard).find('.supplierPurchasePlanCode').text().trim(), |
|
|
|
|
|
correlationCode:$(supplierCard).find('.supplierCorrelationCode').text().trim(), |
|
|
|
|
|
purchaseQuoteCode: $(supplierCard).find('.supplierPurchaseQuoteCode').text().trim(), |
|
|
}; |
|
|
}; |
|
|
purchaseOrder.purchaseQuoteChildList.push(materialData); |
|
|
purchaseOrder.purchaseOrderChildList.push(materialData); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -340,7 +392,7 @@ |
|
|
// 发送数据到后端API |
|
|
// 发送数据到后端API |
|
|
$.ajax({ |
|
|
$.ajax({ |
|
|
type: "POST", |
|
|
type: "POST", |
|
|
url: prefix + "/add", |
|
|
url: prefix + "/addPurchaseOrder", |
|
|
data: JSON.stringify(purchaseOrder), |
|
|
data: JSON.stringify(purchaseOrder), |
|
|
contentType: "application/json; charset=utf-8", |
|
|
contentType: "application/json; charset=utf-8", |
|
|
dataType: "json", |
|
|
dataType: "json", |
|
@ -360,6 +412,39 @@ |
|
|
// 如果需要在页面加载时初始化合计或重新绑定事件处理器,这部分应放在更合适的位置,不在此函数内 |
|
|
// 如果需要在页面加载时初始化合计或重新绑定事件处理器,这部分应放在更合适的位置,不在此函数内 |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
//获取仓库相关信息 |
|
|
|
|
|
function getWarehouseInfo() { |
|
|
|
|
|
$("#inputWarehouseID").select2({ |
|
|
|
|
|
theme: "bootstrap", |
|
|
|
|
|
allowClear: true, |
|
|
|
|
|
placeholder: "请选择供应商", |
|
|
|
|
|
ajax: { |
|
|
|
|
|
url: ctx + "stock/stockInfo/list", |
|
|
|
|
|
type: "post", |
|
|
|
|
|
dataType: "json", |
|
|
|
|
|
delay: 250, |
|
|
|
|
|
processResults: function (res, params) { |
|
|
|
|
|
var resultList = res.rows; |
|
|
|
|
|
var options = []; |
|
|
|
|
|
for (let i in resultList) { |
|
|
|
|
|
var option = resultList[i]; |
|
|
|
|
|
option.id = resultList[i]["StockNo"]; |
|
|
|
|
|
option.text = resultList[i]["StockNo"]; |
|
|
|
|
|
option.title = resultList[i]["StockName"]; |
|
|
|
|
|
options.push(option); |
|
|
|
|
|
} |
|
|
|
|
|
return {results: options,} |
|
|
|
|
|
}, |
|
|
|
|
|
escapeMarkup: function (markup) {return markup;}, |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
$("#inputWarehouseID").on("select2:select", function (e) { |
|
|
|
|
|
var data = e.params.data; |
|
|
|
|
|
$("#inputWarehouseName").val(data.StockName); |
|
|
|
|
|
$("#inputReceiver").val(data.stockmanager); |
|
|
|
|
|
$("#inputAddressDetails").val(data.stockAddr); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
</body> |
|
|
</body> |
|
|
</html> |
|
|
</html> |