|
|
<#import "../master.ftl" as master><@master.layout><style>#fm label { width: 170px;}.page-header { margin: 20px 0 -10px;}.customer-label .textbox-label{ width: 100px;}</style>
<div class="page-header"> <h3>Part Info</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:false, onSelect:onTableRowSelect, url:'/part/getPartList', method:'POST', toolbar:'#tb'"> <thead> <tr> <th data-options="field:'partNo',width:100,editor:'textbox'">Part No</th> <th data-options="field:'partDesc',width:150">Part Description</th> <th data-options="field:'customerPartNo',width:120">Customer Part No</th> <th data-options="field:'revNo',width:80">Part Rev No</th> <th data-options="field:'customerDrawing',width:130">customer drawing</th> <th data-options="field:'eeeeCode',width:80">EEEEcode</th> <th data-options="field:'coo',width:80">COO</th> <th data-options="field:'awApnRev',width:100">AW APN+Rev</th> <th data-options="field:'fgApnRev',width:100">FG APN+Rev</th> <th data-options="field:'packageQty',width:80,align:'right'">Standard Roll Qty</th> <th data-options="field:'boxQty',width:80,align:'right'">Standard Box Qty</th> <th data-options="field:'projectCode',width:100">project code</th> <th data-options="field:'labelType',width:80">Label Type</th> <th data-options="field:'codeType',width:80">码包类型</th> <th data-options="field:'checkProductDateFlag',width:200">Allow Multiple Prod. Date in Package</th> <th data-options="field:'safetyFactor',width:90,align:'right'">Lot Size Buffer%</th> <th data-options="field:'apn',width:100">APN</th> <th data-options="field:'spec',width:100">SPEC</th> <th data-options="field:'customerPartDesc',width:150">Customer Part Desc.</th> <th data-options="field:'stage',width:80">stage</th> <th data-options="field:'config',width:80">config</th> <th data-options="field:'bu',width:60">bu</th> <th data-options="field:'createBy',width:80">Created By</th> <th data-options="field:'createDate',width:90,align:'left',formatter:formatStringTime">Created Time</th> <th data-options="field:'updateBy',width:80">Updated By</th> <th data-options="field:'updateDate',width:90,align:'left',formatter:formatStringTime">Updated Time</th> </tr> </thead></table>
<!-- 页面的查询框 --><div id="tb" style="padding:10px 5px;display: none;"> <div> Part No: <input class="easyui-textbox" id="searchPartNo" 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 href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newProductPartModal()">New</a> <a href="javascript:void(0)" id="tbEdit" data-options="disabled:true" class="easyui-linkbutton" iconCls="icon-edit" onclick="editProductPartModal()">Edit</a> <a href="javascript:void(0)" id="tbDel" data-options="disabled:true" class="easyui-linkbutton" onclick="deletePart()">Delete</a><#-- -->
</div></div><!-- 新增和修改的modal --><div id="dlg" class="easyui-dialog " style="width:900px; 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 id="addId" name="addId" class="easyui-textbox" style="display: none;" value="0"> <input id="site" name="site" class="easyui-textbox" style="display: none;" value="0"> <input id="createBy" name="createBy" class="easyui-textbox" style="display: none;" value=""> <input id="updateBy" name="updateBy" class="easyui-textbox" style="display: none;" value=""> </div> <div style="width: 400px;"> <div style="margin-bottom:10px"> <input id="partNo" name="partNo" class="easyui-textbox" required="true" label="Part No:" style="width:98%"> </div> <div style="margin-bottom:10px"> <input id="customerPartNo" name="customerPartNo" class="easyui-textbox" label="Customer Part No:" style="width:98%"> </div> <div style="margin-bottom:10px"> <input id="revNo" name="revNo" class="easyui-textbox" required="true" label="Part Rev:" style="width:98%"> </div> <div style="margin-bottom:10px"> <input id="customerDrawing" name="customerDrawing" class="easyui-textbox" required="true" label="customer drawing:" style="width:98%"> </div> <div style="margin-bottom:10px"> <input id="eeeeCode" name="eeeeCode" class="easyui-textbox" required="true" label="EEEEcode:" style="width:98%"> </div> <div style="margin-bottom:10px"> <input id="coo" name="coo" class="easyui-textbox" required="true" label="COO:" style="width:98%"> </div> <div style="margin-bottom:10px"> <input id="awApnRev" name="awApnRev" class="easyui-textbox" required="true" label="AW APN+Rev:" style="width:98%"> </div> <div style="margin-bottom:10px"> <input id="fgApnRev" name="fgApnRev" class="easyui-textbox" required="true" label="FG APN+Rev:" style="width:98%"> </div> <div style="margin-bottom:10px"> <input id="packageQty" name="packageQty" class="easyui-textbox" type="number" required="true" label="Standard Roll Qty:" style="width:98%"> </div> <div style="margin-bottom:10px"> <input id="boxQty" name="boxQty" class="easyui-textbox" type="number" required="true" label="Standard Box Qty:" style="width:98%"> </div> <div style="margin-bottom:10px"> <input id="bu" name="bu" class="easyui-textbox" required="true" label="BU:" style="width:98%"> </div> </div> <div style=" margin-left: 430px;width: 400px; margin-top: -408px;"> <div style="margin-bottom:10px"> <input id="projectCode" name="projectCode" class="easyui-textbox" required="true" label="project code:" style="width:98%"> </div> <div style="margin-bottom:10px"> <select id="labelType" class="easyui-combobox" name="labelType" required="true" label="Label Type:" style="width:98%"> <option value="A">A</option> <option value="B">B</option> <option value="C">C</option> </select> </div> <div style="margin-bottom:10px"> <select id="checkProductDateFlag" class="easyui-combobox" name="checkProductDateFlag" required="true" label="Allow Multiple Prod. Date:" style="width:98%"> <option value="Y">Y</option> <option value="N">N</option> </select> </div> <div style="margin-bottom:10px"> <input id="safetyFactor" name="safetyFactor" class="easyui-textbox" type="number" required="true" label="Lot Size Buffer%:" style="width:98%"> </div> <div class="input-div" style="margin-bottom:10px"> <input id="partDesc" name="partDesc" class="easyui-textbox" label="Part Description:" style="width:98%"> </div> <div class="input-div" style="margin-bottom:10px"> <input id="apn" name="apn" class="easyui-textbox" label="APN:" style="width:98%"> </div> <div class="input-div" style="margin-bottom:10px"> <input id="spec" name="spec" class="easyui-textbox" label="SPEC:" style="width:98%"> </div> <div class="input-div" style="margin-bottom:10px"> <input id="customerPartDesc" name="customerPartDesc" class="easyui-textbox" label="Customer Part Desc:" style="width:98%"> </div> <div class="input-div" style="margin-bottom:10px"> <input id="stage" name="stage" class="easyui-textbox" label="stage:" style="width:98%"> </div> <div class="input-div" style="margin-bottom:10px"> <input id="config" name="config" class="easyui-textbox" label="config:" style="width:98%"> </div> <div class="input-div" style="margin-bottom:10px"> <select id="code_type" class="easyui-combobox" name="codeType" required="true" label="码包类型:" style="width:98%"> <option value="2024" selected>2024</option> <option value="2025">2025</option> </select> </div> </div> </form></div><div id="dlg-buttons" style="display: none; text-align: center;"> <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveProductPart()" 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>
<script> //临时参数 let site = $('#current_site').val(); let username = $('#current_username').val(); var currentRow;//当前行 //控制页面的高度 $(window).resize(function () { $("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 30}); });
//初始化页面的高度 $(function () { $(window).resize(); });
//查询功能 $("#queryLink").click(function(){ var dg = $('#dg').datagrid({ queryParams: { partNo: $("#searchPartNo").val(), createdDateFrom: $("#createdDateFrom").val(), createdDateTo: $("#createdDateTo").val() } }); });
//处理菜单的功能 function onTableRowSelect(index, row) { let noRowSelect = !!!row; let status = row.status; $("#tbEdit").linkbutton({"disabled": noRowSelect}); $("#tbDel").linkbutton({"disabled": noRowSelect}); }
var url; function newProductPartModal(){ $('#dlg').dialog('open').dialog('center').dialog('setTitle','New Part'); $('#fm').form('clear'); url = '/part/insertPart'; $('#addId').textbox("setValue", 0); $('#site').textbox("setValue", $('#current_site').val()); $('#createBy').textbox("setValue", username); $('#partNo').textbox('textbox').removeAttr('readonly'); }
//保存工单的信息 function saveProductPart(){ //判断标准中包参数是否符合要求 let partNo = $("#partNo").textbox('getValue'); //判断是否是正数 if(null == partNo || '' == partNo){ $.messager.alert('error', 'Please input Part No!', 'error'); return false; } let revNo = $.trim($("#revNo").textbox('getValue')); if(null == revNo || '' == revNo){ $.messager.alert('error', 'Please input Part Rev No!', 'error'); return false; } let customerPartNo = $.trim($("#customerPartNo").textbox('getValue')); if(null == customerPartNo || '' == customerPartNo){ $.messager.alert('error', 'Please input Customer Part No!', 'error'); return false; } /* 判断是否维护好customerPartRev */ let eeeeCode = $.trim($("#eeeeCode").textbox('getValue')); if(null == eeeeCode || '' == eeeeCode){ $.messager.alert('error', 'Please input EEEE Code!', 'error'); return false; } if(eeeeCode.length!==7){ $.messager.alert('error', 'The length of EEEE Code should be in 7 bits!', 'error'); return false; } let coo = $.trim($("#coo").textbox('getValue')); if(null == coo || '' == coo){ $.messager.alert('error', 'Please input COO!', 'error'); return false; } if(coo.length!==2){ $.messager.alert('error', 'The length of COO is 2 bits!', 'error'); return false; }
let codeType = $.trim($("#code_type").textbox('getValue')); if(null == codeType || '' == codeType){ $.messager.alert('error', 'Please input Code Type!', 'error'); return false; } //只有2024码包类型才需要维护AW APN+Rev和FG APN+Rev if (codeType==='2024'){ let awApnRev = $.trim($("#awApnRev").textbox('getValue')); if(null == awApnRev || '' == awApnRev){ $.messager.alert('error', 'Please input AW APN+Rev!', 'error'); return false; } if(awApnRev.length!==11){ $.messager.alert('error', 'The length of AW APN+Rev should be in 11 bits!', 'error'); return false; } let fgApnRev = $.trim($("#fgApnRev").textbox('getValue')); if(null == fgApnRev || '' == fgApnRev){ $.messager.alert('error', 'Please input FG APN+Rev!', 'error'); return false; } if(fgApnRev.length!==11){ $.messager.alert('error', 'The length of FG APN+Rev should be in 11 bits!', 'error'); return false; } } let packageQty = $.trim($("#packageQty").textbox('getValue')); if(null == packageQty || '' == packageQty){ $.messager.alert('error', 'Please input Standard Roll Qty!', 'error'); return false; } let boxQty = $.trim($("#boxQty").textbox('getValue')); if(null == boxQty || '' == boxQty){ $.messager.alert('error', 'Please input Standard Box Qty!', 'error'); return false; } let projectCode = $.trim($("#projectCode").textbox('getValue')); if(null == projectCode || '' == projectCode){ $.messager.alert('error', 'Please input project code!', 'error'); return false; } let labelType = $.trim($("#labelType").textbox('getValue')); if(null == labelType || '' == labelType){ $.messager.alert('error', 'Please input label Type!', 'error'); return false; } let checkProductDateFlag = $.trim($("#checkProductDateFlag").textbox('getValue')); if(null == checkProductDateFlag || '' == checkProductDateFlag){ $.messager.alert('error', 'Please input Allow Multiple Prod. Date in Package!', 'error'); return false; } let safetyFactor = $.trim($("#safetyFactor").textbox('getValue')); if(null == safetyFactor || '' == safetyFactor){ $.messager.alert('error', 'Please input Lot Size Buffer%!', 'error'); return false; } //判断是否存在内容 $('#fm').form('submit', { url: url, success: function(result){ var result = eval("("+result+")"); if (result.success){ $('#dlg').dialog('close'); // close the dialog $('#dg').datagrid('reload'); } else { $.messager.alert('error',result.msg, 'error'); } } }); }
//编辑输入框 function editProductPartModal(){ var row = $('#dg').datagrid('getSelected'); if (row){ $('#dlg').dialog('open').dialog('center').dialog('setTitle','Edit Part'); $('#fm').form('load', row); url = '/part/insertPart'; $('#addId').textbox("setValue", 1); $('#updateBy').textbox("setValue", username); $('#partNo').textbox('textbox').attr('readonly','readonly'); }else{ $.messager.alert('Warning','Please selete one line!', 'warning'); } }
function deletePart() { $.messager.confirm('Confirm', 'Are you sure to delete the data?', function (r) { if (r) { // $.post('/base/deleteMachineData', {id: id}, function (result) { // if (result.success) { // $('#dg').datagrid('reload'); // $.messager.alert('Success', '删除成功', 'info'); // } else { // $.messager.alert('Error', result.errorMsg, 'error'); // } // }, 'json'); deletePartDoing(); } }); }
function deletePartDoing(){ var row = $('#dg').datagrid('getSelected'); if (row){ $.post('/part/deletePart', {'site': row.site,'partNo': row.partNo}, function(result){ if (result.success){ $('#dg').datagrid('reload'); // reload the user data } else { $.messager.alert('error',result.msg, 'error'); } },'json'); // $('#fm').form('load', row); // //判断是否存在内容 // $('#fm').form('submit', { // url: '/part/deletePart', // success: function(result){ // var result = eval("("+result+")"); // if (result.success){ // $('#dlg').dialog('close'); // close the dialog // $('#dg').datagrid('reload'); // } else { // $.messager.alert('error',result.msg, 'error'); // } // } // }); }else{ $.messager.alert('Warning','Please selete one line!', 'warning'); } }
</script>
</@master.layout>
|