|
|
@ -13,7 +13,7 @@ |
|
|
|
</head> |
|
|
|
<body class="white-bg"> |
|
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|
|
|
<form class="form-horizontal m" id="form-temporaryPurchaseWarehouse-edit" th:object="${warehouseStorageOrder}"> |
|
|
|
<form class="form-horizontal m" id="form-storageMakeInDetail-edit" th:object="${warehouseStorageOrder}"> |
|
|
|
<input name="warehouseStorageId" th:field="*{warehouseStorageId}" type="hidden"> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">入库单号:</label> |
|
|
@ -74,11 +74,11 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!--物料信息--> |
|
|
|
<div class="container"> |
|
|
|
<!--客户物料相关--> |
|
|
|
<div class="row"> |
|
|
|
<div class="col-sm-12" id="tablesContainer"> |
|
|
|
<!-- 表格将在这里动态生成 --> |
|
|
|
<div class="col-sm-12 select-table table-striped"> |
|
|
|
<table id="bootstrap-table"></table> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -92,29 +92,24 @@ |
|
|
|
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]] |
|
|
|
var warehouseCode = [[${warehouseStorageOrder.warehouseCode}]] |
|
|
|
var prefix = ctx + "warehouse/storageOrder"; |
|
|
|
$("#form-temporaryPurchaseWarehouse-edit").validate({ |
|
|
|
$("#form-storageMakeInDetail-edit").validate({ |
|
|
|
focusCleanup: true |
|
|
|
}); |
|
|
|
|
|
|
|
//生成的不同table的id集合 |
|
|
|
var tableDatas = []; |
|
|
|
|
|
|
|
// 新增提交 |
|
|
|
function submitHandler() { |
|
|
|
const storageOrderData = $("#form-temporaryPurchaseWarehouse-edit").serializeArray().reduce((obj, item) => { |
|
|
|
// 获取表单数据 |
|
|
|
const storageMakeInData = $("#form-storageMakeInDetail-edit").serializeArray().reduce((obj, item) => { |
|
|
|
obj[item.name] = item.value; |
|
|
|
return obj; |
|
|
|
}, {}); |
|
|
|
// 初始化一个数组用于存放所有表格的数据 |
|
|
|
let allMaterialDataList = []; |
|
|
|
for(let i in tableDatas){ |
|
|
|
$('#' + tableDatas[i]).each(function() { |
|
|
|
const tableData = $(this).bootstrapTable('getData'); |
|
|
|
console.log(JSON.stringify(tableData)); |
|
|
|
// 将表数据转换成与qualityReportData格式一致的数组 |
|
|
|
var materialDataList = tableData.map(function (item) { |
|
|
|
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据 |
|
|
|
var table = $('#bootstrap-table').bootstrapTable('getData'); |
|
|
|
|
|
|
|
// 将表数据转换成与complaintNoticeData格式一致的数组 |
|
|
|
var materialDataList = table.map(function(item) { |
|
|
|
// 根据实际字段名调整 |
|
|
|
return { |
|
|
|
"customerId": item.customerId, |
|
|
|
"materialNo": item.materialNo, |
|
|
|
"materialName": item.materialName, |
|
|
|
"materialType": item.materialType, |
|
|
@ -131,22 +126,19 @@ |
|
|
|
// ...其他字段 |
|
|
|
}; |
|
|
|
}); |
|
|
|
allMaterialDataList = allMaterialDataList.concat(materialDataList); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
const combinedData = Object.assign({}, storageOrderData, { |
|
|
|
warehouseStorageOrderDetailList: allMaterialDataList |
|
|
|
const combinedData = Object.assign({}, storageMakeInData, { |
|
|
|
warehouseStorageOrderDetailList: materialDataList, |
|
|
|
}); |
|
|
|
// 合并表单数据和表格数据 |
|
|
|
// const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData); |
|
|
|
console.log(combinedData) |
|
|
|
// 使用 JSON.stringify() 序列化数据 |
|
|
|
const jsonData = JSON.stringify(combinedData); |
|
|
|
// 发送 AJAX 请求到后端接口 |
|
|
|
$.operate.saveJson(prefix + "/storageMake", jsonData); |
|
|
|
$.operate.saveJson(prefix + "/storageMakeInDetail", jsonData); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$("input[name='arrivedTime']").datetimepicker({ |
|
|
|
format: "yyyy-mm-dd", |
|
|
|
minView: "month", |
|
|
@ -159,45 +151,19 @@ |
|
|
|
autoclose: true |
|
|
|
}); |
|
|
|
|
|
|
|
//物料信息展示列表 |
|
|
|
$(function() { |
|
|
|
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到 |
|
|
|
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]; // 这里需要实际赋值,比如从前端某个地方读取 |
|
|
|
|
|
|
|
$.getJSON(prefix + "/storageMakeInDetailList?warehouseStorageCode=" + warehouseStorageCode, function(data) { |
|
|
|
for (var customerId in data) { |
|
|
|
if (data.hasOwnProperty(customerId)) { |
|
|
|
var customerData = data[customerId]; |
|
|
|
createTableForCustomer(customerId, customerData); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
function createTableForCustomer(customerId, customerData) { |
|
|
|
var tableId = 'bootstrap-table-' + customerId.replace(/[^a-z0-9]/gi, '_').toLowerCase(); |
|
|
|
tableDatas.push(tableId); |
|
|
|
var $tableWrapper = $('<div class="table-responsive mt-3"></div>'); |
|
|
|
|
|
|
|
// 确保customerData至少有一条记录,并从中提取客户详细信息 |
|
|
|
var customerInfo = customerData.length > 0 ? customerData[0] : {}; // 默认为空对象,以防数据不存在 |
|
|
|
|
|
|
|
// 构建含有额外客户信息的标题字符串 |
|
|
|
var headerTitle ='客户'+'</br>'+customerId + ' - ' + (customerInfo.customerName || 'N/A') + |
|
|
|
' </br> ' + (customerInfo.customerContactPeople || 'N/A') + |
|
|
|
' - ' + (customerInfo.customerContactNumber || 'N/A') + |
|
|
|
' - ' + (customerInfo.customerCompanyAddress || 'N/A'); |
|
|
|
|
|
|
|
var $header = $('<h4>' + headerTitle + '</h4>'); |
|
|
|
var $table = $('<table id="' + tableId + '" class="table table-striped table-bordered"></table>'); |
|
|
|
|
|
|
|
$table.bootstrapTable({ |
|
|
|
data: customerData, |
|
|
|
var options = { |
|
|
|
modalName: "选择物料", |
|
|
|
url: prefix + "/storageMakeInDetailList", |
|
|
|
queryParams: queryParams, |
|
|
|
showSearch: false, |
|
|
|
showRefresh: false, |
|
|
|
showToggle: false, |
|
|
|
showColumns: false, |
|
|
|
pagination: false, // 设置不分页 |
|
|
|
columns: [{ |
|
|
|
checkbox: true |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '客户ID', |
|
|
|
field: 'customerId', |
|
|
|
visible: false |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '料号', |
|
|
@ -230,10 +196,6 @@ |
|
|
|
title: '物料加工方式', |
|
|
|
field: 'materialProcessMethod', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '订单数', |
|
|
|
field: 'makeTotal', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '品质已合格数', |
|
|
|
field: 'qualityHasQualifiedNum', |
|
|
@ -243,25 +205,42 @@ |
|
|
|
field: 'hasStorageNum', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '生产入库数', |
|
|
|
title: '委内入库数', |
|
|
|
field: 'makeStorageNum', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '入库数', |
|
|
|
field: 'storageNum', |
|
|
|
editable:{ |
|
|
|
type: 'text', |
|
|
|
mode:'inline', |
|
|
|
validate: function (v) { |
|
|
|
if (!v) return '数量不能为空'; |
|
|
|
if (isNaN(v)) return '数量必须是数字'; |
|
|
|
var processBadNum = parseInt(v); |
|
|
|
if (processBadNum <= 0) return '数量必须是正整数'; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '存放位置', |
|
|
|
field: 'storageLocation', |
|
|
|
editable: true |
|
|
|
}] |
|
|
|
}); |
|
|
|
}; |
|
|
|
$.table.init(options); |
|
|
|
}) |
|
|
|
|
|
|
|
$tableWrapper.append($header).append($table); |
|
|
|
$('#tablesContainer').append($tableWrapper); |
|
|
|
function queryParams(params) { |
|
|
|
var curParams = { |
|
|
|
// 传递参数查询参数 |
|
|
|
warehouseStorageCode: warehouseStorageCode |
|
|
|
}; |
|
|
|
console.log(curParams); |
|
|
|
return curParams; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//根据仓库ID查询仓库名称 |
|
|
|
$(document).ready(function() { |
|
|
|
// 初始化时默认加载仓库ID列表 |
|
|
|