You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

219 lines
8.7 KiB

<#import "../master.ftl" as master>
<@master.layout>
<style>
#fm label {
width: 150px;
}
</style>
<div class="page-header">
<h3>Query of Counting</h3>
</div>
<table id="dg" class="easyui-datagrid" style="width:100%;height:460px;display: none;"
data-options="pagination: true, showFooter: true, singleSelect:true, fitColumns:true , url:'/counting/all',method:'get',pageSize:20,toolbar:'#tb'">
<thead>
<tr>
<th data-options="field:'countingNo',width:100,editor:'textbox'">Counting No</th>
<th data-options="field:'remark',width:200,editor:'textbox'">Remark</th>
<th data-options="field:'createdBy',width:80,align:'left'">Created By</th>
<th data-options="field:'createdDate',width:150,align:'center',formatter:formatDateTime">Create Date</th>
<th data-options="field:'status',width:100,editor:'textbox'">Status</th>
<th data-options="field:'id',width:150,align:'center',formatter:formatAction">Actions</th>
</tr>
</thead>
</table>
<div id="tb" style="padding:10px 5px;display: none;">
<div>
盘点号: <input class="easyui-textbox" id="countingNo" style="width:110px">
Create Date: <input class="easyui-datetimebox" id="createdDateFrom" style="width:160px">
到: <input class="easyui-datetimebox" id="createdDateTo" style="width:160px">
<a href="#nowhere" id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Search</a>
&nbsp;&nbsp;&nbsp;
<a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="showCountingDialog()">New Counting Report</a>
</div>
</div>
<form enctype="multipart/form-data" id="importForm" style="display:none;" method="post">
<input type="file" name="importFile" id="importFile"/>
</form>
<div id="dlgDtls" class="easyui-dialog" style="width:1000px;display: none;"
closed="true" data-options="modal:true">
<table id="dgDtls" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get', pageSize:50">
<thead>
<tr>
<th data-options="field:'partno',width:200">Part No</th>
<th data-options="field:'partdescription',width:250">Part Description</th>
<th data-options="field:'locationno',width:150">Location No</th>
<th data-options="field:'lotbatchno',width:200">Lot/Batch No</th>
<th data-options="field:'onhandqty',width:150">On Hand Qty</th>
<th data-options="field:'availableqty',width:150">Available Qty</th>
<th data-options="field:'countedqty',width:150">Counted Qty</th>
<th data-options="field:'varianceqty',width:150">Variance Qty</th>
<th data-options="field:'uom',width:100">UoM</th>
<th data-options="field:'receiptdate',width:250">Receipt Date</th>
</tr>
</thead>
</table>
</div>
<div id="dlg" class="easyui-dialog" style="width:500px;display: none;" closed="true" buttons="#dlg-buttons">
<form id="fm" method="post" novalidate style="margin:0;padding:20px 20px">
<div style="margin-bottom:10px">
<input name="countingRemark" id="countingRemark" class="easyui-textbox" required="true" label="Please input remark:" style="width:100%">
</div>
<div style="margin-bottom:10px;float:right;">
<a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newCounting()">Ok</a>
</div>
</form>
</div>
<script>
$(window).resize(function () {
$("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20});
});
$(function () {
$(window).resize();
});
$.extend($.fn.validatebox.defaults.rules, {
validDate: {
validator: function (value) {
var date = $.fn.datebox.defaults.parser(value);
var s = $.fn.datebox.defaults.formatter(date);
return s == value;
},
message: 'Please enter a valid date.'
},
valueRange: {
validator: function (value, param) {
return value >= param[0] && value <= param[1];
},
message: 'Field do not match.'
}
});
$("#queryLink").click(function () {
var dg = $('#dg').datagrid({
queryParams: {
countingNo: $("#countingNo").val(),
createdDateFrom: $("#createdDateFrom").val(),
createdDateTo: $("#createdDateTo").val()
}
});
});
function formatAction(value, row) {
return "<a href='javascript:importCountingDtls(\"" + row.countingNo + "\")'>Import</a>&nbsp;&nbsp;&nbsp;<a href='javascript:viewCountingDetail(\"" + row.countingNo + "\")'>View</a>&nbsp;&nbsp;&nbsp;<a href='javascript:downloadCounting(\"" + row.countingNo + "\")'>Export</a>&nbsp;&nbsp;&nbsp;<a href='javascript:deleteCounting(\"" + row.countingNo + "\")'>Delete</a>";
}
function viewCountingDetail(countingNo) {
$('#dlgDtls').dialog('open').dialog('center').dialog('setTitle', 'Detail of Counting');
$("#dgDtls").datagrid({url: "/counting/detail/" + countingNo});
}
function downloadCounting(countingNo) {
window.open("/counting/download/" + countingNo, '_blank');
}
function deleteCounting(countingNo) {
if (confirm("Are you sure to delete the counting data?")) {
$.post("/counting/delete/" + countingNo, {}, function (result) {
if (result.errorMsg) {
$.messager.alert('error', result.errorMsg, 'error');
} else {
$('#dg').datagrid('reload');
}
});
}
}
function showCountingDialog() {
$('#dlg').dialog('open').dialog('center').dialog('setTitle', 'New Counting Report');
$('#fm').form('clear');
}
function newCounting() {
var countingRemark = $("#countingRemark").val();
if (countingRemark === "") {
$.messager.alert('error', "Please input remark", 'error');
return;
}
$.post("/counting/add", {
"remark": countingRemark
}, function (result) {
if (result.errorMsg) {
$.messager.alert('error', result.errorMsg, 'error');
} else {
$('#dlg').dialog('close');
$('#dg').datagrid('reload');
}
});
}
function importCountingDtls(countNo) {
$("#importFile").click();
importCountingNo = countNo;
}
function saveReceive() {
$('#fm').form('submit', {
url: "/receive/add",
onSubmit: function () {
return $(this).form('validate');
},
success: function (result) {
var result = eval("(" + result + ")");
if (result.errorMsg) {
$.messager.alert('error', result.errorMsg, 'error');
} else {
$('#dlg').dialog('close'); // close the dialog
$('#dg').datagrid('reload'); // reload the user data
}
}
});
}
var importCountingNo = null;
$(function () {
$('#importFile').change(function () {
if (this.files.length > 0) {
setTimeout(function () {
//创建FormData对象,初始化为form表单中的数据。需要添加其他数据可使用formData.append("property", "value");
var formData = new FormData($('#importForm')[0]);
//ajax异步上传
$.ajax({
url: "/counting/import/" + importCountingNo,
type: "POST",
data: formData,
cache: false,
success: function (result) {
$('#importFile').val("");
if (result.errorMsg) {
$.messager.alert('error', result.errorMsg, 'error');
}
else {
$('#dlg').dialog('close'); // close the dialog
$('#dg').datagrid('reload'); // reload the user data
}
},
contentType: false, //必须false才会自动加上正确的Content-Type
processData: false //必须false才会避开jQuery对 formdata 的默认处理
});
}, 100);
}
});
});
</script>
</@master.layout>