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.
 
 
 
 
 

863 lines
28 KiB

<#import "../master.ftl" as master>
<@master.layout>
<style>
#fm label {
width: 150px;
}
.page-header {
margin: 20px 0 -10px;
}
.customer-label .textbox-label{
width: 120px;
}
</style>
<div class="page-header">
<h3>Packing&Receive</h3>
</div>
<!-- 页面表单 -->
<table id="dg" class="easyui-datagrid" style="width:100%; height:400px;display: none;"
data-options="pagination: true, pageSize: 20, singleSelect:true, showFooter: true, fitColumns:true,
onSelect:onTableRowSelect, url:'/so/fqc/getPackSoOrderList', method:'POST', queryParams:{'status': 'Generated'},
toolbar:'#tb'">
<thead>
<tr>
<th data-options="field:'orderNo',width:80,editor:'textbox'">SO No</th>
<th data-options="field:'partNo',width:80,editor:'textbox'">Part No</th>
<th data-options="field:'partDesc',width:140,editor:'textbox'">Part Description</th>
<th data-options="field:'revNo',width:50">Rev No</th>
<th data-options="field:'lotSize',width:60,editor:'textbox'">Lot Size</th>
<th data-options="field:'stockedQty',width:60,editor:'textbox'">Received Qty</th>
<th data-options="field:'packageQty',width:60,editor:'textbox'">Standard Roll Qty</th>
<th data-options="field:'boxQty',width:60,editor:'textbox'">Standard Box Qty</th>
<th data-options="field:'id',width:250,editor:'textbox', formatter: formatOrderAction">Actions</th>
</tr>
</thead>
</table>
<!-- 页面的查询框 -->
<div id="tb" style="padding:10px 5px;display: none;">
<div>
SO No: <input class="easyui-textbox" id="orderNo" style="width:110px">
Create Date: <input class="easyui-datebox" id="createdDateFrom" style="width:100px">
to: <input class="easyui-datebox" id="createdDateTo" style="width:100px">
<a href="#nowhere" id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Query</a>
<a style="text-decoration:none;" class="easyui-linkbutton" onclick="stockBoxModal()">Receive Scanning</a>
</div>
</div>
<!-- 入库箱的列表 -->
<div id="box_modal" class="easyui-dialog" style="width: 550px; top: -80px; display: none;"
closed="true" data-options="modal:true, onSelect:onTableRowSelectBox" >
<table id="box_modal_table" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true ,
method:'POST', pageSize:50, toolbar:'#tbBoxDtls'">
<thead>
<tr>
<th data-options="field:'boxNo',width:100">Box No</th>
<th data-options="field:'boxQty',width:60, editor:'textbox'">Qty</th>
<th data-options="field:'status',width:60, formatter:formatBoxStatus">Status</th>
<th data-options="field:'id',width:220, formatter:formatBoxFunction">Actions</th>
</tr>
</thead>
</table>
</div>
<div id="tbBoxDtls" style="padding:10px 5px;display: none;">
<div id="btn_box_excel">
<a href="javascript:void(0)" id="add_box" class="easyui-linkbutton" iconCls="icon-add" onclick="addBoxData()">New Box</a>
</div>
</div>
<!-- 扫描卷modal -->
<div id="scan_roll_modal" class="easyui-dialog" style="width: 405px; display: none;" closed="true" data-options="modal: true, onClose: function(){
$('#box_modal_table').datagrid('reload')},">
<form id="scan_roll_fm" method="post" novalidate style="margin:0; padding: 20px 20px">
<div style="margin-bottom:10px">
<label id="current_box_no">Box No:</label>
</div>
<div style="margin-bottom:10px">
<label>Roll no:</label>
<input id="scan_roll_no" name="rollNo" style="width: 75%; margin-left: 10px;">
</div>
</form>
<table id="scan_rolls" class="easyui-datagrid" style="width:100%;height: 300px;">
<thead>
<tr>
<th data-options="field:'sortNo',width:60, formatter:formatRollSort">Item No</th>
<th data-options="field:'rollNo',width:120,editor:'textbox'">Roll No</th>
<th data-options="field:'rollQty',width:80,editor:'textbox'">Qty</th>
<th data-options="field:'id',width:98, formatter: formatRollFunction">Actions</th>
</tr>
</thead>
</table>
</div>
<!-- 整箱扫描 -->
<div id="stock_box_modal" class="easyui-dialog" buttons='#tbStockBox' style="width: 400px; display: none;" closed="true" buttons="#scan-box-buttons"
data-options="modal:true, " >
<div id="stock_box_fm" style="margin-left: 20px; margin-top: 20px; margin-bottom: 20px">
<div style="margin-bottom:10px">
<label>Box No:</label>
<input id="scan_box_no" name="boxNo" style="height:26px; margin-left: 12%; width:67%">
</div>
<div style="margin-bottom:10px">
<label>Location No:</label>
<input id="scan_location_no" name="locationNo" style="height:26px; margin-left: 12%; width:67%">
</div>
</div>
<table id="stock_box_table" class="easyui-datagrid" style="width:100%;height: 300px;">
<thead>
<tr>
<th data-options="field:'sortNo',width:60, formatter: formatStockBoxSort">Item No</th>
<th data-options="field:'boxNo',width:120,editor:'textbox'">New Box No</th>
<th data-options="field:'boxQty',width:90,editor:'textbox'">Box Qty</th>
<th data-options="field:'id',width:98, formatter: formatStockBoxFunction">Actions</th>
</tr>
</thead>
</table>
</div>
<div id="tbStockBox" style="padding:10px 5px; display: none; text-align: center;">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" onclick="batchToStock()">Batch Receive</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#stock_box_modal').dialog('close')" style="width:90px">Cancel</a>
</div>
<!-- 箱管理 -->
<div id="box_manage_modal" class="easyui-dialog" style="width: 650px; display: none;" closed="true" data-options="modal:true, " >
<table id="manage_boxs" class="easyui-datagrid" style="width:100%;height: 300px;">
<thead>
<tr>
<th data-options="field:'sortNo',width:60, formatter: formatManageBoxSort">Item No</th>
<th data-options="field:'boxNo',width:120,editor:'textbox'">New Box No</th>
<th data-options="field:'boxQty',width:90,editor:'textbox'">Box Qty</th>
<th data-options="field:'locationNo',width:100,editor:'textbox'">Location No</th>
<th data-options="field:'id',width:220, formatter: formatManageBoxFunction">Actions</th>
</tr>
</thead>
</table>
</div>
<!-- 扫描返工 -->
<div id="rework_box_modal" class="easyui-dialog" style="width: 400px; display: none;" closed="true"
data-options="modal:true, " >
<div id="rework_box_fm" style="margin-left: 20px; margin-top: 20px; margin-bottom: 20px">
<div style="margin-bottom:10px">
<label>Box No:</label>
<input id="rework_box_no" name="boxNo" style="height:26px; margin-left: 12%; width:67%">
</div>
</div>
</div>
<!-- 扫描取消返工 -->
<div id="cancel_rework_modal" class="easyui-dialog" style="width: 400px; display: none;" closed="true"
data-options="modal:true, " >
<div id="cancel_rework_fm" style="margin-left: 20px; margin-top: 20px; margin-bottom: 20px">
<div style="margin-bottom:10px">
<label>Roll No:</label>
<input id="rework_roll_no" name="rollNo" style="height:26px; margin-left: 12%; width:67%">
</div>
</div>
</div>
<script>
//临时参数
let site = $('#current_site').val();
let username = $('#current_username').val();
var currentRow;//当前行
var currentBoxRow;//当前的箱
//控制页面的高度
$(window).resize(function () {
$("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 30});
});
//初始化页面的高度
$(function () {
$(window).resize();
});
//处理菜单的功能
function onTableRowSelect(index, row) {
currentRow = row;
}
//自动选定箱
function onTableRowSelectBox(index, row) {
currentBoxRow = row;
}
//查询功能
$("#queryLink").click(function(){
var dg = $('#dg').datagrid({
queryParams: {
orderNo: $("#orderNo").val(),
createdDateFrom: $("#createdDateFrom").val(),
createdDateTo: $("#createdDateTo").val(),
'status': 'Generated'
}
});
});
//格式化工单的功能
function formatOrderAction(value, row){
let tags = '';
tags += '<a style="text-decoration:none;" onclick="boxManagerModal()">Scanning Box</a>'+' | ';
tags += '<a style="text-decoration:none;" onclick="boxManageModal(\''+row.orderNo+'\')">Box Management</a>'+' | ';
tags += '<a style="text-decoration:none;" onclick="reworkBoxModal(\''+row.orderNo+'\')">Rework</a>'+' | ';
tags += '<a style="text-decoration:none;" onclick="cancelReworkModal(\''+row.orderNo+'\')">Cancel Rework</a>';
return tags;
}
//格式化箱状态
function formatBoxStatus(value, row){
if ('Created' == value) {
return "Created";
}else if('Boxing' == value){
return 'Packing';
}else if('Boxed' == value){
return 'Packed';
}else if('Delivered' == value){
return 'Shipped';
}else if('Stocked' == value){
return 'Received';
}
}
//中包的功能菜单
function formatBoxFunction(value, row){
let status = row.status;
let tags = '';
if('Created' == status){
tags += '<a style="text-decoration:none;" onclick="boxingPackModal(\'box\')">Scanning Box</a> | ';
tags += '<a style="text-decoration:none;" onclick="deleteSoOrderBox(\''+row.boxNo+'\')">Delete</a>';
}else if('Boxing' == status){
tags += '<a style="text-decoration:none;" onclick="boxingPackModal(\'box\')">Scanning Box</a> | ';
tags += '<a style="text-decoration:none;" onclick="deleteSoOrderBox(\''+row.boxNo+'\')">Delete</a> | ';
tags += '<a style="text-decoration:none;" onclick="sealingBox(\''+row.boxNo+'\')">Packed</a>';
}else if('Boxed' == status){
tags += '<a style="text-decoration:none;" onclick="openBoxedRollModal()">List of Rolls</a> | ';
tags += '<a style="text-decoration:none;" onclick="preUnsealBox(\''+row.boxNo+'\')">UnPack</a>';
tags += ' | <a style="text-decoration:none;" onclick="printBoxLabelThird(\''+row.boxNo+'\')">Print Box Label</a>';
}else if('Stocked' == status){
tags += '<a style="text-decoration:none;" onclick="openBoxedRollModal()">List of Rolls</a> ';
tags += ' | <a style="text-decoration:none;" onclick="printBoxLabelThird(\''+row.boxNo+'\')">Print Box Label</a>';
}else {
tags += '<a style="text-decoration:none;" onclick="openBoxedRollModal()">List of Rolls</a> ';
}
return tags;
}
function printBoxLabelThird( boxNo){
$("#ifmforprint").attr('src', "/aoi/receiveBox/" + boxNo );
}
//查询当前箱数据
function boxManagerModal(){
delay(function(){
let row = $('#dg').datagrid('getSelected');
//设置当前的行
currentRow = row;
let reworkType = row.reworkType;
$("#add_box").linkbutton({"disabled": false});
$('#box_modal').dialog('open').dialog('center').dialog('setTitle', currentRow.orderNo+'Box Management');
var opts = $('#box_modal_table').datagrid('options');
opts.queryParams = {'orderNo': currentRow.orderNo};
$("#box_modal_table").datagrid({url: "/so/fqc/getPackSoOrderBoxs",
onLoadSuccess: function(data) {
}
});
}, 500);
}
//新增工单箱
function addBoxData(){
//设置参数
let postData = {'site': site, 'orderNo': currentRow.orderNo, 'boxQty': 0, 'createdBy': $('#current_username').val(),
'status': 'Created', 'statusCode': 1};
//序列化
postData = JSON.stringify(postData);
//post请求类型修改
$.ajaxSetup({
contentType: "application/json;charset=utf-8"});
//提交请求
$.post('/so/fqc/addSoOrderBoxData', postData, function(result){
if(result.success){
currentBoxRow = result.row;
//打开箱扫描卷的页面
boxingPackModal();
//刷新箱号的列表
$('#box_modal_table').datagrid('reload')
}else{
$.messager.alert('Error',ret.msg, 'error');
}
}, 'json');
$.ajaxSetup({
contentType: "application/x-www-form-urlencoded"});
}
//延时操作
var delay = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout (timer);
timer = setTimeout(callback, ms);
};
})();
//扫描Roll的modal
function boxingPackModal(entryMark){
delay(function(){
//判断是否扫描进来的
if(entryMark){
currentBoxRow = $('#box_modal_table').datagrid('getSelected');
}
//显示form
$('#scan_roll_fm').show();
//设置当前的行
$('#scan_roll_modal').dialog('open').dialog('center').dialog('setTitle', "Box No:"+currentBoxRow.boxNo);
//设置参数
$("#current_box_no").html("Box No: "+currentBoxRow.boxNo)
$('#scan_roll_no').focus();
//加sn的数据
var opts = $('#scan_rolls').datagrid('options');
opts.queryParams = {'orderNo': currentRow.orderNo, "boxNo": currentBoxRow.boxNo};
$("#scan_rolls").datagrid({url: "/so/fqc/getPackSoOrderBoxRolls",
onLoadSuccess: function(data) {
}
});
}, 500);
}
//roll表格序号
function formatRollSort(value, row, index){
let rows = $("#scan_rolls").datagrid("getData").rows;
let total = rows.length;
return total - index;
}
//sn列表的功能
function formatRollFunction(value, row){
let status = currentBoxRow.status;
let tags = '';
//没有封包的时候才可以删除
if('Created' == status || 'Boxing' == status){
tags += '<a style="text-decoration:none;" onclick="deleteSoOrderRoll(\''+row.rollNo+'\')">Delete</a>';
}
return tags;
}
//页面打开关闭选中的箱
$("#scan_roll_modal").dialog({
onOpen: function () {
//获取焦点
$('#scan_roll_no').focus();
}
});
//绑定的enter事件
$('#scan_roll_no').bind("keydown", function (e) {
if (e.keyCode == 13) {
let rollNo = $.trim($("#scan_roll_no").val());
if(null == rollNo || '' == rollNo){
$.messager.alert('error', 'Please scan the roll no!', 'error', function(){
//自动获取焦点
$('#scan_roll_no').val('');
$("#scan_roll_no").focus();
});
return false;
}else{
scanRollNo(rollNo);
return false;
}
}
});
//扫描卷
function scanRollNo(rollNo){
let postData = {'site': site, 'orderNo': currentBoxRow.orderNo, 'boxNo': currentBoxRow.boxNo,
'rollNo': rollNo, "createdBy": username, "status": "Boxed", "statusCode": 3};
//转json字符串
postData = JSON.stringify(postData);
//设置请求的类型
$.ajaxSetup({
contentType: "application/json;charset=utf-8"});
$.post('/so/fqc/scanRollNo', postData,
function(result){
if (result.success){
//判断是否自动封包
if(result.sealFlag){
//执行封箱的操作
sealingBox(currentBoxRow.boxNo);
}
//获取当前的行数
$('#scan_rolls').datagrid('reload');
$('#scan_roll_no').val('');
$("#scan_roll_no").focus();
} else {
$.messager.alert('error',result.msg, 'error', function(){
//自动获取焦点
$('#scan_roll_no').val('');
$("#scan_roll_no").focus();
});
}
},'json');
//设置请求的类型
$.ajaxSetup({
contentType: "application/x-www-form-urlencoded"});
}
//删除卷的数据
function deleteSoOrderRoll(rollNo){
//判断操作
$.messager.confirm('Confirm','Are you sure to delete the roll<b>'+rollNo+'</b>?', function(r){
if(r){
//判断是否存在当前的当前的箱
let boxRow = $('#box_modal_table').datagrid('getSelected');
if(boxRow){
currentBoxRow = boxRow;
}
let postData = {'site': site, 'orderNo': currentBoxRow.orderNo, 'boxNo': currentBoxRow.boxNo, 'rollNo': rollNo, 'createdBy': username};
//序列化
postData = JSON.stringify(postData);
//post请求类型修改
$.ajaxSetup({
contentType: "application/json;charset=utf-8"});
//提交请求
$.post('/so/fqc/cancelScanRollNo', postData, function(result){
if(result.success){
$('#scan_rolls').datagrid('reload');
}else{
$.messager.alert('Error',result.msg, 'error');
}
}, 'json');
$.ajaxSetup({
contentType: "application/x-www-form-urlencoded"});
}
});
}
//自动封箱
function sealingBox(boxNo){
delay(function(){
//重置封箱的行
if(!currentBoxRow){
currentBoxRow = $('#box_modal_table').datagrid('getSelected');
}
//设置参数
let postData = {'site': site, 'orderNo': currentBoxRow.orderNo, 'boxNo': boxNo,
'updatedBy': username, 'status': 'Boxed', 'statusCode': 3};
//序列化
postData = JSON.stringify(postData);
//post请求类型修改
$.ajaxSetup({
contentType: "application/json;charset=utf-8"});
//提交请求
$.post('/so/fqc/sealingBox', postData, function(result){
if(result.success){
//关闭当前扫描窗口页面
$("#scan_roll_modal").dialog("close");
//打印箱标签
printBoxLabelThird( boxNo);
//刷新箱号的列表
$('#box_modal_table').datagrid('reload');
}else{
$.messager.alert('Error',result.msg, 'error');
}
}, 'json');
$.ajaxSetup({
contentType: "application/x-www-form-urlencoded"});
}, 500);
}
//拆封 确认
function preUnsealBox(boxNo){
delay(function(){
currentBoxRow = $('#box_modal_table').datagrid('getSelected');
//重置缓存行
$.messager.confirm('Confirm','Are you sure to unpack the box:'+boxNo+'?', function(r){
if (r){
unsealBox(boxNo);
}
});
}, 500);
}
//自动封箱
function unsealBox(boxNo){
delay(function(){
//设置参数
let postData = {'site': site, 'orderNo': currentBoxRow.orderNo, 'boxNo': boxNo,
'updatedBy': username, 'status': 'Boxing', 'statusCode': 2};
//序列化
postData = JSON.stringify(postData);
//post请求类型修改
$.ajaxSetup({
contentType: "application/json;charset=utf-8"});
//提交请求
$.post('/so/fqc/unsealBox', postData, function(result){
if(result.success){
//关闭当前扫描窗口页面
$("#scan_roll_modal").dialog("close");
//打印箱标签
//printBoxLabelThird(orderNo, boxNo);
//刷新箱号的列表
$('#box_modal_table').datagrid('reload');
}else{
$.messager.alert('Error',result.msg, 'error');
}
}, 'json');
$.ajaxSetup({
contentType: "application/x-www-form-urlencoded"});
}, 500);
}
//显示入库箱的中包列表
function openBoxedRollModal(){
//显示form
$('#scan_roll_fm').hide();
delay(function(){
//设置中包的参数
currentBoxRow = $('#box_modal_table').datagrid('getSelected');
$('#scan_roll_modal').dialog('open').dialog('center').dialog('setTitle', ""+currentBoxRow.boxNo+' List of Box');
//设置查询的参数
var opts = $('#scan_rolls').datagrid('options');
opts.queryParams = {'orderNo': currentBoxRow.orderNo, 'boxNo': currentBoxRow.boxNo};
$("#scan_rolls").datagrid({url: "/so/fqc/getPackSoOrderBoxRolls",
onLoadSuccess: function(data) {
}
});
}, 500);
}
//删除工单箱
function deleteSoOrderBox(boxNo){
$.messager.confirm('Confirm','Are you sure to delete the box<b>'+boxNo+'</b>?', function(r){
if(r){
//提交请求
$.post('/so/fqc/deleteSoOrderBox', {'orderNo': currentRow.orderNo, 'boxNo': boxNo}, function(result){
if(result.success){
//刷新箱的列表
$('#box_modal_table').datagrid('reload');
}else{
$.messager.alert('Error', result.msg, 'error');
}
}, 'json');
}
});
}
//roll表格序号
function formatStockBoxSort(value, row, index){
let rows = $("#stock_box_table").datagrid("getData").rows;
let total = rows.length;
return total - index;
}
//入库箱的操作
function formatStockBoxFunction(value, row){
let tags = '';
tags += '<a style="text-decoration:none;" onclick="cancelScanSoOrderBox(\''+row.boxNo+'\')">Delete</a>';
return tags;
}
//查询当前箱数据
function stockBoxModal(){
delay(function(){
//let row = $('#dg').datagrid('getSelected');
//设置当前的行
//currentRow = row;
//清空参数
$('#scan_box_no').val('');
$('#scan_location_no').val('');
$('#stock_box_modal').dialog('open').dialog('center').dialog('setTitle', "Receive Scanning");
var opts = $('#stock_box_table').datagrid('options');
opts.queryParams = {'username': username};
$("#stock_box_table").datagrid({url: "/so/fqc/getNotStockSoOrderBoxs",
onLoadSuccess: function(data) {
}
});
}, 500);
}
//页面打开关闭选中的箱
$("#stock_box_modal").dialog({
onOpen: function () {
//获取焦点
$('#scan_box_no').focus();
}
});
//绑定的enter事件
$('#scan_box_no').bind("keydown", function (e) {
if (e.keyCode == 13) {
let boxNo = $.trim($("#scan_box_no").val());
if(null == boxNo || '' == boxNo){
$.messager.alert('error', 'Please scan the box no!', 'error', function(){
//自动获取焦点
$('#scan_box_no').val('');
$("#scan_box_no").focus();
});
return false;
}else{
scanBoxNo(boxNo);
return false;
}
}
});
//扫描箱
function scanBoxNo(boxNo){
let postData = {'site': site, 'boxNo': boxNo, "createdBy": username, "status": "Boxed", "statusCode": 3};
//转json字符串
postData = JSON.stringify(postData);
//设置请求的类型
$.ajaxSetup({
contentType: "application/json;charset=utf-8"});
$.post('/so/fqc/scanSoOrderBoxNo', postData,
function(result){
if (result.success){
//获取当前的行数
$('#stock_box_table').datagrid('reload');
$('#scan_box_no').val('');
$("#scan_box_no").focus();
} else {
$.messager.alert('error',result.msg, 'error', function(){
//自动获取焦点
$('#scan_box_no').val('');
$("#scan_box_no").focus();
});
}
},'json');
//设置请求的类型
$.ajaxSetup({
contentType: "application/x-www-form-urlencoded"});
}
//取消扫描的箱信息
function cancelScanSoOrderBox(boxNo){
let postData = {'site': site, 'boxNo': boxNo, "createdBy": username};
//转json字符串
postData = JSON.stringify(postData);
//设置请求的类型
$.ajaxSetup({
contentType: "application/json;charset=utf-8"});
$.post('/so/fqc/cancelScanSoOrderBoxNo', postData,
function(result){
if (result.success){
//获取当前的行数
$('#stock_box_table').datagrid('reload');
$('#scan_box_no').val('');
$("#scan_box_no").focus();
} else {
$.messager.alert('error',result.msg, 'error', function(){
//自动获取焦点
$('#scan_box_no').val('');
$("#scan_box_no").focus();
});
}
},'json');
//设置请求的类型
$.ajaxSetup({
contentType: "application/x-www-form-urlencoded"});
}
//批量入库
function batchToStock(){
let locationNo = $('#scan_location_no').val();
//判断是否存在空值
if(null == locationNo || '' == locationNo){
$.messager.alert('error', 'Please scan the location no!', 'error', function(){
//自动获取焦点
$('#scan_location_no').val('');
$("#scan_location_no").focus();
});
return false;
}
let postData = {'site': site, "username": username, "locationNo": locationNo};
$.post('/so/fqc/boxBatchToStocked', postData,
function(result){
if (result.success){
//获取当前的行数
$('#stock_box_table').datagrid('reload');
$('#scan_box_no').val('');
$("#scan_box_no").focus();
} else {
$.messager.alert('error',result.msg, 'error', function(){
//自动获取焦点
$('#scan_box_no').val('');
$("#scan_box_no").focus();
});
}
},'json');
}
//装箱管理的modal
function boxManageModal(orderNo){
delay(function(){
//判断是否扫描进来的
currentRow = $('#dg').datagrid('getSelected');
//设置当前的行
$('#box_manage_modal').dialog('open').dialog('center').dialog('setTitle', ""+orderNo+'List of Boxes');
//加sn的数据
var opts = $('#manage_boxs').datagrid('options');
opts.queryParams = {'orderNo': orderNo};
$("#manage_boxs").datagrid({url: "/so/fqc/getSoOrderManageBoxs",
onLoadSuccess: function(data) {
}
});
}, 500);
}
//箱管理序号
function formatManageBoxSort(value, row, index){
let rows = $("#manage_boxs").datagrid("getData").rows;
let total = rows.length;
return total - index;
}
//处理操作按钮
function formatManageBoxFunction(value, row, index){
let tags = '';
if('Stocked' == row.status){
tags += '<a style="text-decoration:none;" onclick="cacelStockedBox(\''+row.orderNo+'\',\''+row.boxNo+'\')">UnReceive</a>';
}
return tags;
}
//取消入库的操作
function cacelStockedBox(orderNo, boxNo){
let postData = {'orderNo': orderNo, "boxNo": boxNo};
$.post('/so/fqc/cacelStockedBox', postData,
function(result){
if (result.success){
//获取当前的行数
$('#manage_boxs').datagrid('reload');
} else {
$.messager.alert('error',result.msg, 'error', function(){
//自动获取焦点
});
}
},'json');
}
/* 按箱返工 */
function reworkBoxModal(){
delay(function(){
//设置中包的参数
currentRow = $('#dg').datagrid('getSelected');
$('#rework_box_modal').dialog('open').dialog('center').dialog('setTitle', ""+currentRow.orderNo+'Rework');
}, 500);
}
//页面打开关闭选中的箱
$("#rework_box_modal").dialog({
onOpen: function () {
//获取焦点
$('#rework_box_no').focus();
}
});
//绑定的enter事件
$('#rework_box_no').bind("keydown", function (e) {
if (e.keyCode == 13) {
let boxNo = $.trim($("#rework_box_no").val());
if(null == boxNo || '' == boxNo){
$.messager.alert('error', 'Please Input box no!', 'error', function(){
//自动获取焦点
$('#rework_box_no').val('');
$("#rework_box_no").focus();
});
return false;
}else{
scanBoxToRework(boxNo);
return false;
}
}
});
//取消扫描返工
function scanBoxToRework(boxNo){
let postData = {'orderNo': currentRow.orderNo, "username": username, "boxNo": boxNo};
$.post('/so/fqc/scanBoxToRework', postData,
function(result){
if (result.success){
//获取当前的行数
$.messager.alert('info', result.msg, 'info');
$('#rework_box_no').val('');
$("#rework_box_no").focus();
} else {
$.messager.alert('error',result.msg, 'error', function(){
//自动获取焦点
$('#rework_box_no').val('');
$("#rework_box_no").focus();
});
}
},'json');
}
/* 按卷取消返工 */
function cancelReworkModal(){
delay(function(){
//设置中包的参数
currentRow = $('#dg').datagrid('getSelected');
$('#cancel_rework_modal').dialog('open').dialog('center').dialog('setTitle', currentRow.orderNo+'Cancel Rework');
}, 500);
}
//页面打开关闭选中的箱
$("#cancel_rework_modal").dialog({
onOpen: function () {
//获取焦点
$('#rework_roll_no').focus();
}
});
//绑定的enter事件
$('#cancel_rework_modal').bind("keydown", function (e) {
if (e.keyCode == 13) {
let rollNo = $.trim($("#rework_roll_no").val());
if(null == rollNo || '' == rollNo){
$.messager.alert('error', 'Please scan the roll no!', 'error', function(){
//自动获取焦点
$('#rework_roll_no').val('');
$("#rework_roll_no").focus();
});
return false;
}else{
scanRollToCancelRework(rollNo);
return false;
}
}
});
//扫卷取消返工
function scanRollToCancelRework(rollNo){
let postData = {'orderNo': currentRow.orderNo, "rollNo": rollNo};
$.post('/so/fqc/scanRollToCancelRework', postData,
function(result){
if (result.success){
//获取当前的行数
$.messager.alert('info', result.msg, 'info', function(){
$('#rework_roll_no').val('');
$("#rework_roll_no").focus();
});
} else {
$.messager.alert('error',result.msg, 'error', function(){
//自动获取焦点
$('#rework_roll_no').val('');
$("#rework_roll_no").focus();
});
}
},'json');
}
</script>
</@master.layout>