var userId = $("#current_id").val(); var userName = $("#current_username").val(); var site = $("#current_site").val(); var titleName = $("#current_titleName").val(); var currentData = null; //页面初始化 $(function(){ if(titleName != null && titleName != ""){ $("#titleName").text('通知单入库'); }else { window.location.href="/login"; } var workData = $.cookie("transFer"); if(workData != null && workData !==""){ if(titleName=='不要缓存') { currentData = null; layer.msg("保存成功!"); }else if(titleName=='回退'){ currentData = JSON.parse(workData); initVal(); $.cookie("transFer", ""); }else { $.cookie("transFer", ""); } } // 初始化光标 $("#orderNo_search").focus(); }); //为工具实例条码绑定一个失去焦点事件 $("#orderNo_search").bind("keydown",function(event){ if (event.keyCode == 13) { getOrderNoData(); } }); // 获取获取工具实例编码 function getOrderNoData(){ let orderNoSearch = $("#orderNo_search").val(); if(orderNoSearch == null || orderNoSearch === ""){ layer.msg("请输入入库通知单号!"); return false } let jsonData = { transFerNo : orderNoSearch, status : 'Hunlian', } $.ajax({ url: "/pdaOrder/getTransfer", contentType: 'application/json', type:"POST", data:JSON.stringify(jsonData),//你的formid dataType:"JSON", beforeSend: function(request) { request.setRequestHeader("token", $.cookie("token")); }, success: function (data) { if(data.code===0) { if (data.row.orderNo != null && data.row.orderNo != "") { currentData = data.row; initVal(); } else { layer.msg("入库通知单号错误!"); } }else { layer.msg(data.msg) } }, error: function(data) { var responseText = data.responseText; var json_str = JSON.parse(responseText); var status = json_str.status; var message = json_str.message; //判断是否是session超时 if(403==status){ layer.alert(message,function(){ window.location.href="/login"; }); } layer.closeAll('loading'); } }) } function initVal(){ $("#site").val(currentData.site); $("#orderNo").val(currentData.orderNo); $("#partNo").val(currentData.partNo); $("#partDescription").val(currentData.partDescription); $("#status").val(currentData.status); $("#lotSize").val(currentData.lotSize); $("#finishedQty").val(currentData.finishedQty); $("#transFerNo").val(currentData.transFerNo); $("#weightFactor").val(currentData.weightFactor); // if(currentData.weightFactor!='-1'&¤tData.weightFactor!=''&¤tData.weightFactor!=null){ // $("#lotSizeKG").val((currentData.lotSize*currentData.weightFactor).toFixed(1)); // $("#finishedQtyKG").val((currentData.finishedQty*currentData.weightFactor).toFixed(1)); // }else { // $("#lotSizeKG").val("erp未维护数据"); // $("#finishedQtyKG").val(""); // } } //下级界面页面跳转 function pageJump(){ if(currentData == null){ layer.msg("当前无入库通知单信息!"); return false } if(currentData.lotSize <= currentData.finishedQty ){ layer.msg("该通知单已入库完毕无需再次入库!"); return false } currentData = JSON.stringify(currentData); $.cookie("transFer",currentData); /*,{ expires : 1, path : "/" }*/ var menuId = $("#menuId").val(); var superiorName = $("#current_titleName").val(); window.location.href = "/pda/transferWarehousing2ForHunlian?menuId=" + menuId + "&titleName=" + superiorName; } //下级界面页面跳转 function pdaBaseJump(){ window.location.href = "/pda/pdaBase"; } //初始化下拉框 function selectInit(){ $('.selectpicker').selectpicker({ noneSelectedText: '', noneResultsText: '', liveSearch: true, width:140, size:5 //设置select高度,同时显示5个值 }); }