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.
501 lines
19 KiB
501 lines
19 KiB
<#import "../master.ftl" as master>
|
|
<@master.layout>
|
|
<style>
|
|
#fm label {
|
|
width: 150px;
|
|
}
|
|
.page-header {
|
|
margin: 20px 0 -10px;
|
|
}
|
|
.customer-label .textbox-label{
|
|
width: 120px;
|
|
}
|
|
</style>
|
|
|
|
<div class="page-header">
|
|
<h3>Import Shop Order</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:true,
|
|
onSelect:onTableRowSelect, url:'/so/order/getSoOrderList', method:'POST',
|
|
toolbar:'#tb'">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'orderNo',width:80,editor:'textbox'">SO No</th>
|
|
<th data-options="field:'partNo',width:80,editor:'textbox'">Part No</th>
|
|
<th data-options="field:'partDesc',width:200,editor:'textbox'">Part Description</th>
|
|
<th data-options="field:'revNo',width:50">Rev No</th>
|
|
<th data-options="field:'lotSize',width:60,editor:'textbox'">Lot Size</th>
|
|
<th data-options="field:'stockedQty',width:60,editor:'textbox'">Received Qty</th>
|
|
<th data-options="field:'packageQty',width:60,editor:'textbox'">Standard Roll Qty</th>
|
|
<th data-options="field:'boxQty',width:60,editor:'textbox'">Standard Box Qty</th>
|
|
<th data-options="field:'serialsDate',width:90,align:'left',formatter:formatStringTime">SN Date</th>
|
|
<th data-options="field:'earliestStartDate',width:90,formatter:formatStringTime">Earliest Start Date</th>
|
|
<th data-options="field:'createdBy',width:60,align:'left'">Created By</th>
|
|
<th data-options="field:'createdDate',width:90,align:'center',formatter:formatStringTime">Created Time</th>
|
|
<th data-options="field:'status',width:80,editor:'textbox'">Status</th>
|
|
<th data-options="field:'id',width:120,editor:'textbox', formatter: formatOrderAction">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
|
|
<!-- 页面的查询框 -->
|
|
<div id="tb" style="padding:10px 5px;display: none;">
|
|
<div>
|
|
SO No: <input class="easyui-textbox" id="orderNo" 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="newSoOrder()">New</a>
|
|
<a href="javascript:void(0)" id="tbEdit" data-options="disabled:true" class="easyui-linkbutton" iconCls="icon-edit" onclick="editSoOrder()">Update</a>
|
|
<a href="javascript:void(0)" id="tbRemove" data-options="disabled:true" class="easyui-linkbutton" iconCls="icon-remove" onclick="removeSoOrder()">Delete</a>
|
|
<a href="javascript:void(0)" id="tbRelease" data-options="disabled:true" class="easyui-linkbutton" onclick="releaseSoOrder()">
|
|
<span class="glyphicon glyphicon-forward"></span>Release
|
|
</a>
|
|
<a href="javascript:void(0)" id="tbSnGen" data-options="disabled:true" class="easyui-linkbutton" iconCls="icon-add" onclick="genSerials()">Generate Serials</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 新增和修改的modal -->
|
|
<div id="dlg" class="easyui-dialog" 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; display: none;">
|
|
<input id="so_order_id" name="id" class="easyui-textbox" style="" value="0">
|
|
<input id="created_by" name="createdBy" class="easyui-textbox" style="" value="">
|
|
<input id="updated_by" name="updatedBy" class="easyui-textbox" style="" value="">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="order_no" name="orderNo" class="easyui-textbox" required="true" data-options="buttonText: 'IFS',onClickButton:getIfsOrder" label="SO 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 id="project" name="project" class="easyui-textbox" id="spec" required="true" label="Project:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="rev_no" name="revNo" id="revNo" class="easyui-textbox" required="true" label="Rev No:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="lot_size" name="lotSize" class="easyui-numberbox" readonly required="true" label="Lot Size:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="input_lot_size" 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="earliestStartDate" class="easyui-datebox" validtype="validDate" required="true" label="Earliest Start Date:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<select id="cross_number" class="easyui-combobox" name="crossNumber" required="true" label="No Of Cross:" style="width:100%">
|
|
<option value="3">3</option>
|
|
<option value="4">4</option>
|
|
</select>
|
|
</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="saveSoOrder()" 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();
|
|
});
|
|
|
|
$.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) {
|
|
let noRowSelect = !!!row;
|
|
let status = row.status;
|
|
currentRow = row;
|
|
$("#tbEdit").linkbutton({"disabled": noRowSelect || status != 'Created'});
|
|
$("#tbRemove").linkbutton({"disabled": noRowSelect || status != 'Created'});
|
|
$("#tbRelease").linkbutton({"disabled": noRowSelect || status != 'Created'});
|
|
$("#tbSnGen").linkbutton({"disabled": noRowSelect || status != 'Released'});
|
|
}
|
|
|
|
//查询功能
|
|
$("#queryLink").click(function(){
|
|
var dg = $('#dg').datagrid({
|
|
queryParams: {
|
|
orderNo: $("#orderNo").val(),
|
|
createdDateFrom: $("#createdDateFrom").val(),
|
|
createdDateTo: $("#createdDateTo").val()
|
|
}
|
|
});
|
|
});
|
|
|
|
//格式化工单的功能
|
|
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 setByInputName(inpt, value){
|
|
var $inpt = $("#dlg input[textboxname="+inpt+"]");
|
|
$inpt.textbox({"value": value});
|
|
}
|
|
|
|
//获取工单得信息
|
|
function getIfsOrder(){
|
|
var orderNo = $("#order_no").val();
|
|
if (orderNo != ""){
|
|
$.post("/so/order/getIfsOrderData", {orderNo: orderNo}, function (data) {
|
|
console.log(data);
|
|
if(data.success){
|
|
setByInputName("partNo", data.row.part_no);
|
|
setByInputName("partDesc", data.row.part_description);
|
|
setByInputName("lotSize", data.row.lotSize);
|
|
let totalQty = data.row.lotSize * data.row.safetyFactor;
|
|
setByInputName("inputLotSize", totalQty);
|
|
let projectCode = data.row.projectCode;
|
|
//判断是否为空
|
|
if(projectCode == null || projectCode == ''){
|
|
$.messager.alert('Warning', 'Please input Project Code', 'warning');
|
|
return false;
|
|
}else{
|
|
setByInputName("project", projectCode);
|
|
}
|
|
setByInputName("revNo", data.row.revNo);
|
|
let earliestStartDate = data.row.earliestStartDate;
|
|
//截取和去掉T
|
|
if(!(null == earliestStartDate || '' == earliestStartDate)){
|
|
earliestStartDate = earliestStartDate.substring(0, 19);
|
|
earliestStartDate = earliestStartDate.replace('T', ' ');
|
|
}
|
|
setByInputName("earliestStartDate", formatDate(earliestStartDate));
|
|
setByInputName("serialsDate", formatDate(earliestStartDate));
|
|
//$('#cross_number').combobox('setValue', data.row.cross_number);
|
|
$('#cross_number').combobox('setValue', 4);
|
|
}else{
|
|
$.messager.alert('Warning', data.msg, 'warning');
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
//设置保存工单信息的modal(新增)
|
|
var url;
|
|
function newSoOrder(){
|
|
$('#dlg').dialog('open').dialog('center').dialog('setTitle','New Shop Order');
|
|
$('#fm').form('clear');
|
|
url = '/so/order/newSoOrderData';
|
|
$('#so_order_id').textbox("setValue", 0);
|
|
$('#so_order_id').textbox("setValue", 0);
|
|
$("#created_by").textbox('setValue', username);
|
|
$('#cross_number').combobox('setValue', 3);
|
|
}
|
|
|
|
//编辑输入框
|
|
function editSoOrder(){
|
|
$("#updated_by").textbox('setValue', username);
|
|
var row = $('#dg').datagrid('getSelected');
|
|
if (row){
|
|
$('#dlg').dialog('open').dialog('center').dialog('setTitle','Edit Shop Order');
|
|
$('#fm').form('load', row);
|
|
url = '/so/order/saveSoOrderData';
|
|
}else{
|
|
$.messager.alert('Warning','Please selete one line!', 'warning');
|
|
}
|
|
}
|
|
|
|
//延时操作
|
|
var delay = (function(){
|
|
var timer = 0;
|
|
return function(callback, ms){
|
|
clearTimeout (timer);
|
|
timer = setTimeout(callback, ms);
|
|
};
|
|
})();
|
|
|
|
//保存工单的信息
|
|
function saveSoOrder(){
|
|
/* 判断是否维护好project */
|
|
let project = $.trim($("#project").textbox('getValue'));
|
|
if(null == project || '' == project){
|
|
$.messager.alert('error', 'Please input Project Flag!', 'error');
|
|
return false;
|
|
}
|
|
//判断标准中包参数是否符合要求
|
|
let lotSize = parseInt($("#lot_size").textbox('getValue'));
|
|
let inputLotSize = parseInt($("#input_lot_size").textbox('getValue'));
|
|
//判断是否是正数
|
|
if(inputLotSize < lotSize){
|
|
$.messager.alert('error', 'Input Lot Size should be greater than Lot Size!', 'error');
|
|
return false;
|
|
}
|
|
|
|
//判断是否存在空格
|
|
let orderNo = $.trim($("#order_no").textbox('getValue'));
|
|
//设置参数
|
|
$('#order_no').textbox("setValue", orderNo);
|
|
//判断是否存在内容
|
|
$('#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 removeSoOrder(){
|
|
var row = $('#dg').datagrid('getSelected');
|
|
if (row){
|
|
$.messager.confirm('Confirm','Are you sure to delete the shop order:<b>'+row.orderNo+'</b> ?',function(r){
|
|
if (r){
|
|
$.post('/so/order/deleteSoOrderData', {'id': row.id}, function(result){
|
|
if (result.success){
|
|
$('#dg').datagrid('reload'); // reload the user data
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error');
|
|
}
|
|
},'json');
|
|
}
|
|
});
|
|
}else{
|
|
$.messager.alert('Warning','Please selete one line!', 'warning');
|
|
}
|
|
}
|
|
|
|
//下达工单
|
|
function releaseSoOrder(){
|
|
let currentRow = $('#dg').datagrid('getSelected');
|
|
if (currentRow){
|
|
$.messager.confirm('Confirm','Are you sure to release the shop order: <b>'+currentRow.orderNo+'</b> ?',function(r){
|
|
if (r){
|
|
$.post('/so/order/releasedSoOrderData',{'id': currentRow.id, "username": $("#current_username").val()},function(result){
|
|
if (result.success){
|
|
$('#dg').datagrid('reload'); // reload the user data
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error');
|
|
}
|
|
},'json');
|
|
}
|
|
});
|
|
}else{
|
|
$.messager.alert('Warning','Please selete one line!', '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('/so/order/genSerials',{'orderNo': row.orderNo, 'username': username},function(result){
|
|
if (result.success){
|
|
$('#dg').datagrid('reload');
|
|
$.messager.alert('Success','Serial numbers generated successfully', 'info');
|
|
} else {
|
|
$.messager.alert('Error',result.msg, 'error');
|
|
}
|
|
},'json');
|
|
}
|
|
});
|
|
}else{
|
|
$.messager.alert('Warning','Please select a row.', 'warning');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
}
|
|
|
|
|
|
/* ** ** ** ** ** ** ** ** ** ** 2024年开发的代码 ** ** ** ** ** ** ** ** ** */
|
|
//信息完善的modal
|
|
function orderRefineModal(){
|
|
//取到当前的行
|
|
delay(function(){
|
|
currentRow = $('#dg').datagrid('getSelected');
|
|
//判断是否存在数据
|
|
if(!currentRow){
|
|
$.messager.alert('error', 'Please select shop order first!', 'error');
|
|
return false;
|
|
}
|
|
//设置标题
|
|
$('#order_refine_modal').dialog('open').dialog('center').dialog('setTitle','Modify');
|
|
//$('#order_refine_fm').form('clear');//清空表信息
|
|
//设置的信息
|
|
$("#order_no").textbox("setValue", currentRow.orderNo);
|
|
//判断一下是否保税
|
|
let bondedFlag = currentRow.bondedFlag;
|
|
//如果存在数据
|
|
if(!(null == bondedFlag || '' == bondedFlag)){
|
|
$("#bonded_flag").combobox('setValue', bondedFlag);
|
|
}else{
|
|
$("#bonded_flag").combobox('setValue', 'Bonded');
|
|
}
|
|
//$("#bonded_flag").textbox("setValue", currentRow.bondedFlag);
|
|
$("#scheme_remark").textbox("setValue", currentRow.schemeRemark);
|
|
$("#stage_remark").textbox("setValue", currentRow.stageRemark);
|
|
}, 500);
|
|
}
|
|
|
|
//保存信息完善的数据
|
|
function saveOrderRefine(){
|
|
//填充数据
|
|
var bondedFlag = $("#bonded_flag").combobox('getValue', bondedFlag).trim();
|
|
var schemeRemark = $("#scheme_remark").textbox("getValue").trim();
|
|
var stageRemark = $("#stage_remark").textbox("getValue").trim();
|
|
//设置参数
|
|
var requestRow = {"id": currentRow.id, "bondedFlag": bondedFlag, "schemeRemark": schemeRemark, "stageRemark": stageRemark};
|
|
|
|
//调用方法传递数值
|
|
//转json字符串
|
|
let postData = JSON.stringify(requestRow);
|
|
//设置请求的类型
|
|
$.ajaxSetup({
|
|
contentType: "application/json;charset=utf-8"});
|
|
$.post('/prepress/updateSoInfoRefineData', postData,
|
|
function(result){
|
|
if (result.success){
|
|
//提示操作成功
|
|
$.messager.alert('info',result.msg, 'info', function(){
|
|
//关闭弹窗
|
|
$('#order_refine_modal').dialog('close'); // close the dialog
|
|
//刷新主表的数据
|
|
$('#dg').datagrid('reload');
|
|
});
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error', function(){
|
|
//自动获取焦点
|
|
});
|
|
}
|
|
},'json');
|
|
//设置请求的类型
|
|
$.ajaxSetup({
|
|
contentType: "application/x-www-form-urlencoded"});
|
|
}
|
|
|
|
//信息完善的modal
|
|
function changePartModal(){
|
|
//取到当前的行
|
|
delay(function(){
|
|
currentRow = $('#dg').datagrid('getSelected');
|
|
//设置标题
|
|
$('#change_part_modal').dialog('open').dialog('center').dialog('setTitle','Update Part No');
|
|
//设置的信息
|
|
let partNo = currentRow.partNo;
|
|
let prePartNo = partNo.substring(0, 8);
|
|
let sufPartNo = partNo.substring(8);
|
|
//如果存在数据
|
|
$("#prefix_part_no").textbox("setValue", prePartNo);
|
|
$("#suffix_part_no").val(sufPartNo);
|
|
$("#suffix_part_no").focus();
|
|
}, 500);
|
|
}
|
|
|
|
//保存信息完善的数据
|
|
function changeOrderPart(){
|
|
//填充数据
|
|
var prePartNo = $("#prefix_part_no").textbox("getValue").trim();
|
|
var sufPartNo = $("#suffix_part_no").val().trim();
|
|
var resultPartNo = prePartNo+sufPartNo;
|
|
//设置参数
|
|
var requestRow = {"id": currentRow.id, "partNo": resultPartNo};
|
|
|
|
//调用方法传递数值
|
|
//转json字符串
|
|
let postData = JSON.stringify(requestRow);
|
|
//设置请求的类型
|
|
$.ajaxSetup({
|
|
contentType: "application/json;charset=utf-8"});
|
|
$.post('/prepress/changeSoInfoPart', postData,
|
|
function(result){
|
|
if (result.success){
|
|
//提示操作成功
|
|
$.messager.alert('info',result.msg, 'info', function(){
|
|
//关闭弹窗
|
|
$('#change_part_modal').dialog('close'); // close the dialog
|
|
//刷新主表的数据
|
|
$('#dg').datagrid('reload');
|
|
});
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error', function(){
|
|
//自动获取焦点
|
|
});
|
|
}
|
|
},'json');
|
|
//设置请求的类型
|
|
$.ajaxSetup({
|
|
contentType: "application/x-www-form-urlencoded"});
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
</@master.layout>
|
|
|