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.
464 lines
20 KiB
464 lines
20 KiB
<#import "../master.ftl" as master>
|
|
<@master.layout>
|
|
<style>
|
|
#fm label {
|
|
width: 150px;
|
|
}
|
|
</style>
|
|
|
|
<div class="page-header">
|
|
<h3>Import Shop Order</h3>
|
|
</div>
|
|
|
|
<table id="dg" class="easyui-datagrid" style="width:100%;height:460px;display: none;"
|
|
data-options="pagination: true, showFooter: true, singleSelect:true,
|
|
onSelect:onTableRowSelect, onLoadSuccess:onTableRowSelect, url:'/prepress/all',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:160">Customer Part No</th>
|
|
<th data-options="field:'project',width:80">Project</th>
|
|
<th data-options="field:'revNo',width:80">Rev No</th>
|
|
<th data-options="field:'lotSize',width:100,editor:'textbox'">Lot Size</th>
|
|
<th data-options="field:'inputLotSize',width:140,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:160,formatter:formatStringTime">Earliest Start Date</th>
|
|
<th data-options="field:'noOfCross',width:120">No of Cross</th>
|
|
<th data-options="field:'standardRollQty',width:120,editor:'textbox'">Std. Roll Qty</th>
|
|
<th data-options="field:'createdBy',width:100,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:'serialsGenBy',width:180,align:'left',editor:'textbox'">Serials Generated By</th>
|
|
<th data-options="field:'serialsGenDate',width:180,align:'center',editor:'textbox',formatter:formatDateTime">Serials Generated Date</th>
|
|
<th data-options="field:'id', width:230,formatter:formatOrderAction">Actions</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>
|
|
|
|
<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>
|
|
|
|
<a href="javascript:void(0)" id="tbSnGen" data-options="disabled:true" class="easyui-linkbutton" iconCls="icon-add" onclick="genSerials()">Generate Serials</a>
|
|
<#if currentUser.isAdmin || currentUser.authorities?contains("delete-serials")>
|
|
<a href="javascript:void(0)" id="tbSnRemove" data-options="disabled:true" class="easyui-linkbutton" iconCls="icon-remove" onclick="removeSerials()">Delete Serials</a>
|
|
</#if>
|
|
<a href="javascript:void(0)" id="tbSnRefresh" data-options="disabled:true" class="easyui-linkbutton" iconCls="icon-remove" onclick="refreshSerials()">Refresh Serials</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; display: none;">
|
|
<input name="createdBy" class="easyui-textbox" label="Created By:" style="width:100%">
|
|
<input name="updatedBy" class="easyui-textbox" label="updated By:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="dlgOrderNo" name="orderNo" class="easyui-textbox" required="true" data-options="buttonText: 'IFS',onClickButton:getIfsOrder" 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" id="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" id = "input_lot_size" 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" required="true" readonly 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>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
//公共参数LR 添加
|
|
var site = '${currentUser.site}'
|
|
var username = '${currentUser.username}';
|
|
|
|
$(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){
|
|
//判断长度是否符合规则
|
|
if(p[2].length != 1){
|
|
return false;
|
|
}
|
|
$("#revNo").textbox("setValue", p[2]);
|
|
}else{
|
|
//$.messager.alert('error', 'revNo不符合规则', 'error');
|
|
return false;
|
|
}
|
|
}
|
|
|
|
$.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});
|
|
$("#tbSnRefresh").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()
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
//格式化工单的功能 LR 2024-06-19
|
|
function formatOrderAction(value, row){
|
|
//关闭开放再打开功能
|
|
let funTags = '';
|
|
let status = row.status;
|
|
if('Generated' == status){
|
|
funTags += '<a style="text-decoration:none;" href="/export/soOrder/downloadSingleFileZip?orderNo='+row.orderNo+'">Singe Cross</a>';
|
|
funTags += ' | <a style="text-decoration:none;" href="/export/soOrder/downloadMultiFileZip?orderNo='+row.orderNo+'">Multiple Cross</a>';
|
|
return funTags;
|
|
|
|
}
|
|
}
|
|
|
|
function formatDownload(value,row){
|
|
if(row.serialsGenDate){
|
|
var a = "<a href='/prepress/downloadFileZip/"+row.orderNo+"'>Download</a>";
|
|
a = a + " | <a href='/prepress/downloadFileZipMulit/"+row.orderNo+"'>MulitDownload</a>";
|
|
// a = a + " | <a href='javascript:downloadTrace(\""+row.orderNo+"\")'>Trace</a>";
|
|
return a;
|
|
}
|
|
return "";
|
|
}
|
|
|
|
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');
|
|
//设置创建人
|
|
setByInputName("createdBy", username);
|
|
setByInputName("updatedBy", username);
|
|
url = '/prepress/soinfo/addSoInfo';
|
|
}
|
|
|
|
function editSoInfo(){
|
|
var row = $('#dg').datagrid('getSelected');
|
|
if (row){
|
|
$('#dlg').dialog('open').dialog('center').dialog('setTitle','Edit Order Info');
|
|
//设置创建人设置修改人
|
|
$('#fm').form('load',row);
|
|
setByInputName("createdBy", username);
|
|
setByInputName("updatedBy", username);
|
|
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(){
|
|
//获取字符串 判断是否符合规则
|
|
let revNo = $("#revNo").textbox("getValue");
|
|
if(revNo.length != 1){
|
|
$.messager.alert('error', 'RevNo does not comply with the rules!', 'error');
|
|
return false;
|
|
}
|
|
let apn = $("#apn").textbox("getValue");
|
|
if(apn.length != 11){
|
|
$.messager.alert('error', 'Apn does not comply with the rules!', 'error');
|
|
return false;
|
|
}
|
|
//判断是否数量大于5000
|
|
let lotSize = $('#input_lot_size').val();
|
|
if(lotSize < 5000){
|
|
$.messager.confirm('continue', 'Serial number is less than 5000, continue!', function (status) {
|
|
if (status) {
|
|
saveSoInfoData();
|
|
}
|
|
});
|
|
}else{
|
|
saveSoInfoData();
|
|
}
|
|
}
|
|
|
|
//保存工单的信息(新增和修改)
|
|
function saveSoInfoData(){
|
|
$('#fm').form('submit',{
|
|
url: url,
|
|
onSubmit: function(){
|
|
return $(this).form('validate');
|
|
},
|
|
success: function(result){
|
|
var result = eval("("+result+")");
|
|
if (!result.success){
|
|
$.messager.alert('error',result.msg, 'error');
|
|
} else {
|
|
$('#dlg').dialog('close'); // close the dialog
|
|
$('#dg').datagrid('reload'); // reload the user data
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
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 genSerials(){
|
|
var row = $('#dg').datagrid('getSelected');
|
|
if (row){
|
|
$.messager.confirm('Confirm','Generate serial numbers for selected order <b>'+row.orderNo+'</b> ?',function(r){
|
|
if (r){
|
|
$.post('/prepress/soinfo/'+row.id+'/genSerials',{},function(result){
|
|
if (result.success){
|
|
$('#dg').datagrid('reload');
|
|
$.messager.alert('Success','Serial numbers generated successfully', 'info');
|
|
} else {
|
|
$.messager.alert('Error',result.errorMsg, 'error');
|
|
}
|
|
},'json');
|
|
}
|
|
});
|
|
}else{
|
|
$.messager.alert('Warning','Please select a row.', 'warning');
|
|
}
|
|
}
|
|
function refreshSerials() {
|
|
var row = $('#dg').datagrid('getSelected');
|
|
if (row){
|
|
if (row.serialsGenDate){
|
|
$.messager.alert('Warning','do not need refresh', 'warning');
|
|
return;
|
|
}
|
|
|
|
$.post('/prepress/soinfo/'+row.id+'/refreshSerials',{},function(result){
|
|
if (result.success){
|
|
$('#dg').datagrid('reload');
|
|
$.messager.alert('Success','successfully', 'info');
|
|
} else {
|
|
$.messager.alert('Error',result.errorMsg, 'error');
|
|
}
|
|
},'json');
|
|
|
|
}else{
|
|
$.messager.alert('Warning','Please select a row.', 'warning');
|
|
}
|
|
}
|
|
|
|
function removeSerials(){
|
|
var row = $('#dg').datagrid('getSelected');
|
|
if (row){
|
|
if (!row.serialsGenDate){
|
|
$.messager.alert('Warning','Not yet generated', 'warning');
|
|
return;
|
|
}
|
|
$.messager.confirm('Confirm','Remove generated serial numbers for selected order <b>'+row.orderNo+'</b> ?',function(r){
|
|
if (r){
|
|
$.post('/prepress/soinfo/'+row.id+'/delsn',{},function(result){
|
|
if (result.success){
|
|
$('#dg').datagrid('reload');
|
|
$.messager.alert('Success','Serial numbers deleted successfully', 'info');
|
|
} 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 == 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.serials_date));
|
|
//onPartDescChange(data.ifsOrder.part_description, 1);
|
|
}else{
|
|
$.messager.alert('Error', data.msg, 'error');
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
</@master.layout>
|
|
|