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.
 
 
 
 
 

649 lines
28 KiB

<#import "../master.ftl" as master>
<@master.layout>
<style>
#fm label {
width: 152px;
}
</style>
<#if errorMsg??>
<div class="page-header">
<h3>${errorMsg}</h3>
</div>
<#else>
<div class="page-header">
<h3>Job [${jobId!}]</h3>
</div>
<p>
卷: [${slittingRollNo!}]
</p>
<p>
第一个序列号: [<span id="snSpan">${firstSn!}</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:'/scanning/scanpool/${jobId}/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>
&nbsp;&nbsp;&nbsp;
<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="clearPool()">Clear scanning list</a>
</#if>
<#-- <a href="javascript:void(0)" id="knotOrder" class="easyui-linkbutton" iconCls="icon-add" onclick="doKnot()">结单报工</a>-->
<#--<a href="/scanning/scanpool/get/${jobId}" class="easyui-linkbutton" target="_blank" >扫描任务池</a>-->
<#--<a href="/scanning/finalrolls" class="easyui-linkbutton" target="_blank" >查看最终卷</a>-->
</div>
</div>
<div id="dlgRoll" class="easyui-dialog for-scan" style="width:500px;display: none;"
closed="true" buttons="#dlg-buttons-roll">
<form id="fmRoll" method="post" novalidate style="margin:0;padding:20px 20px">
<div style="margin-bottom:10px">
<label name="slittingRollNo" class="easyui-textbox" data-options="labelWidth:100" required="true" label="Roll No:" style="width:100%">
</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="javascript:$('#dlgRoll').dialog('close')" style="width:90px">Cancel</a>
</div>
<div id="dlgFirstSn" class="easyui-dialog for-scan" style="width:500px;display: none;"
closed="true" buttons="#dlg-buttons-firstsn">
<form id="fmFirstSn" method="post" novalidate style="margin:0;padding:20px 20px">
<div style="margin-bottom:10px">
<input id="firstSerialNo" name="firstSn" class="easyui-textbox" required="true" data-options="labelWidth:100" label="The first serial number:" style="width:100%">
</div>
</form>
</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="javascript:$('#dlgFirstSn').dialog('close')" style="width:90px">Cancel</a>
</div>
<div id="dlgFinalRoll" class="easyui-dialog for-scan" style="width:500px;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">-->
<#--<label name="firstSerialNo" class="easyui-textbox" data-options="labelWidth:100" required="true" label="初始序列号:" style="width:100%">-->
<#--</div>-->
<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="javascript:$('#dlgFinalRoll').dialog('close')" style="width:90px">Cancel</a>
</div>
<div id="dlgBadSnDtls" class="easyui-dialog" style="width:600px;display: none;"
closed="true" data-options="modal:true" >
<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="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="rollNo_display" class="easyui-textbox" data-options="labelWidth:100,disabled:true" required="true" label="Roll No:" style="width:100%">
</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="badOK" 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 class="modal fade" id="report_modal" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" style="font-size:10px;">
<div class="modal-dialog" style="width:430px;height:300px;">
<div class="modal-content" >
<div class="modal-body">
<form id="report_form" class="form-horizontal" action="" method="post">
<fieldset>
<div id="legend" class="">
<input type="hidden" value="0" name="currentScheduleId" id="current_schedule_id">
<legend class="">报告产量</legend>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" style = "width: 20%;">机台</label>
<div class="col-sm-4" style = "width: 30%;">
<select id="report_resource_id" class="form-control" name="resourceId" style="width:100px;font-size:12px;">
</select>
</div>
<label class="col-sm-2 control-label" style = "width: 20%;">人员</label>
<div class="col-sm-4" style = "width: 20%;">
<input id="report_person" type="text" class="form-control" name="person" readonly style="width:100px;font-size:12px;">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" style = "width: 20%;"><span>Production Date</span></label>
<div class="col-sm-4" style = "width: 30%;">
<input id="produce_date" type="text" class="form-control Selection_time" name="produceDate" style="width:100px;font-size:12px;">
</div>
<label class="col-sm-2 control-label" style = "width: 20%;">班次</label>
<div class="col-sm-4" style = "width: 20%;">
<select id="report_shift_no" class="form-control" name="shiftNo" style="width:100px;font-size:12px;">
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" style = "width: 20%;">派工数量</label>
<div class="col-sm-4" style = "width: 30%;">
<input id="qty_required" class="form-control" name="qtyRequired" readonly style="width:100px;font-size:12px;">
</div>
<label class="col-sm-2 control-label" style = "width: 20%;">已报告数量</label>
<div class="col-sm-4" style = "width: 20%;">
<input id="qty_reported" type="number" class="form-control" name="qtyReported" readonly style="width:100px;font-size:12px;">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" style = "width: 20%;">良品数量</label>
<div class="col-sm-4" style = "width: 30%;">
<input id="qty_approved" type="number" class="form-control count_nums" name="qtyApproved" readonly style="width:100px;font-size:12px;">
</div>
<label class="col-sm-2 control-label" style = "width: 20%;">不良品数量</label>
<div class="col-sm-4" style = "width: 20%;">
<input id="qty_scrapped" type="number" class="form-control count_nums" name="qtyScrapped" readonly style="width:100px;font-size:12px;">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" style = "width: 20%;">报告总数量</label>
<div class="col-sm-4" style = "width: 30%;">
<input id="current_report_qty" type="number" class="form-control" name="currentReportTotalQty" readonly style="width:100px;font-size:12px;">
</div>
<label class="col-sm-2 control-label" style = "width: 20%;">生产时间</label>
<div class="col-sm-4" style = "width: 20%;">
<input id="produce_time" type="number" class="form-control count_nums" name="produceTime" style="width:100px;font-size:12px;">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">关闭派工单</label>
<div class="col-sm-9" id="close_schedule_flag">
<div class="checkbox checkbox-info checkbox-circle" style="margin-left: 20px;">
<input name="closed" value="0" type="checkbox" checked="" style="margin-top: -0.5px;">
<label for="checkbox1">是</label>
</div>
<div class="checkbox checkbox-info checkbox-circle" style="margin-top: -27px; margin-left: 100px;">
<input name="closed" value="1" type="checkbox" style="margin-top: -0.5px;">
<label for="checkbox2">否</label>
</div>
</div>
</div>
</fieldset>
</form>
</div>
<div class="modal-footer" style="TEXT-ALIGN: center;margin-top:-20px;">
<div class="control-group">
<!-- Button -->
<div class="controls">
<button onclick="reportSchedule()" class="btn btn-success" style="font-size:12px;">Confirm</button>
<button id="report_cancel" data-dismiss="modal" class="btn btn-success" style="font-size:12px;">取消</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="/laydate/laydate.js"></script>
<script type="text/javascript" src="/js/layer/layer.js"></script>
<script>
var slittingRollNo = "${slittingRollNo!}";
var work_center_data;
var temp_row;
var currentBadSnArray = [];
//查询订单
function findOrder(){
$.post("/rollop/findOrder", {slittingRollNo: slittingRollNo}, function (ret) {
console.log(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');
$("#_easyui_textbox_input4").focus();
}
//加载缓存中不良数据列表 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(){
$.post("/scanning/${jobId}/badsn/add", {orderNo: workingOrder, serialNo: $("#inptBadSn").val()}, 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 scanRoll(){
$('#dg').datagrid('reload');
$('#dlgRoll').dialog('open').dialog('center').dialog('setTitle', "Scan roll number");
$('#dlgRoll form').form('clear');
}
function scanFirstSn(){
$('#dlgFirstSn').dialog('open').dialog('center').dialog('setTitle', "扫描第一个序列号");
$('#dlgFirstSn form').form('clear');
}
$(window).resize(function () {
$("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20});
});
$(function () {
$(window).resize();
findOrder();
});
function doFinalRollOK(){
$("#doFinalRoll").linkbutton({"disabled": true});
$('#dlgFinalRoll form').form('submit',{
url: "/scanning/scanpool/${jobId}/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){
doFinalRollOKReal();
}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("/scanning/scanpool/${jobId}/firstSn", {firstSn: $("#nextSerialNo").val()}, function(result){
try{
if (result.errorMsg){
$.messager.alert('Error',result.errorMsg, 'error');
} else {
$('#nextSerialNo').textbox('setValue',"");
}
}catch(e){
}
})
}
$.ajaxSettings.async = true;
$('#dlgFinalRoll').dialog('close'); // close the dialog
$('#dg').datagrid('reload');
if (result.finalRoll){
//调用方法 执行缓存打印的信息 然后调用js打印数据
getQcPrintCacheData(result.finalRoll.finalRollNo, 0);
//$("#ifmforprint").attr('src', "/print/newlabel/" + result.finalRoll.finalRollNo + "/0/");
//关闭后 再次打开modal的页面
createFinalRoll();
}
// $.messager.alert('Success','请稍等刷新界面', 'info');
// setTimeout(function(){
// window.location.reload()
// },2000);
}
}catch(e){
$.messager.alert('Error','序列号重复!', 'error');
}
}
});
}
function doFinalRollOKReal(){
$("#doFinalRoll").linkbutton({"disabled": true});
$('#dlgFinalRoll form').form('submit',{
url: "/scanning/scanpool/${jobId}/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("/scanning/scanpool/${jobId}/firstSn", {firstSn: $("#nextSerialNo").val()}, function(result){
try{
if (result.errorMsg){
$.messager.alert('Error',result.errorMsg, 'error');
} else {
$('#nextSerialNo').textbox('setValue',"");
}
}catch(e){
}
})
}
$.ajaxSettings.async = true;
$('#dlgFinalRoll').dialog('close'); // close the dialog
$('#dg').datagrid('reload');
if (result.finalRoll){
//调用方法 执行缓存打印的信息 然后调用js打印数据
getQcPrintCacheData(result.finalRoll.finalRollNo, 0);
//关闭后 再次打开modal的页面
createFinalRoll();
//$("#ifmforprint").attr('src', "/print/newlabel/" + result.finalRoll.finalRollNo + "/0/");
}
// $.messager.alert('Success','请稍等刷新界面', 'info');
// setTimeout(function(){
// window.location.reload()
// },2000);
}
}catch(e){
$.messager.alert('Error','序列号重复!', 'error');
}
}
});
}
function doScanRollOK(){
function doScallRollSubmit(){
$('#dlgRoll form').form('submit',{
url: "/scanning/scanpool/${jobId}/scanRoll",
onSubmit: function(){
return $(this).form('validate');
},
success: function(result){
console.log(result);
try{
var result = JSON.parse(result);
if (result.errorMsg){
$.messager.alert('Error',result.errorMsg, 'error');
} else {
window.location.reload();
}
}catch(e){
}
}
});
}
if(!$('#dg').datagrid('getRows')){
$.messager.alert("Error", "扫描机数据库连接失败", "error");
return false;
}
if ($('#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 doFirstSnOK(){
$('#dlgFirstSn form').form('submit',{
url: "/scanning/scanpool/${jobId}/firstSn",
onSubmit: function(){
return $(this).form('validate');
},
success: function(result){
console.log(result);
try{
var result = JSON.parse(result);
if (result.errorMsg){
$.messager.alert('Error',result.errorMsg, 'error');
} else {
window.location.reload();
}
}catch(e){
}
}
});
}
function clearPool(){
$.messager.confirm('Confirm','Are you sure to clear current scanning list?',function(r){
if (r){
$.post('/scanning/scanpool/${jobId}/clear',{},function(result){
if (result.success){
$('#dg').datagrid('reload');
$.messager.alert('Success','清空成功', 'info');
} else {
$.messager.alert('Error',result.errorMsg, 'error');
}
},'json');
}
});
}
//批量录入不良
function doBadRange(){
showDialog("Batch defective serial number", 2, "/badBatch/count");
}
var formPostUrl;
var doUrl;
function showDialog(title, serialNum, postUrl){
$("#badOK").linkbutton({"disabled": false});
show2ndBox(serialNum > 1);
$('#dlg').dialog('open').dialog('center').dialog('setTitle',title);
$('#dlg form').form('clear');
formPostUrl = "/scanning/${jobId}" + postUrl + "?orderNo="+workingOrder;
doUrl = "/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 badFirstSN = $("#badFirstSN").val();
var badEndSN = $("#badEndSN").val();
console.log(badFirstSN);
console.log(badEndSN);
$("#badOK").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){
$("#badOK").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, username: username}, function(data){
$("#badOK").linkbutton({"disabled": false});
// refreshRollInfo(slittingRollNo);
if (data.success){
$('#dlg form').form('clear');
//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');
// $('#dlg #rollNo_display').textbox({"value": slittingRollNo});
}else{
$('#dlg').dialog('close'); // close the dialog
}
});
}else{
$("#badOK").linkbutton({"disabled": false});
$.messager.alert('Error',result.errorMsg, 'error');
$('#dlg').dialog('close');
}
});
}else{
$.post(doUrl, {firstSerialNo:badFirstSN,endSerialNo:badEndSN, username: username}, function(data){
$("#badOK").linkbutton({"disabled": false});
// refreshRollInfo(slittingRollNo);
if (data.success){
$('#dlg form').form('clear');
//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');
// $('#dlg #rollNo_display').textbox({"value": slittingRollNo});data.errorMsg,
}else{
$.messager.alert('Error',data.errorMsg, 'error');
//$('#dlg').dialog('close');
// close the dialog
}
});
}
}
}
});
}
//获取当天日期
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;
}
</script>
</#if>
</@master.layout>