|
@ -1,52 +1,64 @@ |
|
|
<!DOCTYPE html> |
|
|
<!DOCTYPE html> |
|
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
|
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
|
|
<head> |
|
|
<head> |
|
|
<th:block th:include="include :: header('暂收-采购单(采购入库)')" /> |
|
|
<th:block th:include="include :: header('采购入库通知')" /> |
|
|
<th:block th:include="include :: datetimepicker-css" /> |
|
|
<th:block th:include="include :: datetimepicker-css" /> |
|
|
<style> |
|
|
|
|
|
.supplier-value span {margin-right: 10px;} |
|
|
|
|
|
</style> |
|
|
|
|
|
</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-addPurchaseStorage-edit" th:object="${purchaseOrder}"> |
|
|
<form class="form-horizontal m" id="form-addPurchaseStorage-edit" th:object="${purchaseOrder}"> |
|
|
<input type="hidden" name="warehouseCode" th:field="*{stockNo}"/> |
|
|
<input type="hidden" name="warehouseCode" th:field="*{stockNo}"/> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label class="col-sm-3 control-label is-required">采购单号:</label> |
|
|
<label class="col-sm-3 control-label">采购单号:</label> |
|
|
<div class="col-sm-8"> |
|
|
<div class="col-sm-8"> |
|
|
<input name="relatedOrderCode" th:field="*{purchaseOrderCode}" class="form-control" type="text" required readonly> |
|
|
<input name="purchaseOrderCode" th:field="*{purchaseOrderCode}" class="form-control" type="text" readonly> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label class="col-sm-3 control-label is-required">入库类别:</label> |
|
|
<label class="col-sm-3 control-label ">供应商ID:</label> |
|
|
<div class="col-sm-8"> |
|
|
<div class="col-sm-8"> |
|
|
<select name="eceiptType" class="form-control m-b" th:with="type=${@dict.getType('purchase_warehouse_type')}" required> |
|
|
<input name="supplierCode" th:field="*{supplierCode}" class="form-control" type="text" readonly> |
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option> |
|
|
|
|
|
</select> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label class="col-sm-3 control-label is-required">到货时间:</label> |
|
|
<label class="col-sm-3 control-label is-required">供应商名称:</label> |
|
|
|
|
|
<div class="col-sm-8"> |
|
|
|
|
|
<input name="supplierName" th:field="*{supplierName}" class="form-control" type="text" required readonly> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="form-group"> |
|
|
|
|
|
<label class="col-sm-3 control-label">到货时间:</label> |
|
|
<div class="col-sm-8"> |
|
|
<div class="col-sm-8"> |
|
|
<div class="input-group date"> |
|
|
<div class="input-group date"> |
|
|
<input name="arrivedTime" class="form-control" placeholder="yyyy-MM-dd" type="text" required readonly> |
|
|
<input name="arrivedTime" class="form-control" placeholder="yyyy-MM-dd" type="text" readonly> |
|
|
<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 class="container" >--> |
|
|
|
|
|
<!--供应商物料相关--> |
|
|
|
|
|
<div id="tablesContainer" class="col-md-12" style="margin-left: auto;margin-right:auto"> |
|
|
|
|
|
<!-- <!– 表格将在这里动态生成 –>--> |
|
|
|
|
|
</div> |
|
|
|
|
|
<!-- </div>--> |
|
|
|
|
|
</form> |
|
|
</form> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--物料信息--> |
|
|
|
|
|
<div class="container"> |
|
|
|
|
|
<div class="row"> |
|
|
|
|
|
<div class="col-sm-12 select-table table-striped"> |
|
|
|
|
|
<table id="bootstrap-table"></table> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
<th:block th:include="include :: footer" /> |
|
|
<th:block th:include="include :: footer" /> |
|
|
<th:block th:include="include :: datetimepicker-js" /> |
|
|
<th:block th:include="include :: datetimepicker-js" /> |
|
|
<th:block th:include="include :: bootstrap-table-editable-js" /> |
|
|
<th:block th:include="include :: bootstrap-table-editable-js" /> |
|
|
<script th:inline="javascript"> |
|
|
<script th:inline="javascript"> |
|
|
var prefix = ctx + "purchase/purchaseOrder"; |
|
|
var prefix = ctx + "purchase/purchaseOrder"; |
|
|
|
|
|
|
|
|
|
|
|
var purchaseOrder = [[${purchaseOrder}]]; |
|
|
|
|
|
|
|
|
var auditStatusDatas = [[${@dict.getType('auditStatus')}]]; |
|
|
var auditStatusDatas = [[${@dict.getType('auditStatus')}]]; |
|
|
var useStatusDatas = [[${@dict.getType('useStatus')}]]; |
|
|
var useStatusDatas = [[${@dict.getType('useStatus')}]]; |
|
|
var processMethodDatas = [[${@dict.getType('processMethod')}]]; |
|
|
var processMethodDatas = [[${@dict.getType('processMethod')}]]; |
|
@ -55,165 +67,102 @@ |
|
|
var warehouseDeptDatas = [[${@dict.getType('warehouseDept')}]]; |
|
|
var warehouseDeptDatas = [[${@dict.getType('warehouseDept')}]]; |
|
|
var purchaseOrderCode = [[${purchaseOrder.purchaseOrderCode}]]; |
|
|
var purchaseOrderCode = [[${purchaseOrder.purchaseOrderCode}]]; |
|
|
$("#form-addPurchaseStorage-edit").validate({ focusCleanup: true}); |
|
|
$("#form-addPurchaseStorage-edit").validate({ focusCleanup: true}); |
|
|
//生成的不同table的id集合 |
|
|
|
|
|
var tableDatas = []; |
|
|
|
|
|
|
|
|
//物料信息展示列表 |
|
|
$(function() { |
|
|
$(function() { |
|
|
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到 |
|
|
var options = { |
|
|
var purchaseOrderCode = [[${purchaseOrder.purchaseOrderCode}]]; // 这里需要实际赋值,比如从前端某个地方读取 |
|
|
modalName: "选择物料", |
|
|
$.getJSON(prefix + "/detailListGroupedBySupplier?qualityOrderCode=" + purchaseOrderCode, function(data) { |
|
|
url: prefix + "/selectOrderChildMaterialList", |
|
|
for (var supplierCode in data) { |
|
|
queryParams: queryParams, |
|
|
if (data.hasOwnProperty(supplierCode)) { |
|
|
showSearch: false, |
|
|
var supplierData = data[supplierCode]; |
|
|
showRefresh: false, |
|
|
createTableForSupplier(supplierCode, supplierData); |
|
|
showToggle: false, |
|
|
} |
|
|
showColumns: false, |
|
|
} |
|
|
pagination: false, // 设置不分页 |
|
|
}); |
|
|
columns: [{ |
|
|
}); |
|
|
checkbox: true |
|
|
function createTableForSupplier(supplierCode, supplierData) { |
|
|
}, |
|
|
var tableId = 'bootstrap-table-' + supplierCode.replace(/[^a-z0-9]/gi, '_').toLowerCase(); |
|
|
|
|
|
tableDatas.push(tableId); |
|
|
{ |
|
|
var $tableWrapper = $('<div class="table-responsive"></div>'); |
|
|
title: '料号', |
|
|
// 确保supplierData至少有一条记录,并从中提取供应商详细信息 |
|
|
field: 'materialNo', |
|
|
var supplierInfo = supplierData.length > 0 ? supplierData[0] : {}; // 默认为空对象,以防数据不存在 |
|
|
}, |
|
|
// 构建含有额外供应商信息的标题字符串 |
|
|
{ |
|
|
var headerTitle ='供应商'+'</br>'+supplierCode + ' - ' + supplierInfo.supplierName ; |
|
|
title: '物料名称', |
|
|
var $header = $('<h4>' + headerTitle + '</h4>'); |
|
|
field: 'materialName', |
|
|
var $table = $('<table id="' + tableId + '" class="table table-striped table-bordered"></table>'); |
|
|
}, |
|
|
$table.bootstrapTable({ |
|
|
{ |
|
|
data: supplierData, |
|
|
title: '物料类型', |
|
|
columns: [ |
|
|
field: 'materialType', |
|
|
{checkbox: false,visible: false}, |
|
|
|
|
|
{title: '供应商ID',field: 'supplierCode',visible: false}, |
|
|
|
|
|
{title: '料号',field: 'materialCode'}, |
|
|
|
|
|
{title: '物料名称',field: 'materialName'}, |
|
|
|
|
|
{title: '物料类型',field: 'materialType', |
|
|
|
|
|
formatter: function (value,row, index) { |
|
|
formatter: function (value,row, index) { |
|
|
$.table.selectCategoryLabel(materialTypeDatas, value) |
|
|
$.table.selectCategoryLabel(materialTypeDatas, value) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
{title: '物料图片地址',field: 'materialPhotourl', |
|
|
{ |
|
|
formatter: function (value, row, index) { |
|
|
title: '物料型号', |
|
|
$.table.imageView(value) |
|
|
field: 'materialModel', |
|
|
} |
|
|
|
|
|
}, |
|
|
}, |
|
|
{title: '物料描述',field: 'materialDescribe',}, |
|
|
{ |
|
|
{title: '物料品牌',field: 'materialBrand',}, |
|
|
title: '物料品牌', |
|
|
{title: '物料单位',field: 'materialUnit', |
|
|
field: 'materialBrand', |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '物料单位', |
|
|
|
|
|
field: 'materialUnit', |
|
|
formatter:function (value) { |
|
|
formatter:function (value) { |
|
|
return $.table.selectDictLabel(materialUnitDatas, value); |
|
|
return $.table.selectDictLabel(materialUnitDatas, value); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
{title: '物料加工方式',field: 'materialProcessMethod', |
|
|
{ |
|
|
|
|
|
title: '物料描述', |
|
|
|
|
|
field: 'materialDescribe', |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '物料加工方式', |
|
|
|
|
|
field: 'materialProcessMethod', |
|
|
formatter:function (value) { |
|
|
formatter:function (value) { |
|
|
return $.table.selectDictLabel(processMethodDatas, value); |
|
|
return $.table.selectDictLabel(processMethodDatas, value); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
{title: '入库部门',field: 'warehouseDept',visible: false, |
|
|
{ |
|
|
|
|
|
title: '物料入库部门', |
|
|
|
|
|
field: 'materialDeptType', |
|
|
formatter:function (value) { |
|
|
formatter:function (value) { |
|
|
return $.table.selectDictLabel(warehouseDeptDatas, value); |
|
|
return $.table.selectDictLabel(warehouseDeptDatas, value); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
{title: '计划采购数',field: 'materialNum',}, |
|
|
{title: '计划采购数',field: 'planPurchaseNum',}, |
|
|
{title: '实际采购数',field: 'materialRealNum',}, |
|
|
{title: '实际采购数',field: 'actualPurchaseNum',}, |
|
|
{title: '交付时间',field: 'deliveryTime',}, |
|
|
{title: '交付时间',field: 'planDeliveryTime',}, |
|
|
{title: '通知已到货数',field: 'notifyHasArrivedNum', |
|
|
{title: '通知已到货数',field: 'notifyHasArrivedNum', |
|
|
formatter: function (value, row, index) { |
|
|
|
|
|
if (value == null || value == '') { |
|
|
|
|
|
value = 0; |
|
|
|
|
|
} |
|
|
|
|
|
return value; |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
{title: '暂收数',field: 'temporaryNum',}, |
|
|
|
|
|
|
|
|
{title: '已入库数',field: 'hasStorageNum', |
|
|
{title: '已入库数',field: 'hasStorageNum', |
|
|
formatter: function (value, row, index) { |
|
|
|
|
|
if (value == null || value == '') { |
|
|
|
|
|
value = 0; |
|
|
|
|
|
} |
|
|
|
|
|
return value; |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
}, |
|
|
{title: '通知到货数',field: 'notifyArriveNum',editable: { |
|
|
{title: '通知到货数',field: 'notifyArriveNum' |
|
|
type: 'text', |
|
|
|
|
|
title: '通知到货数', |
|
|
|
|
|
validate: function (value, row, index) { |
|
|
|
|
|
var num = parseInt(value); |
|
|
|
|
|
if (isNaN(num)) { |
|
|
|
|
|
return '请输入数字'; |
|
|
|
|
|
} else if (num < 0) { |
|
|
|
|
|
return '不能小于0'; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
] |
|
|
] |
|
|
}); |
|
|
}; |
|
|
$tableWrapper.append($header).append($table); |
|
|
$.table.init(options); |
|
|
$('#tablesContainer').append($tableWrapper); |
|
|
}) |
|
|
} |
|
|
|
|
|
var relatedOrderCode = [[${purchaseOrder.purchaseOrderCode}]]; |
|
|
function queryParams(params) { |
|
|
var warehouseCode = [[${purchaseOrder.stockNo}]]; |
|
|
var curParams = { |
|
|
var warehouseName = [[${purchaseOrder.stockName}]]; |
|
|
// 传递参数查询参数 |
|
|
var warehouseDetailAddress = [[${purchaseOrder.stockAddress}]]; |
|
|
purchaseOrderCode: purchaseOrder.purchaseOrderCode |
|
|
function submitHandler() { |
|
|
}; |
|
|
const storageOrderData = $("#form-addPurchaseStorage-edit").serializeArray().reduce((obj, item) => { |
|
|
return curParams; |
|
|
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) { |
|
|
|
|
|
// 根据实际字段名调整 |
|
|
|
|
|
return { |
|
|
|
|
|
"supplierCode": item.supplierCode, |
|
|
|
|
|
"supplierName":item.supplierName, |
|
|
|
|
|
"materialNo": item.materialCode, |
|
|
|
|
|
"materialName": item.materialName, |
|
|
|
|
|
"materialType": item.materialType, |
|
|
|
|
|
"materialPhotourl": item.materialPhotourl, |
|
|
|
|
|
"materialDescribe": item.materialDescribe, |
|
|
|
|
|
"materialBrand": item.materialBrand, |
|
|
|
|
|
"materialUnit": item.materialUnit, |
|
|
|
|
|
"materialDeptType": item.warehouseDept, |
|
|
|
|
|
"materialProcessMethod": item.materialProcessMethod, |
|
|
|
|
|
"notifyHasArrivedNum": item.notifyHasArrivedNum, |
|
|
|
|
|
"hasStorageNum": item.hasStorageNum, //已入库数量 |
|
|
|
|
|
"notifyArriveNum": item.notifyArriveNum, //通知到货数量 |
|
|
|
|
|
"relatedOrderCode":purchaseOrderCode |
|
|
|
|
|
}; |
|
|
|
|
|
}); |
|
|
|
|
|
allMaterialDataList = allMaterialDataList.concat(materialDataList); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
const combinedData = Object.assign({}, storageOrderData, { |
|
|
|
|
|
relatedOrderCode:relatedOrderCode, |
|
|
|
|
|
warehouseCode:warehouseCode, |
|
|
|
|
|
warehouseName:warehouseName, |
|
|
|
|
|
warehouseDetailAddress:warehouseDetailAddress, |
|
|
|
|
|
warehouseStorageOrderDetailList: allMaterialDataList |
|
|
|
|
|
}); |
|
|
|
|
|
// 合并表单数据和表格数据 |
|
|
|
|
|
// const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData); |
|
|
|
|
|
// 使用 JSON.stringify() 序列化数据 |
|
|
|
|
|
const jsonData = JSON.stringify(combinedData); |
|
|
|
|
|
// 发送 AJAX 请求到后端接口 |
|
|
|
|
|
$.operate.saveJson(prefix + "/addPurchaseOrderStorageSave", jsonData); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("input[name='arrivedTime']").datetimepicker({ |
|
|
$("input[name='arrivedTime']").datetimepicker({ |
|
|
format: "yyyy-mm-dd", |
|
|
format: "yyyy-mm-dd", |
|
|
minView: "month", |
|
|
minView: "month", |
|
|
autoclose: true, |
|
|
autoclose: true, |
|
|
}).datetimepicker("update", new Date());; |
|
|
}).datetimepicker("update", new Date());; |
|
|
|
|
|
|
|
|
$("input[name='deliveryInspectionTime']").datetimepicker({ |
|
|
|
|
|
format: "yyyy-mm-dd", |
|
|
|
|
|
minView: "month", |
|
|
|
|
|
autoclose: true |
|
|
|
|
|
}); |
|
|
|
|
|
</script> |
|
|
</script> |
|
|
</body> |
|
|
</body> |
|
|
</html> |
|
|
</html> |