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.
 
 
 
 
 

1145 lines
46 KiB

<#import "../master.ftl" as master>
<@master.layout>
<style>
#fm label {
width: 150px;
}
</style>
<#if errorMsg??>
<div class="page-header">
<h3>${errorMsg} </h3>
</div>
<#else>
<div class="page-header">
<h3>Job [${jobId!}]</h3>
通道一 <input type="radio" name="pass" value="1" onclick="showData();" style="vertical-align:middle; margin-top:0px; margin-bottom:1px; margin-right: 1%">
通道二 <input type="radio" name="pass" value="2" onclick="showData();" style="vertical-align:middle; margin-top:0px; margin-bottom:1px; margin-right: 1%">
通道三 <input type="radio" name="pass" value="3" onclick="showData();" style="vertical-align:middle; margin-top:0px; margin-bottom:1px; margin-right: 1%">
</div>
<p>
卷: [${slittingRollNo!}]
</p>
<p>
The first serial number: <span id = "firstSn">[<span id="snSpan">${firstSn!}</span>]</span>
</p>
<table id="dg" class="easyui-datagrid" style="width:100%;height:460px;display: none;"
data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , url:'/hsScan/scanpool/${jobId}/${passNo}/all',method:'get',pageSize:20,toolbar:'#tb'">
<thead>
<tr>
<th data-options="field:'serialNo',width:100">Serials Number</th>
</tr>
</thead>
</table>
<input type="hidden" id="orderNo" value="">
<div id="tb" style="padding:10px 5px;display: none;">
<div>
<a href="javascript:void(0)" id="tbScanRoll" class="easyui-linkbutton" iconCls="icon-add" onclick="scanRoll()">Scan roll number</a>
<a href="javascript:void(0)" id="tbScanFirstSn" class="easyui-linkbutton" iconCls="icon-add" onclick="scanFirstSn()">Scan the first serial number</a>
&nbsp;&nbsp;&nbsp;
<a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="badInput()">Type defective serial number</a>
<a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="createFinalRoll()">Create FG roll</a>
<#if currentUser.isAdmin>
<a href="javascript:void(0)" id="tbClear" class="easyui-linkbutton" iconCls="icon-remove" onclick="delPoll()">Clear scanning list</a>
</#if>
<a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-sum" onclick="openBoxPackModal()">扫卷装箱</a>
</div>
</div>
<div id="dlg" class="easyui-dialog for-scan" 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">
<label id="orderNo_display" class="easyui-textbox" data-options="labelWidth:100,disabled:true" required="true" label="工单号:" style="width:100%"></label>
</div>
<div id="serial_input_1st" style="margin-bottom:10px">
<input id="badFirstSN" name="firstSerialNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="The first serial number:" style="width:100%">
</div>
<div id="serial_input_2nd" style="margin-bottom:10px">
<input id="badEndSN" name="endSerialNo" class="easyui-textbox"
data-options="labelWidth:100" label="The second serial number:" style="width:100%">
</div>
</form>
</div>
<div id="dlg-buttons" style="display: none;">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" id="doOK" onclick="doOK()" style="width:90px">OK</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a>
</div>
<div id="dlgRoll" class="easyui-dialog for-scan" style="width:550px;display: none;"
closed="true" buttons="#dlg-buttons-roll">
<div style="margin-top: 15px;margin-left: 20px;">
通道一 <input type="radio" name="RollNoPass" value="1" onclick="getRollData();" style="vertical-align:middle; width: 20px;height: 20px; margin-top:0px; margin-bottom:1px; margin-right: 8%">
通道二 <input type="radio" name="RollNoPass" value="2" onclick="getRollData();" style="vertical-align:middle; width: 20px;height: 20px; margin-top:0px; margin-bottom:1px; margin-right: 8%">
通道三 <input type="radio" name="RollNoPass" value="3" onclick="getRollData();" style="vertical-align:middle; width: 20px;height: 20px; margin-top:0px; margin-bottom:1px; margin-right: 8%">
</div>
<form id="fmRoll" method="post" novalidate style="margin:0;padding:20px 20px">
<div style="margin-bottom:10px">
<label name="slittingRollNo" id="slittingRollNo" class="easyui-textbox" data-options="labelWidth:100" required="true" label="Roll No:" style="width:100%"></label>
</div>
</form>
</div>
<div id="dlg-buttons-roll" style="display: none;">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="doScanRollOK()" style="width:90px">OK</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="closeScanRoll()" style="width:90px">Cancel</a>
</div>
<div id="dlgFirstSn" class="easyui-dialog for-scan" style="width:550px;display: none;"
closed="true" buttons="#dlg-buttons-firstsn">
<div style="margin-bottom: 10px;margin:0;padding:13px 20px ">
<input id="firstSerialNo" name="firstSn" class="easyui-textbox"
required="true" data-options="labelWidth:100" label="The first serial number:"
style="width: 100%">
</div>
<div style="margin-bottom: 10px;margin:0;padding:0px 20px ">
<input id="pass1" class="easyui-textbox"
required="true" data-options="labelWidth:100" label="通道一:"
style="width: 100%" readonly>
</div>
<div style="margin-bottom: 10px;margin:0;padding:13px 20px">
<input id="pass2" class="easyui-textbox"
required="true" data-options="labelWidth:100" label="通道二:"
style="width: 100%" readonly>
</div>
<div style="margin-bottom: 10px;margin:0;padding:13px 20px;padding-top: 0px;">
<input id="pass3" class="easyui-textbox"
required="true" data-options="labelWidth:100" label="通道三:"
style="width: 100%" readonly>
</div>
</div>
<div id="dlg-buttons-firstsn" style="display: none;">
<!--<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="doFirstSnOK()" style="width:90px">OK</a>-->
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="closeFirstSn()" style="width:90px">Close</a>
</div>
<div id="dlgFinalRoll" class="easyui-dialog for-scan" style="width:550px;display: none;"
closed="true" buttons="#dlg-buttons-finalroll">
<form id="fm" method="post" novalidate style="margin:0;padding:20px 20px">
<div style="margin-bottom:10px">
<input id="endSerialNo" name="endSerialNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="本卷结束序列号:" style="width:100%">
</div>
<div style="margin-bottom:10px">
<input id="nextSerialNo" name="nextSerialNo" class="easyui-textbox" data-options="labelWidth:100" label="The end serial number of current roll" style="width:100%">
</div>
</form>
</div>
<div id="dlg-buttons-finalroll" style="display: none;">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" id="doFinalRoll" onclick="doFinalRollOK()" style="width:90px">OK</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="closeFinalRoll()" style="width:90px">Cancel</a>
</div>
<div id="dlgBadSnDtls" class="easyui-dialog" style="width:600px;display: none;"
closed="true" data-options="modal:true" >
<div style="margin-bottom: 5px;margin-left: 7px;margin-top: 5px;">
通道一 <input type="radio" name="badpass" value="1" style="vertical-align:middle; margin-top:0px; margin-bottom:1px; margin-right: 9%">
通道二 <input type="radio" name="badpass" value="2" style="vertical-align:middle; margin-top:0px; margin-bottom:1px; margin-right: 9%">
通道三 <input type="radio" name="badpass" value="3" style="vertical-align:middle; margin-top:0px; margin-bottom:1px; margin-right: 9%">
</div>
<table id="dgBadSnDtls" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get', pageSize:20,toolbar:'#tbBadSnDtls'">
<thead>
<tr>
<th data-options="field:'serialNo',width:100">Defective serial number</th>
</tr>
</thead>
</table>
<div id="tbBadSnDtls" style="padding:10px 5px;display: none;">
<div>
录入不良序列号: <input class="easyui-textbox" id="inptBadSn" style="width:250px">
<a href="#nowhere" id="lnkOK" class="easyui-linkbutton" iconCls="icon-add" onclick="addNewBadSn()">Ok</a>
<a id="btnBadRange" onclick="doBadRange()" class="easyui-linkbutton" iconCls="icon-add">Batch defective serial number</a>
</div>
</div>
</div>
<div id="dlgDelpoll" class="easyui-dialog for-scan" style="width:500px;display: none;height: 110px;"
closed="true" buttons="#dlg-buttons-delpoll">
<div style="margin-bottom: -10px;margin-top: 10px;margin-left: 20px;">
通道一 <input type="radio" name="delpass" value="1" style="vertical-align:middle; margin-top:0px; margin-bottom:1px; margin-right: 9%">
通道二 <input type="radio" name="delpass" value="2" style="vertical-align:middle; margin-top:0px; margin-bottom:1px; margin-right: 9%">
通道三 <input type="radio" name="delpass" value="3" style="vertical-align:middle; margin-top:0px; margin-bottom:1px; margin-right: 9%">
</div>
</div>
<div id="dlg-buttons-delpoll" style="display: none;">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="clearPool()" style="width:90px">OK</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgDelpoll').dialog('close')" style="width:90px">Cancel</a>
</div>
<!-- 箱的列表 -->
<div id="box_pack_dlg" class="easyui-dialog" style="width: 900px; top: -80px; display: none;" closed="true" data-options="modal:true" >
<table id="box_pack_dlg_table" class="easyui-datagrid" style="width:100%;height:450px;display: none;"
data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true ,
method:'POST', pageSize:50, onSelect:onBoxPackTableRowSelect,
toolbar:'#tBoxPack'">
<thead>
<tr>
<th data-options="field:'boxNo',width:120">Box No</th>
<th data-options="field:'rollQty',width:80, editor:'textbox'">Roll Qty</th>
<th data-options="field:'status',width:80">Status</th>
<th data-options="field:'id',width:200, formatter:formatBoxPackFunction">Actions</th>
</tr>
</thead>
</table>
</div>
<div id="tBoxPack" style="padding:10px 5px;display: none;">
<div id="btn_box_excel">
<a href="javascript:void(0)" id="scan_roll_pack" data-options="disabled:false" class="easyui-linkbutton" onclick="scanRollNoModal('scanRollPack')" style="height:44px;">
<span class="glyphicon glyphicon-camera"></span>扫描卷
</a>
</div>
</div>
<!-- 扫描内包号modal -->
<div id="scan_roll_dlg" class="easyui-dialog" style="width: 600px; display: none;" closed="true" data-options="modal: true, toolbar:'#tb_roll'">
<form id="scan_roll_fm" method="post" novalidate style="margin:0; padding: 20px 20px">
<div style="margin-bottom:15px">
<label id="current_box_no" style="font-size: 14px;">箱号:</label>
</div>
<div style="margin-top: 5px; margin-bottom: 10px">
<label style="width: 15%; display: inline-block; font-size: 14px;">Roll No:</label>
<input id="scan_roll_no" name="rollNo" inputmode="none" style="width: 80%; height: 32px; font-size: 14px;">
</div>
</form>
<table id="scan_rolls_table" class="easyui-datagrid" style="width:100%;height: 450px;" data-options="modal: true, ">
<thead>
<tr>
<th data-options="field:'sortNo',width:80, formatter:formatRollSort">序号</th>
<th data-options="field:'finalRollNo',width:240,editor:'textbox'">Roll No</th>
<th data-options="field:'id',width:120, formatter:formatScanRollFunction">Actions</th>
</tr>
</thead>
</table>
</div>
<div id="tb_roll" style="padding:10px 5px;display: none;">
<div id="btn_sn">
<a href="javascript:void(0)" id="sealing_box" data-options="disabled:true" class="easyui-linkbutton" onclick="sealingBox()" style="height:44px;">
<span class="glyphicon glyphicon-folder-close" ></span>
Pack</a>
</div>
</div>
<script src="/laydate/laydate.js"></script>
<script type="text/javascript" src="/js/layer/layer.js"></script>
<script>
var slittingRollNo = "${slittingRollNo!}";
var slittingRollNo1 = "${slittingRollNo1!}";
var slittingRollNo2 = "${slittingRollNo2!}";
var slittingRollNo3 = "${slittingRollNo3!}";
var firstSn = "${firstSn!}";
var firstSn1 = "${firstSn1!}";
var firstSn2 = "${firstSn2!}";
var firstSn3 = "${firstSn3!}";
var passNo = "${passNo!}";
var temp_row;
var currentRoll = "";
var currentBox = "";
var currentReceive;
var currentReceiveNo = "";
var currentBoxNo = "";
var currentOrderNo = '${currentUser.workingOrder}';
var currentReceiveNo = '*';
var currentBadSnArray = [];
//查询订单
function findOrder(){
$.post("/rollop/findOrder", {slittingRollNo: slittingRollNo}, function (ret) {
$("#orderNo").val(ret);
})
}
function badInput(){
if (slittingRollNo == ""){
$.messager.alert("Error", "请先扫描卷号", "error");
return;
}
//$("#dgBadSnDtls").datagrid({url: "/scanning/badsn/${slittingRollNo!}/"});
//加载缓存中的不良码包数据
reloadTableBadSns();
$('#dlgBadSnDtls').dialog('open').dialog('center').dialog('setTitle','Defective serial number');
}
//加载缓存中不良数据列表 2026-06-24 LR 不良码包显示优化 只显示当前操作的数据
function reloadTableBadSns(){
var opts = $('#dgBadSnDtls').datagrid('options');
$('#dgBadSnDtls').datagrid('loadData', currentBadSnArray);
}
//单个不良自动点击确认2020-09-29 sunny要求加入
$("#inptBadSn").textbox({
inputEvents: $.extend({}, $.fn.textbox.defaults.inputEvents,{
keyup:function(event){
if(event.keyCode == 13){
addNewBadSn();
}
}
})
})
function addNewBadSn(){
var pass = $(':radio[name="badpass"]:checked').val();
if(pass==null||pass==""){
$.messager.alert('Error','请选择通道!', 'error');
return false;
}
$.post("/hsScan/${jobId}/badsn/add", {pass: pass, serialNo: $("#inptBadSn").val(), orderNo: workingOrder}, function (ret) {
if (ret.success){
//$("#dgBadSnDtls").datagrid("reload");
//2026-06-24 LR 不查询只显示缓存中的不良数据
let currentSerial = {'serialNo': $("#inptBadSn").val()};
$("#inptBadSn").textbox("clear");
$("#_easyui_textbox_input4").focus();
//添加缓存的数据
currentBadSnArray.unshift(currentSerial);
//加载缓存的数据
reloadTableBadSns();
}else{
$.messager.alert("Error", ret.errorMsg, "error");
}
})
}
function formatEnd(value, row){
if (value) {
return value;
} else {
return "<a class='easyui-linkbutton' href='javascript:scanEndSerial(\""+row.id+"\")'>Please scan the end serial number</a>"+"&nbsp;|&nbsp;<a class='easyui-linkbutton' href='javascript:createFinalRoll(\""+row.id+"\")'>Scanning&FG Rolls</a>";
}
}
function createFinalRoll(){
$("#doFinalRoll").linkbutton({"disabled": false});
$('#dlgFinalRoll').dialog('open').dialog('center').dialog('setTitle', "Create FG roll");
$('#dlgFinalRoll form').form('clear');
}
//选择通道清空扫描池
function delPoll(){
$('#dlgDelpoll').dialog('open').dialog('center').dialog('setTitle', "选择通道清空扫描池");
$('#dlgDelpoll form').form('clear');
}
function scanRoll(){
$('#dg').datagrid('reload');
$('#dlgRoll').dialog('open').dialog('center').dialog('setTitle', "Scan roll number");
$('#dlgRoll form').form('clear');
if(passNo=="1"){
$('#slittingRollNo').textbox('setValue',slittingRollNo1);
}else if(passNo=="2"){
$('#slittingRollNo').textbox('setValue',slittingRollNo2);
}else if(passNo=="3"){
$('#slittingRollNo').textbox('setValue',slittingRollNo3);
}
}
function scanFirstSn(){
$('#dlgFirstSn').dialog('open').dialog('center').dialog('setTitle', "扫描第一个序列号");
$('#dlgFirstSn form').form('clear');
$('#pass1').textbox('setValue',firstSn1);
$('#pass2').textbox('setValue',firstSn2);
$('#pass3').textbox('setValue',firstSn3);
//获取焦点
//$('#_easyui_textbox_input6').focus();
$("#firstSerialNo").textbox('textbox').focus();
}
$(window).resize(function () {
$("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20});
});
$(function () {
$("input:radio[name=pass][value="+passNo+"]").attr("checked",true);
$("input:radio[name=RollNoPass][value="+passNo+"]").attr("checked",true);
$("input:radio[name=firstpass][value="+passNo+"]").attr("checked",true);
$("input:radio[name=endpass][value="+passNo+"]").attr("checked",true);
$("input:radio[name=badpass][value="+passNo+"]").attr("checked",true);
$("input:radio[name=delpass][value="+passNo+"]").attr("checked",true);
$(window).resize();
findOrder();
});
//选择通道
function showData(){
var pass = $(':radio[name="pass"]:checked').val();
console.log(pass);
var url = "/hsScan/jobdtlByUser?passNo="+pass;
window.location.href = url;
$(window).resize();
findOrder();
}
//切换卷
function getRollData(){
var pass = $(':radio[name="RollNoPass"]:checked').val();
if(pass=="1"){
$('#slittingRollNo').textbox('setValue',slittingRollNo1);
}else if(pass=="2"){
$('#slittingRollNo').textbox('setValue',slittingRollNo2);
}else if(pass=="3"){
$('#slittingRollNo').textbox('setValue',slittingRollNo3);
}
}
//首个序列号
function getFirstSnData(){
var pass = $(':radio[name="firstpass"]:checked').val();
if(pass=="1"){
$('#firstSerialNo').textbox('setValue',firstSn1);
}else if(pass=="2"){
$('#firstSerialNo').textbox('setValue',firstSn2);
}else if(pass=="3"){
$('#firstSerialNo').textbox('setValue',firstSn3);
}
}
//创建最终卷
function doFinalRollOK(){
$("#doFinalRoll").linkbutton({"disabled": true});
$('#dlgFinalRoll form').form('submit',{
url: "/hsScan/scanpool/${jobId}/${passNo}/createFinalRollNew",
onSubmit: function(){
return $(this).form('validate');
},
success: function(result){
$("#doFinalRoll").linkbutton({"disabled": false});
console.log(result);
try{
var result = JSON.parse(result);
if (result.errorMsg){
if(result.falseFlag==1){
$.messager.confirm('Confirm','The roll qty is '+result.nowQty+',are you sure to create the new roll?',function(r) {
if (r){
doFinalRollOKReally();
}else {
}
});
}else {
$.messager.alert('Error',result.errorMsg, 'error');
}
} else {
$('#snSpan').html('<b>'+$("#nextSerialNo").val()+'</b>');
$.ajaxSettings.async = false;
if($("#nextSerialNo").val()!=''&&$("#nextSerialNo").val()!=null){
$.post("/hsScan/scanpool/${jobId}/firstSn", {firstSn: $("#nextSerialNo").val()}, function(result){
try{
if (result.errorMsg){
$.messager.alert('Error',result.errorMsg, 'error');
} else {
if(result.pass=="1"){
$('#pass1').textbox('setValue',$("#nextSerialNo").val());
}else if(result.pass=="2"){
$('#pass2').textbox('setValue',$("#nextSerialNo").val());
}else if(result.pass=="3"){
$('#pass3').textbox('setValue',$("#nextSerialNo").val());
}
$('#nextSerialNo').textbox('setValue',"");
}
}catch(e){
}
})
}
$.ajaxSettings.async = true;
console.log("ceshi");
$('#firstSn').hide();
$('#dg').datagrid('reload');
$('#dlgFinalRoll form').form('clear');
if (result.finalRoll){
//调用方法 执行缓存打印的信息 然后调用js打印数据
getQcPrintCacheData(result.finalRoll.finalRollNo, result.pass);
//$("#ifmforprint").attr('src', "/print/newlabel/" + result.finalRoll.finalRollNo + "/"+result.pass+"/");
}
// $.messager.alert('Success','请稍等刷新界面', 'info');
// setTimeout(function(){
// window.location.reload()
// },2000);
}
}catch(e){
$.messager.alert('Error','序列号重复!', 'error');
}
}
});
}
function doFinalRollOKReally(){
$("#doFinalRoll").linkbutton({"disabled": true});
$('#dlgFinalRoll form').form('submit',{
url: "/hsScan/scanpool/${jobId}/${passNo}/createFinalRoll",
onSubmit: function(){
return $(this).form('validate');
},
success: function(result){
$("#doFinalRoll").linkbutton({"disabled": false});
console.log(result);
try{
var result = JSON.parse(result);
if (result.errorMsg){
$.messager.alert('Error',result.errorMsg, 'error');
} else {
$('#snSpan').html('<b>'+$("#nextSerialNo").val()+'</b>');
$.ajaxSettings.async = false;
if($("#nextSerialNo").val()!=''&&$("#nextSerialNo").val()!=null){
$.post("/hsScan/scanpool/${jobId}/firstSn", {firstSn: $("#nextSerialNo").val()}, function(result){
try{
if (result.errorMsg){
$.messager.alert('Error',result.errorMsg, 'error');
} else {
if(result.pass=="1"){
$('#pass1').textbox('setValue',$("#nextSerialNo").val());
}else if(result.pass=="2"){
$('#pass2').textbox('setValue',$("#nextSerialNo").val());
}else if(result.pass=="3"){
$('#pass3').textbox('setValue',$("#nextSerialNo").val());
}
$('#nextSerialNo').textbox('setValue',"");
}
}catch(e){
}
})
}
$.ajaxSettings.async = true;
console.log("ceshi");
$('#firstSn').hide();
$('#dg').datagrid('reload');
$('#dlgFinalRoll form').form('clear');
if (result.finalRoll){
//调用方法 执行缓存打印的信息 然后调用js打印数据
getQcPrintCacheData(result.finalRoll.finalRollNo, result.pass);
//$("#ifmforprint").attr('src', "/print/newlabel/" + result.finalRoll.finalRollNo + "/"+result.pass+"/");
}
// $.messager.alert('Success','请稍等刷新界面', 'info');
// setTimeout(function(){
// window.location.reload()
// },2000);
}
}catch(e){
$.messager.alert('Error','序列号重复!', 'error');
}
}
});
}
//关闭创建最终卷页面
function closeFinalRoll(){
$('#dlgFinalRoll').dialog('close');
window.location.reload();
}
//扫描卷号
function doScanRollOK(){
var pass = $(':radio[name="RollNoPass"]:checked').val();
if(pass==null||pass==""){
$.messager.alert('Error','请选择通道!', 'error');
return false;
}
function doScallRollSubmit(){
$('#dlgRoll form').form('submit',{
url: "/hsScan/scanpool/${jobId}/"+pass+"/scanRoll",
onSubmit: function(){
return $(this).form('validate');
},
success: function(result){
console.log(result);
$.messager.alert('Success','扫描成功', 'info');
try{
var result = JSON.parse(result);
if (result.errorMsg){
$.messager.alert('Error',result.errorMsg, 'error');
} else {
if(pass=="1"){
slittingRollNo1 = $('#slittingRollNo').val();
}else if(pass=="2"){
slittingRollNo2 = $('#slittingRollNo').val();
}else if(pass=="3"){
slittingRollNo3 = $('#slittingRollNo').val();
}
window.location.reload();
}
}catch(e){
}
}
});
}
if(!$('#dg').datagrid('getRows')){
$.messager.alert("Error", "扫描机数据库连接失败", "error");
return false;
}
if ($('#dg').datagrid('getRows')&& $('#dg').datagrid('getRows').length > 0) {
$.messager.confirm('Confirm', 'Still have serial numbers in scanning list, continue?', function (r) {
if (r) {
doScallRollSubmit();
}else{
$("#dlgRoll").dialog('close');
}
});
}else{
doScallRollSubmit();
}
}
//关闭扫描卷号模态框
function closeScanRoll(){
$('#dlgRoll').dialog('close');
window.location.reload();
}
//扫描首个序列号回车事件
$("#firstSerialNo").textbox({
inputEvents: $.extend({}, $.fn.textbox.defaults.inputEvents,{
keyup:function(event){
if(event.keyCode == 13){
doFirstSnOK();
}
}
})
});
//扫描首个序列号
function doFirstSnOK(){
$.post("/hsScan/scanpool/${jobId}/firstSn", {firstSn: $("#firstSerialNo").val()}, function(result){
try{
if (result.errorMsg){
$.messager.alert('Error',result.errorMsg, 'error');
} else {
if(result.pass=="1"){
$('#pass1').textbox('setValue',$("#firstSerialNo").val());
}else if(result.pass=="2"){
$('#pass2').textbox('setValue',$("#firstSerialNo").val());
}else if(result.pass=="3"){
$('#pass3').textbox('setValue',$("#firstSerialNo").val());
}
$('#firstSerialNo').textbox('setValue',"");
}
}catch(e){
}
})
}
//关闭扫描首个序列号页面
function closeFirstSn(){
$('#dlgFirstSn').dialog('close');
window.location.reload();
}
//清空扫描池
function clearPool(){
var pass = $(':radio[name="delpass"]:checked').val();
if(pass==null||pass==""){
$.messager.alert('Error','请选择通道!', 'error');
return false;
}
$.messager.confirm('Confirm','Are you sure to clear current scanning list?',function(r){
if (r){
$.post('/hsScan/scanpool/${jobId}/'+pass+'/clear',{},function(result){
if (result.success){
$('#dg').datagrid('reload');
$.messager.alert('Success','清空成功', 'info');
} else {
$.messager.alert('Error',result.errorMsg, 'error');
}
},'json');
}
});
}
function getday(){
lay('.Selection_time').each(function(){
laydate.render({
elem: this
});
});
$('.Selection_time').val(getToday());
}
//获取当天日期
function getToday(){
var date = new Date();
var seperator1 = "-";
var year = date.getFullYear();
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate = year + seperator1 + month + seperator1 + strDate;
return currentdate;
}
//批量录入不良品-------------------------------------------------------------------------------------
function doBadRange(){
$("#doOK").linkbutton({"disabled": false});
showDialog("Batch defective serial number", 2, "/badBatch/count");
}
var formPostUrl;
var doUrl;
function showDialog(title, serialNum, postUrl){
var pass = $(':radio[name="badpass"]:checked').val();
//var currentRoll = "";
if(pass=="1"){
currentRoll = slittingRollNo1;
}else if(pass=="2"){
currentRoll = slittingRollNo2;
}else if(pass=="3"){
currentRoll = slittingRollNo3;
}
show2ndBox(serialNum > 1);
$('#dlg').dialog('open').dialog('center').dialog('setTitle',title);
//获取焦点
$("#badFirstSN").textbox('textbox').focus();
$('#dlg form').form('clear');
$('#dlg #orderNo_display').textbox({"value": workingOrder});
formPostUrl = "/hsScan/scanning/${jobId}" + postUrl + "?orderNo="+workingOrder;
//2020-09-08 LR 原低俗通道改为高速通道 Start
//doUrl = "/rollop/scanning/${jobId}/badBatch/do?rollNo="+currentRoll;
//2020-09-08 LR 原低俗通道改为高速通道 End
doUrl = "/hsScan/scanning/${jobId}/badBatch/do?orderNo="+workingOrder;
}
function show2ndBox(b){
showEl("#dlg #serial_input_1st", true);
showEl("#dlg #serial_input_2nd", true);
showEl("#dlg #serial_input_2nd", b);
$('#dlg #endSerialNo').textbox({disabled:!b});
}
function doOK(){
//var doUrl = "/rollop/scanning/badBatch/do?rollNo="+currentRoll;
var badFirstSN = $("#badFirstSN").val();
var badEndSN = $("#badEndSN").val();
console.log(badFirstSN);
console.log(badEndSN);
$("#doOK").linkbutton({"disabled": true});
$('#dlg form').form('submit',{
url: formPostUrl,
onSubmit: function(){
return $(this).form('validate');
},
success: function(result){
var result = $.parseJSON(result);
if (result.errorMsg){
$("#doOK").linkbutton({"disabled": false});
//$('#dlg').dialog('close');
$.messager.alert('Error',result.errorMsg, 'error');
} else {
if(result.count>1000){
$.messager.confirm('Confirm','Defective quantity greater than 1000, continue??',function(r) {
if (r){
$.post(doUrl, {firstSerialNo:badFirstSN,endSerialNo:badEndSN}, function(data){
$("#doOK").linkbutton({"disabled": false});
// refreshRollInfo(currentRoll);
if (data.success){
$('#dlg form').form('clear');
$('#dlg #orderNo_display').textbox({"value": workingOrder});
//2026-06-24 LR 显示缓存中的数据
let badSerials = data.badSerials;
for(let i = 0; i < badSerials.length; i++){
currentBadSnArray.unshift({'serialNo': badSerials[i].serialNo});
};
//加载缓存的数据
reloadTableBadSns();
//2020-09-16 添加不良录入成功提示
$.messager.alert('Success','The defect has been reported successfully, the total qty is '+result.count, 'info');
}else{
$.messager.alert('Error',data.errorMsg, 'error');
//$('#dlg').dialog('close'); // close the dialog
}
});
}else{
$("#doOK").linkbutton({"disabled": false});
$('#dlg').dialog('close');
}
});
}else{
$.post(doUrl, {firstSerialNo:badFirstSN,endSerialNo:badEndSN}, function(data){
$("#doOK").linkbutton({"disabled": false});
// refreshRollInfo(currentRoll);
if (data.success){
$('#dlg form').form('clear');
$('#dlg #orderNo_display').textbox({"value": workingOrder});
//2026-06-24 LR 显示缓存中的数据
let badSerials = data.badSerials;
for(let i = 0; i < badSerials.length; i++){
currentBadSnArray.unshift({'serialNo': badSerials[i].serialNo});
};
//加载缓存的数据
reloadTableBadSns();
//2020-09-16 添加不良录入成功提示
$.messager.alert('Success','The defect has been reported successfully, the total qty is '+result.count, 'info');
}else{
$.messager.alert('Error', data.errorMsg, 'error');
//$('#dlg').dialog('close'); // close the dialog
}
});
}
}
}
});
}
//2026-06-25 新开发的功能 LR
//入库箱管理的modal
function openBoxPackModal(){
//设置中包的参数
$('#box_pack_dlg').dialog('open').dialog('center').dialog('setTitle', '入库箱列表');
//获取最新的接收单信息
getLastedActiveReceive();
}
//包装任务单自动选择
function onBoxPackTableRowSelect(index, row){
currentBox = row;
currentReceiveNo = row.receiveNo;
currentBoxNo = currentBox.boxNo;
}
//外包的功能菜单
function formatBoxPackFunction(value, row){
let status = row.status;
let tags = '';
if('Unpacked' === status){
tags += '<a style="text-decoration:none;" onclick="scanRollNoModal(\'scanBoxRoll\')">扫描卷</a>';
}else {
tags += '<a style="text-decoration:none;" onclick="scanRollNoModal(\'viewRollList\')">卷列表</a>';
}
return tags;
}
//获取最新的可用的内包
function getLastedActiveReceive() {
let requestData = {orderNo: currentOrderNo, 'username': username };
$.ajax({
url: '/scanning/getLastedActiveReceive',
type: 'POST',
async: false,
contentType: 'application/json;charset=UTF-8',
data: JSON.stringify(requestData),
success: function(result){
if(result.success){
//设置参数 计数和内包号
currentReceive = result.row;
currentReceiveNo = currentReceive.receiveNo;
//刷新页面的数据
reloadTableReceiveBoxs(currentReceiveNo);
}else{
currentReceive = {};
currentReceiveNo = '*';
//刷新页面的数据
reloadTableReceiveBoxs(currentReceiveNo);
}
},
error: function(xhr){
$.messager.alert('Error', xhr.responseText || '请求失败', 'error');
}
});
}
//重新加载内包的数据
function reloadTableReceiveBoxs(receiveNo){
var opts = $('#box_pack_dlg_table').datagrid('options');
opts.url = "/scanning/getSoReceiveBoxesByReceiveNo";
$('#box_pack_dlg_table').datagrid('load', {
'receiveNo': receiveNo
});
}
//sn表格序号
function formatRollSort(value, row, index){
let rows = $("#scan_rolls_table").datagrid("getData").rows;
let total = rows.length;
return total - index;
}
//卷列表的功能
function formatScanRollFunction(value, row){
let status = currentBox.status;
let tags = '';
//没有封包的时候才可以删除
if('Unpacked' == status){
tags += '<a style="text-decoration:none;" onclick="cancelScanRollNo(\''+row.finalRollNo+'\')">Delete</a>';
}
return tags;
}
//扫描卷打开操作
function scanRollNoModal(entryMark){
delay(function(){
if(null == currentBoxNo || '' == currentBoxNo){
currentBoxNo = '*';
}
//如果是直接扫描进来的
if ('scanRollPack' === entryMark){
//打开扫描中包的modal
$('#scan_roll_dlg').dialog('open').dialog('center').dialog('setTitle', '扫卷装箱');
$("#current_box_no").html("箱号: "+currentBoxNo);
//获取最近可用的包
getLastedActiveBox();
$('#scan_roll_no').prop('disabled', false); // 打开输入框
//打开封箱的操作
$("#sealing_box").linkbutton({"disabled": false});
}else if ('scanBoxRoll' === entryMark){
//打开扫描中包的modal
$('#scan_roll_dlg').dialog('open').dialog('center').dialog('setTitle', '扫卷装箱');
$("#current_box_no").html("箱号: "+currentBoxNo);
//获取最近可用的包
$('#scan_roll_no').prop('disabled', false); // 禁用输入框
let packStatus = currentBox.status;
if ("Unpacked"){
$("#sealing_box").linkbutton({"disabled": false});
}else {
$("#sealing_box").linkbutton({"disabled": true});
}
//刷新页面的数据
reloadTableScanRolls(currentReceiveNo, currentBoxNo);
}else if('viewRollList' === entryMark){
$('#scan_roll_dlg').dialog('open').dialog('center').dialog('setTitle', '装箱列表');
$("#current_box_no").html("箱号: "+currentBoxNo);
//禁用输入框
$('#scan_roll_no').prop('disabled', true); // 禁用输入框
$("#sealing_box").linkbutton({"disabled": true});
//刷新页面的数据
reloadTableScanRolls(currentReceiveNo, currentBoxNo);
}else {
$('#scan_roll_dlg').dialog('open').dialog('center').dialog('setTitle', '扫卷装箱');
$("#current_box_no").html("箱号: *");
//禁用输入框
$('#scan_roll_no').prop('disabled', true); // 禁用输入框
$("#sealing_box").linkbutton({"disabled": true});
//刷新页面的数据
reloadTableScanRolls(currentReceiveNo, currentBoxNo);
}
$('#scan_roll_no').val('');
//获取焦点
$('#scan_roll_no').focus();
}, 500);
}
//扫描sn打开事件
$("#scan_roll_dlg").dialog({
onClose: function () {
reloadTableReceiveBoxs(currentReceiveNo);
},
onOpen: function(){
$('#scan_roll_no').val('');
//获取焦点
$('#scan_roll_no').focus();
}
});
//重新加载内包的数据
function reloadTableScanRolls(currentReceiveNo, boxNo){
var opts = $('#scan_rolls_table').datagrid('options');
opts.url = "/scanning/getSoReceiveBoxRollsByBoxNo";
$('#scan_rolls_table').datagrid('load', {
'receiveNo': currentReceiveNo,
'boxNo': boxNo
});
}
//获取最新的可用的内包
function getLastedActiveBox() {
let requestData = {orderNo: currentOrderNo, receiveNo: currentReceiveNo, 'username': username };
$.ajax({
url: '/scanning/getOrderLastedActiveBox',
type: 'POST',
async: false,
contentType: 'application/json;charset=UTF-8',
data: JSON.stringify(requestData),
success: function(result){
if(result.success){
//设置参数 计数和内包号
let row = result.row;
currentBox = row;
currentBoxNo = row.boxNo;
//设置中包
$("#current_box_no").html("箱号: "+currentBoxNo);
//看一下状态是否 等待开发
let packStatus = currentBox.status;
if ('Created' === packStatus){
$("#sealing_box").linkbutton({"disabled": false});
}else {
$("#sealing_box").linkbutton({"disabled": true});
}
//刷新页面的数据
reloadTableScanRolls(currentReceiveNo, currentBoxNo);
}else{
currentBox = {};
currentBoxNo = '*';
//设置中包
$("#current_box_no").html("箱号: "+currentBoxNo);
//刷新页面的数据
reloadTableScanRolls(currentReceiveNo, currentBoxNo);
}
},
error: function(xhr){
$.messager.alert('Error', xhr.responseText || '请求失败', 'error');
}
});
}
//绑定的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', '请输入卷号!', 'error', function(){
//自动获取焦点
$('#scan_roll_no').val('');
$("#scan_roll_no").focus();
});
return false;
}else{
//判断长度
scanRollNo(rollNo);
return false;
}
}
});
//开始扫描sn号
function scanRollNo(rollNo){
let postData = {'orderNo': currentOrderNo, 'receiveNo': currentReceiveNo, 'finalRollNo': rollNo, 'boxNo': currentBoxNo, "username": username};
$.ajax({
url: '/scanning/scanReceiveRollNo',
type: 'POST',
contentType: 'application/json;charset=UTF-8',
data: JSON.stringify(postData),
success: function(result){
if(result.success){
currentBox = result.row;
currentBoxNo = currentBox.boxNo;
currentBox.status = 'Unpacked';
//是否封包
if (result.sealFlag == 'Y'){
//自动封包
sealingBox();
}else {
//刷新页面的数据
reloadTableScanRolls(currentReceiveNo, currentBoxNo);
//获取焦点
$('#scan_roll_no').val('');
$("#scan_roll_no").focus();
}
}else{
$.messager.alert('error',result.msg, 'error', function(){
//自动获取焦点
$('#scan_roll_no').val('');
$("#scan_roll_no").focus();
});
}
},
error: function(xhr){
$.messager.alert('Error', xhr.responseText || '请求失败', 'error');
}
});
}
//开始扫描sn号
function cancelScanRollNo(rollNo){
delay(function(){
//获取当前的箱号
if (null == rollNo || '*' === rollNo){
$.messager.alert('error', '请选择一个卷号!', 'error', function(){
//自动获取焦点
$('#scan_roll_no').val('');
$("#scan_roll_no").focus();
});
return false;
}
let postData = {'orderNo': currentOrderNo, 'receiveNo': currentReceiveNo, 'finalRollNo': rollNo, 'boxNo': currentBoxNo, "username": username};
$.ajax({
url: '/scanning/cancelScanReceiveRollNo',
type: 'POST',
contentType: 'application/json;charset=UTF-8',
data: JSON.stringify(postData),
success: function(result){
if(result.success){
//刷新页面的数据
reloadTableScanRolls(currentReceiveNo, currentBoxNo);
}else{
$.messager.alert('error',result.msg, 'error', function(){
//自动获取焦点
$('#scan_roll_no').val('');
$("#scan_roll_no").focus();
});
}
},
error: function(xhr){
$.messager.alert('Error', xhr.responseText || '请求失败', 'error');
}
});
});
}
//自动封包
function sealingBox(){
delay(function(){
//获取当前的箱号
if (null == currentBoxNo || '*' === currentBoxNo){
$.messager.alert('error', '请选择一个箱号!', 'error', function(){
//自动获取焦点
$('#scan_roll_no').val('');
$("#scan_roll_no").focus();
});
return false;
}
let postData = {'receiveNo': currentReceiveNo, 'boxNo': currentBoxNo, "username": username};
$.ajax({
url: '/scanning/sealSoReceiveBox',
type: 'POST',
contentType: 'application/json;charset=UTF-8',
data: JSON.stringify(postData),
success: function(result){
if(result.success){
//自动打印标签 封包完成
getInnerBoxPrintCacheData(postData, function(){
//关闭modal 然后重新打开
$('#scan_roll_dlg').dialog('close');
currentBox = {};
currentBoxNo = '*';
//重新打开
scanRollNoModal('scanRollPack');
});
}else{
$.messager.alert('error',result.msg, 'error', function(){
//自动获取焦点
$('#scan_roll_no').val('');
$("#scan_roll_no").focus();
});
}
},
error: function(xhr){
$.messager.alert('Error', xhr.responseText || '请求失败', 'error');
}
});
});
}
var delay = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout (timer);
timer = setTimeout(callback, ms);
};
})();
</script>
</#if>
</@master.layout>