|
@ -9,29 +9,17 @@ |
|
|
<form class="form-horizontal m" id="form-inventoryCheck-edit" th:object="${warehouseInventoryCheck}"> |
|
|
<form class="form-horizontal m" id="form-inventoryCheck-edit" th:object="${warehouseInventoryCheck}"> |
|
|
<input name="inventoryCheckId" th:field="*{inventoryCheckId}" type="hidden"> |
|
|
<input name="inventoryCheckId" th:field="*{inventoryCheckId}" 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> |
|
|
<div class="col-sm-8"> |
|
|
<div class="col-sm-8"> |
|
|
<input name="inventoryCheckCode" th:field="*{inventoryCheckCode}" class="form-control" type="text"> |
|
|
<input name="inventoryCheckCode" th:field="*{inventoryCheckCode}" class="form-control" type="text"> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label class="col-sm-3 control-label">库存盘点人名:</label> |
|
|
<label class="col-sm-3 control-label">盘点人名:</label> |
|
|
<div class="col-sm-8"> |
|
|
<div class="col-sm-8"> |
|
|
<input name="inventoryCheckName" th:field="*{inventoryCheckName}" class="form-control" type="text"> |
|
|
<input name="inventoryCheckName" th:field="*{inventoryCheckName}" class="form-control" type="text"> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-group"> |
|
|
|
|
|
<label class="col-sm-3 control-label">料号:</label> |
|
|
|
|
|
<div class="col-sm-8"> |
|
|
|
|
|
<input name="materialNo" th:field="*{materialNo}" class="form-control" type="text"> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="form-group"> |
|
|
|
|
|
<label class="col-sm-3 control-label">物料名称:</label> |
|
|
|
|
|
<div class="col-sm-8"> |
|
|
|
|
|
<input name="materialName" th:field="*{materialName}" class="form-control" type="text"> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label class="col-sm-3 control-label">仓库号:</label> |
|
|
<label class="col-sm-3 control-label">仓库号:</label> |
|
|
<div class="col-sm-8"> |
|
|
<div class="col-sm-8"> |
|
@ -45,7 +33,7 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label class="col-sm-3 control-label">库存盘点日期:</label> |
|
|
<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="inventoryCheckDate" th:value="${#dates.format(warehouseInventoryCheck.inventoryCheckDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text"> |
|
|
<input name="inventoryCheckDate" th:value="${#dates.format(warehouseInventoryCheck.inventoryCheckDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text"> |
|
@ -53,18 +41,6 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-group"> |
|
|
|
|
|
<label class="col-sm-3 control-label">物料数合计:</label> |
|
|
|
|
|
<div class="col-sm-8"> |
|
|
|
|
|
<input name="materialTotal" th:field="*{materialTotal}" class="form-control" type="text"> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="form-group"> |
|
|
|
|
|
<label class="col-sm-3 control-label">数量合计:</label> |
|
|
|
|
|
<div class="col-sm-8"> |
|
|
|
|
|
<input name="numTotal" th:field="*{numTotal}" class="form-control" type="text"> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label class="col-sm-3 control-label">备注内容:</label> |
|
|
<label class="col-sm-3 control-label">备注内容:</label> |
|
|
<div class="col-sm-8"> |
|
|
<div class="col-sm-8"> |
|
@ -72,26 +48,217 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</form> |
|
|
</form> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 物料信息 --> |
|
|
|
|
|
<div class="container"> |
|
|
|
|
|
<div class="form-row"> |
|
|
|
|
|
<div class="btn-group-sm" id="toolbar" role="group"> |
|
|
|
|
|
<span>选择物料</span> |
|
|
|
|
|
<a class="btn btn-success" onclick="insertRow()"> |
|
|
|
|
|
<i class="fa fa-plus"></i> 选择物料 |
|
|
|
|
|
</a> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<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" /> |
|
|
<script th:inline="javascript"> |
|
|
<script th:inline="javascript"> |
|
|
var prefix = ctx + "warehouse/inventoryCheck"; |
|
|
var prefix = ctx + "warehouse/inventoryCheck"; |
|
|
|
|
|
|
|
|
|
|
|
var warehouseInventoryCheck = [[${warehouseInventoryCheck}]]; |
|
|
|
|
|
|
|
|
$("#form-inventoryCheck-edit").validate({ |
|
|
$("#form-inventoryCheck-edit").validate({ |
|
|
focusCleanup: true |
|
|
focusCleanup: true |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
function submitHandler() { |
|
|
|
|
|
if ($.validate.form()) { |
|
|
|
|
|
$.operate.save(prefix + "/edit", $('#form-inventoryCheck-edit').serialize()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$("input[name='inventoryCheckDate']").datetimepicker({ |
|
|
$("input[name='inventoryCheckDate']").datetimepicker({ |
|
|
format: "yyyy-mm-dd", |
|
|
format: "yyyy-mm-dd", |
|
|
minView: "month", |
|
|
minView: "month", |
|
|
autoclose: true |
|
|
autoclose: true |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 新增提交 |
|
|
|
|
|
function submitHandler() { |
|
|
|
|
|
// 获取表单数据 |
|
|
|
|
|
const inventoryCheckData = $("#form-inventoryCheck-edit").serializeArray().reduce((obj, item) => { |
|
|
|
|
|
obj[item.name] = item.value; |
|
|
|
|
|
return obj; |
|
|
|
|
|
}, {}); |
|
|
|
|
|
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据 |
|
|
|
|
|
var table = $('#bootstrap-table').bootstrapTable('getData'); |
|
|
|
|
|
|
|
|
|
|
|
// 检查表格数据是否为空 |
|
|
|
|
|
if (table.length===0){ |
|
|
|
|
|
$.modal.alertWarning("请至少添加一条物料数据后再保存!"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
console.log(table); |
|
|
|
|
|
// 将表数据转换成与complaintNoticeData格式一致的数组 |
|
|
|
|
|
var materialDataList = table.map(function(item) { |
|
|
|
|
|
// 根据实际字段名调整 |
|
|
|
|
|
return { |
|
|
|
|
|
"inventoryCheckDetailId":item.inventoryCheckDetailId, |
|
|
|
|
|
"materialNo": item.materialNo, // 假设id对应materialId |
|
|
|
|
|
"materialName": item.materialName, |
|
|
|
|
|
"materialUnit": item.materialUnit, |
|
|
|
|
|
"materialDescribe": item.materialDescribe, |
|
|
|
|
|
"inventoryCheckNum": item.inventoryCheckNum, |
|
|
|
|
|
"inventoryAccountNum": item.inventoryAccountNum, |
|
|
|
|
|
"warehouseStoreAddress": item.warehouseStoreAddress, |
|
|
|
|
|
"batchNumber": item.batchNumber, |
|
|
|
|
|
"remark": item.remark, |
|
|
|
|
|
// ...其他字段 |
|
|
|
|
|
}; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const combinedData = Object.assign({}, inventoryCheckData, { inventoryCheckDetails: 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 + "/edit", jsonData); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//添加物料信息 |
|
|
|
|
|
function insertRow() { |
|
|
|
|
|
var url = ctx + 'warehouse/inventoryCheck/materialSelect'; |
|
|
|
|
|
var options = { |
|
|
|
|
|
title: '选择物料', |
|
|
|
|
|
url: url, |
|
|
|
|
|
callBack: doSubmit |
|
|
|
|
|
}; |
|
|
|
|
|
$.modal.openOptions(options); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//收款凭证table列表 |
|
|
|
|
|
$(function() { |
|
|
|
|
|
var options = { |
|
|
|
|
|
modalName: "收款凭证", |
|
|
|
|
|
url: prefix + '/getInventoryCheckDetailList', |
|
|
|
|
|
queryParams: queryParams, |
|
|
|
|
|
showColumns: false, |
|
|
|
|
|
pagination: false, |
|
|
|
|
|
showToggle: false, |
|
|
|
|
|
showRefresh:false, |
|
|
|
|
|
showSearch:false, |
|
|
|
|
|
singleSelect:true, |
|
|
|
|
|
columns: [{ |
|
|
|
|
|
checkbox: false |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '库存盘点详情ID', |
|
|
|
|
|
field: 'inventoryCheckDetailId', |
|
|
|
|
|
visible: false |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '料号', |
|
|
|
|
|
field: 'materialNo', |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '物料名称', |
|
|
|
|
|
field: 'materialName', |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '物料单位', |
|
|
|
|
|
field: 'materialUnit', |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '物料描述', |
|
|
|
|
|
field: 'materialDescribe', |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '盘点数量', |
|
|
|
|
|
field: 'inventoryCheckNum', |
|
|
|
|
|
editable:true |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '当时库存账上数量', |
|
|
|
|
|
field: 'inventoryAccountNum', |
|
|
|
|
|
editable:true |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '存放地址', |
|
|
|
|
|
field: 'warehouseStoreAddress', |
|
|
|
|
|
editable:true |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '批号', |
|
|
|
|
|
field: 'batchNumber', |
|
|
|
|
|
editable:true |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '说明', |
|
|
|
|
|
field: 'remark', |
|
|
|
|
|
editable:true |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '操作', |
|
|
|
|
|
align: 'center', |
|
|
|
|
|
formatter: function(value, row, index) { |
|
|
|
|
|
var actions = []; |
|
|
|
|
|
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.receivablesRecordsId + '\')"><i class="fa fa-remove"></i>删除</a> '); |
|
|
|
|
|
return actions.join(''); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
}; |
|
|
|
|
|
$.table.init(options); |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
function queryParams(params) { |
|
|
|
|
|
var curParams = { |
|
|
|
|
|
// 传递参数查询参数 |
|
|
|
|
|
inventoryCheckCode: warehouseInventoryCheck.inventoryCheckCode |
|
|
|
|
|
}; |
|
|
|
|
|
console.log(curParams); |
|
|
|
|
|
return curParams; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function doSubmit(index, layero,uniqueId){ |
|
|
|
|
|
console.log(uniqueId); |
|
|
|
|
|
var iframeWin = window[layero.find('iframe')[0]['name']]; |
|
|
|
|
|
var rowData = iframeWin.$('#bootstrap-materialSelect-table').bootstrapTable('getSelections')[0]; |
|
|
|
|
|
console.log("rowData: "+rowData); |
|
|
|
|
|
$("#bootstrap-table").bootstrapTable('insertRow', { |
|
|
|
|
|
index:1, |
|
|
|
|
|
row: { |
|
|
|
|
|
materialNo:rowData.materialNo, |
|
|
|
|
|
materialName: rowData.materialName, |
|
|
|
|
|
materialDescribe: rowData.materialDescribe, |
|
|
|
|
|
materialUnit: rowData.materialUnit, |
|
|
|
|
|
inventoryCheckNum : "", |
|
|
|
|
|
inventoryAccountNum : "", |
|
|
|
|
|
warehouseStoreAddress : "", |
|
|
|
|
|
batchNumber : "", |
|
|
|
|
|
remark : "" |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
layer.close(index); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 逻辑删除前端的一行数据 |
|
|
|
|
|
function removeRow(materialNo){ |
|
|
|
|
|
$("#bootstrap-table").bootstrapTable('remove', { |
|
|
|
|
|
field: 'materialNo', |
|
|
|
|
|
values: materialNo |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script> |
|
|
</script> |
|
|
</body> |
|
|
</body> |
|
|
</html> |
|
|
</html> |