|
@ -13,7 +13,7 @@ |
|
|
</head> |
|
|
</head> |
|
|
<body class="white-bg"> |
|
|
<body class="white-bg"> |
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|
|
<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"> |
|
|
<input name="warehouseStorageId" th:field="*{warehouseStorageId}" type="hidden"> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label class="col-sm-3 control-label">入库单号:</label> |
|
|
<label class="col-sm-3 control-label">入库单号:</label> |
|
@ -74,11 +74,11 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!--物料信息--> |
|
|
<div class="container"> |
|
|
<div class="container"> |
|
|
<!--客户物料相关--> |
|
|
|
|
|
<div class="row"> |
|
|
<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> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
@ -92,61 +92,53 @@ |
|
|
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]] |
|
|
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]] |
|
|
var warehouseCode = [[${warehouseStorageOrder.warehouseCode}]] |
|
|
var warehouseCode = [[${warehouseStorageOrder.warehouseCode}]] |
|
|
var prefix = ctx + "warehouse/storageOrder"; |
|
|
var prefix = ctx + "warehouse/storageOrder"; |
|
|
$("#form-temporaryPurchaseWarehouse-edit").validate({ |
|
|
$("#form-storageMakeInDetail-edit").validate({ |
|
|
focusCleanup: true |
|
|
focusCleanup: true |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
//生成的不同table的id集合 |
|
|
// 新增提交 |
|
|
var tableDatas = []; |
|
|
|
|
|
|
|
|
|
|
|
function submitHandler() { |
|
|
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; |
|
|
obj[item.name] = item.value; |
|
|
return obj; |
|
|
return obj; |
|
|
}, {}); |
|
|
}, {}); |
|
|
// 初始化一个数组用于存放所有表格的数据 |
|
|
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据 |
|
|
let allMaterialDataList = []; |
|
|
var table = $('#bootstrap-table').bootstrapTable('getData'); |
|
|
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) { |
|
|
|
|
|
// 根据实际字段名调整 |
|
|
|
|
|
return { |
|
|
|
|
|
"customerId": item.customerId, |
|
|
|
|
|
"materialNo": item.materialNo, |
|
|
|
|
|
"materialName": item.materialName, |
|
|
|
|
|
"materialType": item.materialType, |
|
|
|
|
|
"materialPhotourl": item.materialPhotourl, |
|
|
|
|
|
"materialDescribe": item.materialDescribe, |
|
|
|
|
|
"materialBrand": item.materialBrand, |
|
|
|
|
|
"materialUnit": item.materialUnit, |
|
|
|
|
|
"materialProcessMethod": item.materialProcessMethod, |
|
|
|
|
|
"qualityHasQualifiedNum": item.qualityHasQualifiedNum, |
|
|
|
|
|
"hasStorageNum": item.hasStorageNum, |
|
|
|
|
|
"makeStorageNum": item.makeStorageNum, |
|
|
|
|
|
"storageNum": item.storageNum, |
|
|
|
|
|
"storageLocation": item.storageLocation, |
|
|
|
|
|
// ...其他字段 |
|
|
|
|
|
}; |
|
|
|
|
|
}); |
|
|
|
|
|
allMaterialDataList = allMaterialDataList.concat(materialDataList); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const combinedData = Object.assign({}, storageOrderData, { |
|
|
// 将表数据转换成与complaintNoticeData格式一致的数组 |
|
|
warehouseStorageOrderDetailList: allMaterialDataList |
|
|
var materialDataList = table.map(function(item) { |
|
|
|
|
|
// 根据实际字段名调整 |
|
|
|
|
|
return { |
|
|
|
|
|
"materialNo": item.materialNo, |
|
|
|
|
|
"materialName": item.materialName, |
|
|
|
|
|
"materialType": item.materialType, |
|
|
|
|
|
"materialPhotourl": item.materialPhotourl, |
|
|
|
|
|
"materialDescribe": item.materialDescribe, |
|
|
|
|
|
"materialBrand": item.materialBrand, |
|
|
|
|
|
"materialUnit": item.materialUnit, |
|
|
|
|
|
"materialProcessMethod": item.materialProcessMethod, |
|
|
|
|
|
"qualityHasQualifiedNum": item.qualityHasQualifiedNum, |
|
|
|
|
|
"hasStorageNum": item.hasStorageNum, |
|
|
|
|
|
"makeStorageNum": item.makeStorageNum, |
|
|
|
|
|
"storageNum": item.storageNum, |
|
|
|
|
|
"storageLocation": item.storageLocation, |
|
|
|
|
|
// ...其他字段 |
|
|
|
|
|
}; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const combinedData = Object.assign({}, storageMakeInData, { |
|
|
|
|
|
warehouseStorageOrderDetailList: materialDataList, |
|
|
}); |
|
|
}); |
|
|
// 合并表单数据和表格数据 |
|
|
// 合并表单数据和表格数据 |
|
|
// const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData); |
|
|
|
|
|
console.log(combinedData) |
|
|
console.log(combinedData) |
|
|
// 使用 JSON.stringify() 序列化数据 |
|
|
// 使用 JSON.stringify() 序列化数据 |
|
|
const jsonData = JSON.stringify(combinedData); |
|
|
const jsonData = JSON.stringify(combinedData); |
|
|
// 发送 AJAX 请求到后端接口 |
|
|
// 发送 AJAX 请求到后端接口 |
|
|
$.operate.saveJson(prefix + "/storageMake", jsonData); |
|
|
$.operate.saveJson(prefix + "/storageMakeInDetail", jsonData); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("input[name='arrivedTime']").datetimepicker({ |
|
|
$("input[name='arrivedTime']").datetimepicker({ |
|
|
format: "yyyy-mm-dd", |
|
|
format: "yyyy-mm-dd", |
|
|
minView: "month", |
|
|
minView: "month", |
|
@ -159,46 +151,20 @@ |
|
|
autoclose: true |
|
|
autoclose: true |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//物料信息展示列表 |
|
|
$(function() { |
|
|
$(function() { |
|
|
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到 |
|
|
var options = { |
|
|
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]; // 这里需要实际赋值,比如从前端某个地方读取 |
|
|
modalName: "选择物料", |
|
|
|
|
|
url: prefix + "/storageMakeInDetailList", |
|
|
$.getJSON(prefix + "/storageMakeInDetailList?warehouseStorageCode=" + warehouseStorageCode, function(data) { |
|
|
queryParams: queryParams, |
|
|
for (var customerId in data) { |
|
|
showSearch: false, |
|
|
if (data.hasOwnProperty(customerId)) { |
|
|
showRefresh: false, |
|
|
var customerData = data[customerId]; |
|
|
showToggle: false, |
|
|
createTableForCustomer(customerId, customerData); |
|
|
showColumns: false, |
|
|
} |
|
|
pagination: false, // 设置不分页 |
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
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, |
|
|
|
|
|
columns: [{ |
|
|
columns: [{ |
|
|
checkbox: true |
|
|
checkbox: true |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
|
|
|
title: '客户ID', |
|
|
|
|
|
field: 'customerId', |
|
|
|
|
|
visible: false |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
{ |
|
|
title: '料号', |
|
|
title: '料号', |
|
|
field: 'materialNo' |
|
|
field: 'materialNo' |
|
@ -230,10 +196,6 @@ |
|
|
title: '物料加工方式', |
|
|
title: '物料加工方式', |
|
|
field: 'materialProcessMethod', |
|
|
field: 'materialProcessMethod', |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
|
|
|
title: '订单数', |
|
|
|
|
|
field: 'makeTotal', |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
{ |
|
|
title: '品质已合格数', |
|
|
title: '品质已合格数', |
|
|
field: 'qualityHasQualifiedNum', |
|
|
field: 'qualityHasQualifiedNum', |
|
@ -243,25 +205,42 @@ |
|
|
field: 'hasStorageNum', |
|
|
field: 'hasStorageNum', |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '生产入库数', |
|
|
title: '委内入库数', |
|
|
field: 'makeStorageNum', |
|
|
field: 'makeStorageNum', |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '入库数', |
|
|
title: '入库数', |
|
|
field: 'storageNum', |
|
|
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: '存放位置', |
|
|
title: '存放位置', |
|
|
field: 'storageLocation', |
|
|
field: 'storageLocation', |
|
|
|
|
|
editable: true |
|
|
}] |
|
|
}] |
|
|
}); |
|
|
}; |
|
|
|
|
|
$.table.init(options); |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
$tableWrapper.append($header).append($table); |
|
|
function queryParams(params) { |
|
|
$('#tablesContainer').append($tableWrapper); |
|
|
var curParams = { |
|
|
|
|
|
// 传递参数查询参数 |
|
|
|
|
|
warehouseStorageCode: warehouseStorageCode |
|
|
|
|
|
}; |
|
|
|
|
|
console.log(curParams); |
|
|
|
|
|
return curParams; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//根据仓库ID查询仓库名称 |
|
|
//根据仓库ID查询仓库名称 |
|
|
$(document).ready(function() { |
|
|
$(document).ready(function() { |
|
|
// 初始化时默认加载仓库ID列表 |
|
|
// 初始化时默认加载仓库ID列表 |
|
|