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.
 
 
 
 
 

406 lines
18 KiB

<#import "../master.ftl" as master>
<@master.layout>
<style>
#fm label {
width: 150px;
}
</style>
<div class="page-header">
<h3>Import of Rework Order</h3>
</div>
<table id="dg" class="easyui-datagrid" style="width:100%;height:460px;display: none;"
data-options="pagination: true, showFooter: true, singleSelect:true, fitColumns:true , onSelect:onTableRowSelect, onLoadSuccess:onTableRowSelect, url:'/prepress/reworkAll',method:'get',pageSize:20,toolbar:'#tb'">
<thead>
<tr>
<th data-options="field:'orderNo',width:100,editor:'textbox'">Order No</th>
<th data-options="field:'partNo',width:100,editor:'textbox'">Part No</th>
<th data-options="field:'partDesc',width:200,editor:'textbox'">Part Description</th>
<th data-options="field:'apn',width:80">APN</th>
<th data-options="field:'customerPartNo',width:80">Customer Part No</th>
<th data-options="field:'project',width:80">Project</th>
<th data-options="field:'revNo',width:50">Rev No</th>
<th data-options="field:'lotSize',width:100,editor:'textbox'">Lot Size</th>
<th data-options="field:'inputLotSize',width:100,editor:'textbox'">Input Lot Size</th>
<th data-options="field:'serialsDate',width:150,align:'left',formatter:formatDate">Serials Date</th>
<th data-options="field:'needDate',width:120,formatter:formatDate">Earliest Start Date</th>
<th data-options="field:'noOfCross',width:100">No of Cross</th>
<th data-options="field:'standardRollQty',width:100,editor:'textbox'">Std. Roll Qty</th>
<th data-options="field:'createdBy',width:80,align:'left'">Created By</th>
<th data-options="field:'createdDate',width:150,align:'center',formatter:formatDateTime">Created Date</th>
<th data-options="field:'status',width:100,editor:'textbox'">Status</th>
<th data-options="field:'id', width:100,formatter:formatDownload">Actions</th>
<#-- <th data-options="field:'serialsGenBy',width:150,align:'left',editor:'textbox'">Serials Generated By</th>-->
<#-- <th data-options="field:'serialsGenDate',width:150,align:'center',editor:'textbox',formatter:formatDateTime">Serials Generated Date</th>-->
</tr>
</thead>
</table>
<div id="tb" style="padding:10px 5px;display: none;">
<div>
Order No: <input class="easyui-textbox" id="orderNo" style="width:110px">
Created 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">Search</a>
&nbsp;&nbsp;&nbsp;
<a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newSoInfo()">New</a>
<a href="javascript:void(0)" id="tbEdit" data-options="disabled:true" class="easyui-linkbutton" iconCls="icon-edit" onclick="editSoInfo()">Modify</a>
<a href="javascript:void(0)" id="tbRemove" data-options="disabled:true" class="easyui-linkbutton" iconCls="icon-remove" onclick="removeSoInfo()">Delete</a>
</div>
</div>
<div id="dlg" class="easyui-dialog" style="width:750px;display: none;"
closed="true" buttons="#dlg-buttons">
<form id="fm" method="post" novalidate style="margin:0;padding:20px 20px">
<div style="margin-bottom:10px">
<input id="dlgOrderNo" name="orderNo" class="easyui-textbox" required="true" data-options="buttonText: 'IFS',onClickButton:getIfsOrderNew" label="Order No:" style="width:100%">
</div>
<div style="margin-bottom:10px">
<input name="partNo" class="easyui-textbox" readonly required="true" label="Part No:" style="width:100%">
</div>
<div style="margin-bottom:10px">
<input name="partDesc" class="easyui-textbox" readonly required="true" label="Part Description:" style="width:100%">
</div>
<div style="margin-bottom:10px">
<input name="apn" class="easyui-textbox" readonly required="true" label="APN:" style="width:100%">
</div>
<div style="margin-bottom:10px">
<input name="customerPartNo" class="easyui-textbox" readonly required="true" label="Customer Part No:" style="width:100%">
</div>
<div style="margin-bottom:10px">
<input name="project" class="easyui-textbox" readonly required="true" label="Project:" style="width:100%">
</div>
<div style="margin-bottom:10px">
<input name="revNo" id="revNo" class="easyui-textbox" readonly required="true" label="Rev No:" style="width:100%">
</div>
<div style="margin-bottom:10px">
<input name="lotSize" class="easyui-numberbox" readonly required="true" label="Lot Size:" style="width:100%">
</div>
<div style="margin-bottom:10px">
<input name="inputLotSize" class="easyui-numberbox" validtype="valueRange[1,1336335]" required="true" label="Input Lot Size:" style="width:100%">
</div>
<div style="margin-bottom:10px">
<input name="serialsDate" class="easyui-datebox" validtype="validDate" required="true" data-options="parser:myparser" label="Serials Date:" style="width:100%">
</div>
<div style="margin-bottom:10px">
<input name="needDate" class="easyui-datebox" validtype="validDate" required="true" label="Earliest Start Date:" style="width:100%">
</div>
<div style="margin-bottom:10px">
<input name="noOfCross" class="easyui-numberbox" readonly required="true" label="No of Cross:" style="width:100%">
</div>
<div style="margin-bottom:10px">
<input name="standardRollQty" class="easyui-numberbox" readonly required="true" label="Standard Roll Qty:" style="width:100%">
</div>
</form>
</div>
<div id="dlg-buttons" style="display: none;">
<a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="saveSoInfo()" style="width:90px">Save</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="dlgDtls" class="easyui-dialog" style="width:600px;display: none;"
closed="true" data-options="modal:true" >
<table id="dgDtls" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get', pageSize:20">
<thead>
<tr>
<th data-options="field:'rollNo',width:100">Roll No</th>
<th data-options="field:'createdBy',width:80">Created By</th>
<th data-options="field:'createdDate',width:150,align:'center',formatter:formatDateTime">Created Time</th>
<th data-options="field:'status',width:80">Status</th>
<th data-options="field:'id', width:150,formatter:formatRollAction"></th>
</tr>
</thead>
</table>
</div>
<div id="dlgRollDtls" class="easyui-dialog" style="width:500px;display: none;"
closed="true" data-options="modal:true,toolbar:'#dlgRollDtlstb'" >
<table id="dgRollDtls" class="easyui-datagrid" style="width:100%;height:400px;display: none;"
data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get'">
<thead>
<tr>
<th data-options="field:'finalRollNo',width:100">FG roll number</th>
<th data-options="field:'qty',width:100">Quantity</th>
<th data-options="field:'reworkFlag',width:100">Rework Flag</th>
<#-- <th data-options="field:'id',width:40,formatter:formatBoxRollAction">Actions</th>-->
</tr>
</thead>
</table>
</div>
<div id="dlgRollDtlstb" style="padding:10px 5px;display: none;">
<div>
扫卷返工:&nbsp;&nbsp;&nbsp;<input id="finalRollNo" name="finalRollNo" class="easyui-textbox" style="width: 120px;text-transform:uppercase;" placeholder="FG roll number" />
&nbsp;&nbsp;&nbsp;
<#-- <a href="javascript:void(0)" id="boxingButton" class="easyui-linkbutton" onclick="doBoxing(nowBoxNo)">Pack</a>-->
</div>
</div>
<script>
var nowOrderNo='';
$(window).resize(function () {
$("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20});
});
$(function () {
$(window).resize();
});
function onPartDescChange(n,o){
//var p = /Label,([0-9A-Za-z\-]+)-(\S{1})/.exec(n);
var p = n.split(',');
if (p && p.length >= 3){
$("#revNo").textbox("setValue", p[2]);
}
}
$.extend($.fn.validatebox.defaults.rules, {
notRequired: function(value){
return true;
},
validDate: {
validator: function(value){
var date = $.fn.datebox.defaults.parser(value);
var s = $.fn.datebox.defaults.formatter(date);
return s==value;
},
message: 'Please enter a valid date.'
},
valueRange: {
validator: function(value,param){
return value >= param[0] && value <= param[1];
},
message: 'Field do not match.'
}
});
function myparser(s){
if(s) return new Date(s);
}
function onTableRowSelect(index, row) {
var noRowSelect = !!!row;
var generated = row && row.serialsGenDate;
$("#tbEdit").linkbutton({"disabled": noRowSelect || generated});
$("#tbRemove").linkbutton({"disabled": noRowSelect || generated});
$("#tbSnGen").linkbutton({"disabled": noRowSelect || generated});
$("#tbSnRemove").linkbutton({"disabled": noRowSelect || !generated});
}
$("#queryLink").click(function(){
var dg = $('#dg').datagrid({
queryParams: {
orderNo: $("#orderNo").val(),
createdDateFrom: $("#createdDateFrom").val(),
createdDateTo: $("#createdDateTo").val()
}
});
});
function formatRollAction(value, row){
return "<a href='/qrcode/"+row.rollNo+"/' target='_blank'>2D Barcode</a>";
}
function viewRolls(orderNo){
$('#dlgDtls').dialog('open').dialog('center').dialog('setTitle',orderNo+' SFG roll');
$("#dgDtls").datagrid({url: "/prepress/orderrolls/"+orderNo});
}
var url;
function newSoInfo(){
$('#dlg').dialog('open').dialog('center').dialog('setTitle','New Order Info');
$('#fm').form('clear');
url = '/prepress/soinfo/addrework';
}
function editSoInfo(){
var row = $('#dg').datagrid('getSelected');
if (row){
$('#dlg').dialog('open').dialog('center').dialog('setTitle','Edit Order Info');
$('#fm').form('load',row);
url = '/prepress/soinfo/'+row.id+'/update';
}else{
$.messager.alert('Warning','Please select a row.', 'warning');
}
}
var delay = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout (timer);
timer = setTimeout(callback, ms);
};
})();
function saveSoInfo(){
delay(function(){
$('#fm').form('submit',{
url: url,
onSubmit: function(){
return $(this).form('validate');
},
success: function(result){
var result = eval("("+result+")");
if (result.errorMsg){
$.messager.alert('error',result.errorMsg, 'error');
} else {
$('#dlg').dialog('close'); // close the dialog
$('#dg').datagrid('reload'); // reload the user data
}
}
});
}, 500);
}
function removeSoInfo(){
var row = $('#dg').datagrid('getSelected');
if (row){
$.messager.confirm('Confirm','Delete the selected order <b>'+row.orderNo+'</b> ?',function(r){
if (r){
$.post('/prepress/soinfo/'+row.id+'/delete',{},function(result){
if (result.success){
$('#dg').datagrid('reload'); // reload the user data
} else {
$.messager.alert('error',result.errorMsg, 'error');
}
},'json');
}
});
}else{
$.messager.alert('Warning','Please select a row.', 'warning');
}
}
function downloadTrace(orderNo){
$.post("/prepress/downloadTrace", {orderNo: orderNo}, function(ret){
console.log(ret);
if(ret.success){
window.location.href="/prepress/downloadFileZip/"+ret.fileName;
}else{
$.messager.alert('Error',ret.errorMsg, 'error');
}
});
}
function setByInputName(inpt, value){
var $inpt = $("#dlg input[textboxname="+inpt+"]");
$inpt.textbox({"value": value});
}
function getIfsOrder(){
var orderNo = $("#dlgOrderNo").val();
if (orderNo != ""){
$.post("/prepress/ifsOrder", {orderNo: orderNo}, function (data) {
console.log(data);
if(data.success){
var apn = data.ifsOrder.apn;
/* if (apn.length == 9) {
apn = "1P" + apn;
} else if (apn.length == 10) {
apn = "1" + apn;
} */
setByInputName("partNo", data.ifsOrder.part_no);
setByInputName("partDesc", data.ifsOrder.part_description);
setByInputName("apn", apn);
setByInputName("customerPartNo", data.ifsOrder.customer_pn);
setByInputName("project", data.ifsOrder.project_flag);
setByInputName("lotSize", data.ifsOrder.lotsize);
setByInputName("inputLotSize", accMul(data.ifsOrder.lotsize,1));
setByInputName("standardRollQty", data.ifsOrder.qty_per_roll);
setByInputName("noOfCross", data.ifsOrder.cross_number);
setByInputName("needDate", formatDate(data.ifsOrder.need_date));
setByInputName("serialsDate", formatDate(data.ifsOrder.need_date));
//onPartDescChange(data.ifsOrder.part_description, 1);
}
})
}
}
function accMul(num1,num2){
var m=0,s1=num1.toString(),s2=num2.toString();
try{m+=s1.split(".")[1].length}catch(e){};
try{m+=s2.split(".")[1].length}catch(e){};
return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m);
}
function formatDownload(value,row){
var a = "<a href='javascript:viewRolls(\""+row.orderNo+"\")'>Roll detail</a>";
return a;
}
function viewRolls(orderNo){
$('#finalRollNo').textbox("setValue","");
nowOrderNo=orderNo;
$('#dlgRollDtls').dialog('open').dialog('center').dialog('setTitle',orderNo+' SFG roll');
$("#dgRollDtls").datagrid({url: "/rewind/getRewindOrderList/"+orderNo});
$('#finalRollNo').textbox('textbox').focus();
}
$("#finalRollNo").textbox({
inputEvents: $.extend({}, $.fn.textbox.defaults.inputEvents,{
keyup:function(event){
if(event.keyCode == 13){
let finalRollNo=$("#finalRollNo").val();
$.post("/rewind/scanReworkRoll", {orderNo: nowOrderNo, finalRollNo: finalRollNo} , function(data){
if (data.success){
$("#dgRollDtls").datagrid({url: "/rewind/getRewindOrderList/"+nowOrderNo});
// $.messager.alert("Info","Received","Info",);
$("#ifmforprint").attr('src', "/print/newlabel/"+data.obj+"/0/");
$("#finalRollNo").textbox('setValue',"").focus();
}else{
$.messager.alert('Error',data.errorMsg, 'error');
$("#finalRollNo").textbox('setValue',"").focus();
}
});
}
}
})
})
function getIfsOrderNew(){
var orderNo = $("#dlgOrderNo").val();
if (orderNo != ""){
$.post("/prepress/ifsOrder", {orderNo: orderNo}, function (data) {
console.log(data);
if(data.success){
var apn = data.ifsOrder.apn;
if (apn.length == 11) {
//正常行为
}else {
//不正常的
$.messager.alert('Error', 'Length of apn does not comply with the rules!', 'error');
return false;
}
setByInputName("partNo", data.ifsOrder.partNo);
setByInputName("partDesc", data.ifsOrder.partDesc);
setByInputName("apn", apn);
setByInputName("revNo", data.ifsOrder.revNo);
setByInputName("customerPartNo", data.ifsOrder.customerPartNo);
setByInputName("project", data.ifsOrder.projectCode);
setByInputName("lotSize", data.ifsOrder.lotsize);
setByInputName("inputLotSize", accMul(data.ifsOrder.lotsize,1.20));
setByInputName("standardRollQty", data.ifsOrder.standardRollQty);
setByInputName("noOfCross", data.ifsOrder.noOfCross);
setByInputName("needDate", formatDate(data.ifsOrder.need_date));
setByInputName("serialsDate", formatDate(data.ifsOrder.need_date));
//onPartDescChange(data.ifsOrder.part_description, 1);
}else{
$.messager.alert('Error', data.msg, 'error');
}
})
}
}
</script>
</@master.layout>