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.
491 lines
17 KiB
491 lines
17 KiB
<#import "../master.ftl" as master>
|
|
<@master.layout>
|
|
<style>
|
|
/* 新增的样式 */
|
|
#delivery_fm label {
|
|
width: 135px;
|
|
}
|
|
/* 去下划线 */
|
|
a.disabled-underscore{
|
|
text-decoration: none;
|
|
}
|
|
.input-css{
|
|
border: 1px solid;
|
|
border-color: #95B8E7;
|
|
border-radius: 5px;
|
|
height: 25px;
|
|
}
|
|
.button-disabled {
|
|
pointer-events: none; /* 禁止鼠标事件 */
|
|
cursor: default; /* 更改鼠标指针为默认样式 */
|
|
color: gray; /* 可选:改变颜色以指示链接被禁用 */
|
|
text-decoration: none; /* 可选:移除下划线 */
|
|
}
|
|
|
|
</style>
|
|
|
|
<div class="page-header">
|
|
<h2>Counting List</h2>
|
|
</div>
|
|
|
|
<table id="dg" class="easyui-datagrid" style="width:100%;height:460px;display: none;"
|
|
data-options="pagination: true, pageSize:20, showFooter: true, singleSelect:true, fitColumns:true ,
|
|
queryParams:{status: $('#search_status').val()},
|
|
url:'/inventory/getAllInventoryTask', method:'POST', toolbar:'#tb'">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'inventoryNo',width:60">Counting No</th>
|
|
<th data-options="field:'status',width:60,formatter:formatStatusRemark" >Status</th>
|
|
<th data-options="field:'createdBy',width:60">Created By</th>
|
|
<th data-options="field:'createdDate',width:100, align: 'center',formatter:formatDateTime">Create Date</th>
|
|
<th data-options="field:'updatedBy',width:60,align:'left'">Updated By</th>
|
|
<th data-options="field:'updatedDate',width:100,align:'center',formatter:formatDateTime">Update Date</th>
|
|
<th data-options="field:'locationNo',width:100,editor:'text'">Counted Locations</th>
|
|
<th data-options="field:'partNo', width:60,editor:'text'">Counted Parts</th>
|
|
<th data-options="field:'remark', width:60, editor:'textbox'">Remark</th>
|
|
<th data-options="field:'id',width:200, formatter: formatDeliveryAction">Actions</th>
|
|
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
|
|
<div id="tb" style="padding:10px 5px;display: none;">
|
|
<div>
|
|
盘点任务单号: <input class="easyui-textbox" id="search_inventory_no" name="inventoryNo" style="width:100px">
|
|
物料编码: <input class="easyui-textbox" id="search_part_no" name="partNo" style="width:100px">
|
|
库位: <input class="easyui-textbox" id="search_location_no" name="locationNo" style="width:100px">
|
|
Status:
|
|
<select class="easyui-combobox" name="status" id="search_status" style="width:90px;">
|
|
<option value="ALL">ALL</option>
|
|
<option value="N">In Propress</option>
|
|
<option value="Y">Counted</option>
|
|
<option value="C">Cancelled</option>
|
|
</select>
|
|
<#--创建日期: <input class="easyui-datebox" id="createdDateFrom" style="width:100px">
|
|
至: <input class="easyui-datebox" id="createdDateTo" style="width:100px">-->
|
|
<a id="queryLink" onclick="searchData()" class="easyui-linkbutton" iconCls="icon-search">Search</a>
|
|
|
|
<a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="createInventoryTasks()">New Counting Report</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 新增盘点单 -->
|
|
<div id="sales_inventory_modal" class="easyui-dialog" style="width: 380px;display: none;"
|
|
data-options="modal:true, onClose: function(){ $('#dg').datagrid('reload')}"
|
|
closed="true" buttons="#sales-delivery-buttons">
|
|
<form id="sales_inventory_fm" method="post" novalidate style="margin:0;padding:20px 20px">
|
|
<div style="margin-bottom:10px; display: none;" >
|
|
<input id="id" name="id" class="easyui-textbox " style="display: none;" value="0">
|
|
</div>
|
|
<div style="margin-bottom: 10px">
|
|
<label>Counting No:</label>
|
|
<input id="inventory_no" name="inventoryNo" class="input-css" style="width: 75%; margin-left: 10px;" readonly>
|
|
</div>
|
|
<div style="margin-bottom: 10px">
|
|
<label>物料编码:</label>
|
|
<input id="part_no" name="partNo" class="input-css" style="width: 75%; margin-left: 10px;" autocomplete="off">
|
|
</div>
|
|
<div style="margin-bottom: 10px">
|
|
<label style="margin-left: 24px;">库位:</label>
|
|
<input id="location_no" name="locationNo" class="input-css" style="width: 75%; margin-left: 10px;" autocomplete="off">
|
|
</div>
|
|
<div style="margin-bottom: 10px">
|
|
<label style="margin-left: 24px;">Remark:</label>
|
|
<input id="remark" name="remark" class="input-css" style="width: 75%; margin-left: 10px;" autocomplete="off">
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div id="sales-delivery-buttons" style="display: none; text-align: center;">
|
|
<a href="javascript:void(0)" id="saveButton" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveinventoryTask()" style="width:90px">Save</a>
|
|
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#sales_inventory_modal').dialog('close')" style="width:90px">Close</a>
|
|
</div>
|
|
|
|
|
|
|
|
<!-- 盘点明细 -->
|
|
<div id="inventory_detail_modal" class="easyui-dialog" style="width: 730px;display: none;" closed="true" data-options="modal:true" >
|
|
<table id="inventory_detail_table" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
|
|
data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true ,
|
|
method:'POST', pageSize:20,toolbar:'#inventory_detail_buttons'">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'inventoryNo',width:150">Counting No</th>
|
|
<th data-options="field:'labelNo',width:150">Box No</th>
|
|
<th data-options="field:'labelQty',width:80,align:'right' " >Quantity</th>
|
|
<th data-options="field:'partNo',width:120">Part No</th>
|
|
<th data-options="field:'locationNo',width:100">Location No</th>
|
|
<th data-options="field:'keyinFlag',width:120, formatter:formatDetailStatusRemark">Counted Flag</th>
|
|
<th data-options="field:'keyinBy',width:120">Counted By</th>
|
|
<th data-options="field:'keyinDate',width:180,align: 'center',formatter:formatDateTime">Counted Time</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
<div id="inventory_detail_buttons" style="padding:10px 5px;display: none;">
|
|
<div>
|
|
<a class="easyui-linkbutton" iconCls="icon-add" onclick="downInventoryDetailExcel()">Export to Excel</a>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 盘点 -->
|
|
<div id="performing_task_modal" class="easyui-dialog" style="width: 650px;display: none;" closed="true" data-options="modal:true" >
|
|
<table id="performing_task_table" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
|
|
data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true ,
|
|
method:'POST', pageSize:20,toolbar:'#performing_task_buttons'">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'labelNo',width:150">Box No</th>
|
|
<th data-options="field:'labelQty',width:80,align:'right' " >Quantity</th>
|
|
<th data-options="field:'partNo',width:120">Part No</th>
|
|
<th data-options="field:'locationNo',width:100">Location No</th>
|
|
<th data-options="field:'keyinFlag',width:120, formatter:formatDetailStatusRemark">Counted Flag</th>
|
|
<th data-options="field:'keyinBy',width:120">Counted By</th>
|
|
<th data-options="field:'keyinDate',width:180,align: 'center',formatter:formatDateTime">Counted Time</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
<div id="performing_task_buttons" style="padding:10px 5px;display: none;">
|
|
<div>
|
|
<div style="margin-bottom: 10px">
|
|
<label>Counting No:</label>
|
|
<input id="performing_inventory_no" name="inventoryNo" class="input-css" style="width: 30%; margin-left: 10px;" autocomplete="off" readonly>
|
|
</div>
|
|
<div style="margin-bottom: 10px">
|
|
<label>Please scan Box No:</label>
|
|
<input id="performing_label_no" name="labelNo" class="input-css" style="width: 30%; margin-left: 10px;" autocomplete="off">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
//公共参数
|
|
var currentRow;//盘点单信息
|
|
var addFlag = "Y";//盘点单信息
|
|
let site = $('#current_site').val();
|
|
$(window).resize(function () {
|
|
$("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 30});
|
|
});
|
|
|
|
$(function () {
|
|
$(window).resize();
|
|
});
|
|
|
|
//延时
|
|
var delay = (function(){
|
|
var timer = 0;
|
|
return function(callback, ms){
|
|
clearTimeout (timer);
|
|
timer = setTimeout(callback, ms);
|
|
};
|
|
})();
|
|
|
|
//格式化字符串时间
|
|
function formatStringDateTime(value, row){
|
|
if(null == value || '' == value){
|
|
return '';
|
|
}
|
|
//处理位数不够的问题
|
|
if(value.length < 19){
|
|
value = value.substring(0, 10);
|
|
}else{
|
|
value = value.substring(0, 19);
|
|
}
|
|
|
|
value = value.replaceAll("T"," ");
|
|
return value;
|
|
}
|
|
|
|
|
|
//状态中文翻译
|
|
function formatStatusRemark(value, row){
|
|
if('Y' == value){
|
|
return 'Counted';
|
|
}else if('N' == value){
|
|
return 'In Propress';
|
|
}else if('C' == value){
|
|
return 'Cancelled';
|
|
}
|
|
}
|
|
function formatDetailStatusRemark(value, row){
|
|
if('Y' == value){
|
|
return 'Counted';
|
|
}else if('N' == value){
|
|
return 'To be Counted';
|
|
}
|
|
}
|
|
|
|
//查询主表的数据
|
|
function searchData(){
|
|
var dg = $('#dg').datagrid({
|
|
queryParams: {
|
|
inventoryNo: $('#search_inventory_no').val(),
|
|
partNo: $('#search_part_no').val(),
|
|
locationNo: $('#search_location_no').val(),
|
|
status: $('#search_status').val(),
|
|
/* startDate: $('#createdDateFrom').val(),
|
|
endDate: $('#createdDateTo').val()*/
|
|
}
|
|
});
|
|
}
|
|
|
|
//主表功能
|
|
function formatDeliveryAction(value, row){
|
|
//根据状态区分不同的按钮
|
|
let status = row.status;
|
|
let tags = '';
|
|
if('N' == status){
|
|
tags += '<a onclick="performingTaskModal(\''+row.inventoryNo+'\')" class="disabled-underscore">Counting</a> | ';
|
|
}
|
|
if('N' == status){
|
|
tags += '<a onclick="closeInventoryTask(\''+row.inventoryNo+'\')" class="disabled-underscore">Complete Counting</a> | ';
|
|
tags += '<a onclick="deleteInventoryTask(\''+row.inventoryNo+'\')" class="disabled-underscore">Cancel Counting Report</a> | ';
|
|
}
|
|
tags += '<a onclick="getAllInventoryTasksDetail(\''+row.inventoryNo+'\')" class="disabled-underscore">Detail</a>';
|
|
return tags;
|
|
}
|
|
|
|
//绑定的enter事件
|
|
$('#part_no').bind("keydown", function (e) {
|
|
if (e.keyCode == 13) {
|
|
let value = $.trim($(this).val());
|
|
if(null != value && '' !== value && value.substring(value.length-1) !== ';'){
|
|
$(this).val(value+";");
|
|
//校验物料编码
|
|
}
|
|
}
|
|
});
|
|
$('#location_no').bind("keydown", function (e) {
|
|
if (e.keyCode == 13) {
|
|
let value = $.trim($(this).val());
|
|
console.log(value);
|
|
if(null != value && '' !== value && value.substring(value.length-1) !== ';'){
|
|
$(this).val(value+";");
|
|
//校验库位
|
|
}
|
|
}
|
|
});
|
|
$('#performing_label_no').bind("keydown", function (e) {
|
|
if (e.keyCode == 13) {
|
|
let value = $.trim($(this).val()); //扫描箱码
|
|
console.log(value);
|
|
if(null != value && '' !== value){
|
|
//触发扫码盘点事件
|
|
performingInventoryTask(value);
|
|
}
|
|
}
|
|
});
|
|
|
|
//提交网址
|
|
let url = '';
|
|
//新增出货单的modal
|
|
function createInventoryTasks(){
|
|
addFlag = "Y";
|
|
$('#id').textbox("setValue", 0);
|
|
$('#sales_inventory_modal').dialog('open').dialog('center').dialog('setTitle','New Counting Report');
|
|
$('#sales_inventory_fm').form('clear');
|
|
//生成盘点单号
|
|
createInventoryNo();
|
|
$('#part_no').focus();
|
|
url = '/saveCountingHeader'; //新增方法
|
|
|
|
}
|
|
|
|
//获取盘点单号
|
|
function createInventoryNo(){
|
|
//获取盘点单号
|
|
$.ajaxSetup({
|
|
contentType: "application/x-www-form-urlencoded"});
|
|
$.post('/getMaxCountingId', "", function(result){
|
|
if (result.success){
|
|
//放入单号标签中
|
|
$('#inventory_no').val(result.reportId);
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error');
|
|
}
|
|
},'json');
|
|
$.ajaxSetup({
|
|
contentType: " application/x-www-form-urlencoded"});
|
|
}
|
|
|
|
//关闭盘点单
|
|
function closeInventoryTask(inventoryNo){
|
|
|
|
let postData = {'inventoryNo': inventoryNo};
|
|
//保存或修改数据
|
|
//序列化
|
|
postData = JSON.stringify(postData);
|
|
//post请求类型修改
|
|
$.ajaxSetup({
|
|
contentType: "application/json;charset=utf-8"});
|
|
$.post("/checkTaskIfScanAll", postData, function(result){
|
|
if (result.success){
|
|
let comStr = 'There is lines have not be counted yet in this counting report ,are you sure to close the counting report(<b>'+inventoryNo+'</b>)?';
|
|
if (result.checkFlag){
|
|
comStr = 'There is lines have not be counted yet in this counting report ,are you sure to close the counting report(<b>'+inventoryNo+'</b>)?';
|
|
}
|
|
$.messager.confirm('Confirm',comStr, function(r){
|
|
if (r){
|
|
addFlag = 'N';
|
|
//取到当前的行
|
|
delay(function(){
|
|
currentRow = $('#dg').datagrid('getSelected');
|
|
url = '/closeCountingHeader';
|
|
currentRow.updatedBy = username;
|
|
//调用方法
|
|
saveinventoryTask();
|
|
}, 500);
|
|
}
|
|
});
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error');
|
|
}
|
|
},'json');
|
|
$.ajaxSetup({
|
|
contentType: " application/x-www-form-urlencoded"});
|
|
}
|
|
|
|
//删除确认
|
|
function deleteInventoryTask(inventoryNo){
|
|
$.messager.confirm('Confirm','Are you sure to cancel the counting report : <b>'+inventoryNo+'</b> ?', function(r){
|
|
if (r){
|
|
addFlag = 'D';
|
|
//取到当前的行
|
|
delay(function(){
|
|
currentRow = $('#dg').datagrid('getSelected');
|
|
currentRow.updatedBy = username;
|
|
url = '/deleteCountingHeader';
|
|
//调用删除方法
|
|
saveinventoryTask();
|
|
}, 500);
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
//保存盘点单信息
|
|
function saveinventoryTask(){
|
|
|
|
let postData;
|
|
//判断是否新增
|
|
if(addFlag == 'N'){//结束盘点任务
|
|
postData = {'inventoryNo': currentRow.inventoryNo, 'updatedBy': username };
|
|
}if(addFlag == 'Y'){//新增
|
|
let inventoryNo = $.trim($("#inventory_no").val());
|
|
let partNo = $.trim($("#part_no").val());
|
|
let locationNo = $.trim($("#location_no").val());
|
|
let remark = $.trim($("#remark").val());
|
|
let id = $.trim($("#id").val());
|
|
//空值判断
|
|
if(null == inventoryNo || '' == inventoryNo){
|
|
$.messager.alert('error','Exception error when generate counting no, please refresh and try again!', 'error');
|
|
return false;
|
|
}
|
|
postData = {'inventoryNo': inventoryNo, 'partNo': partNo, 'locationNo': locationNo,
|
|
'remark': remark, 'createdBy': username};
|
|
} else{ //删除盘点任务
|
|
postData = {'inventoryNo': currentRow.inventoryNo, 'updatedBy': username};
|
|
}
|
|
//保存或修改数据
|
|
//序列化
|
|
postData = JSON.stringify(postData);
|
|
//post请求类型修改
|
|
$('#saveButton').addClass("button-disabled");
|
|
$.ajaxSetup({
|
|
contentType: "application/json;charset=utf-8"});
|
|
$.post(url, postData, function(result){
|
|
$('#saveButton').removeClass("button-disabled");
|
|
if (result.success){
|
|
//刷新主表数据
|
|
$('#dg').datagrid('reload');
|
|
//隐藏modal
|
|
$('#sales_inventory_modal').dialog('close');
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error');
|
|
}
|
|
},'json');
|
|
$.ajaxSetup({
|
|
contentType: " application/x-www-form-urlencoded"});
|
|
}
|
|
|
|
//查询盘点详细信息
|
|
function getAllInventoryTasksDetail(inventoryNo){
|
|
delay(function(){
|
|
currentRow = $('#dg').datagrid('getSelected');
|
|
$('#inventory_detail_modal').dialog('open').dialog('center').dialog('setTitle', inventoryNo+'的盘点明细');
|
|
//已经发货的不允许新增和重新导入
|
|
let opts = $('#inventory_detail_table').datagrid('options');
|
|
opts.queryParams = {'inventoryNo': inventoryNo};
|
|
$("#inventory_detail_table").datagrid({url: "/getAllInventoryTaskDetail",
|
|
onLoadSuccess: function(data) {
|
|
|
|
}
|
|
});
|
|
}, 500);
|
|
}
|
|
|
|
|
|
//盘点Modal
|
|
function performingTaskModal(inventoryNo){
|
|
delay(function(){
|
|
currentRow = $('#dg').datagrid('getSelected');
|
|
$('#performing_task_modal').dialog('open').dialog('center').dialog('setTitle', inventoryNo+'的盘点任务');
|
|
$('#performing_inventory_no').val(inventoryNo);
|
|
let opts = $('#performing_task_table').datagrid('options');
|
|
opts.queryParams = {'inventoryNo': inventoryNo};
|
|
$("#performing_task_table").datagrid({url: "/getInventoryTaskDetailByScan",
|
|
onLoadSuccess: function(data) {
|
|
|
|
}
|
|
});
|
|
$('#performing_label_no').focus();
|
|
}, 500);
|
|
}
|
|
|
|
//保存盘点单信息
|
|
function performingInventoryTask(labelNo){
|
|
|
|
let postData = {'inventoryNo': currentRow.inventoryNo, 'labelNo': labelNo, 'updatedBy': username };
|
|
//保存或修改数据
|
|
//序列化
|
|
postData = JSON.stringify(postData);
|
|
//post请求类型修改
|
|
$.ajaxSetup({
|
|
contentType: "application/json;charset=utf-8"});
|
|
$.post('/performingInventoryTask', postData, function(result){
|
|
if (result.success){
|
|
//刷新表数据
|
|
$('#performing_task_table').datagrid('reload');
|
|
//清空获取焦点
|
|
$('#performing_label_no').val('');
|
|
$('#performing_label_no').focus();
|
|
} else {
|
|
//清空获取焦点
|
|
$('#performing_label_no').val('');
|
|
$('#performing_label_no').focus();
|
|
$.messager.alert('error',result.msg, 'error');
|
|
}
|
|
},'json');
|
|
$.ajaxSetup({
|
|
contentType: " application/x-www-form-urlencoded"});
|
|
}
|
|
|
|
|
|
//下载Excel数据
|
|
function downInventoryDetailExcel(){
|
|
let inventoryNo = currentRow.inventoryNo;
|
|
let print_url = '/export/downInventoryDetailExcel?inventoryNo='+inventoryNo;
|
|
$("#ifmforprint").attr('src', print_url);
|
|
}
|
|
|
|
</script>
|
|
|
|
</@master.layout>
|
|
|