/** * */ // 全局变量 var billNo = ''; var i = 0; //计算扫描条码数量 var WLBM = "";//物料编码 var matterTable = null; var PopPicker = new mui.PopPicker(); //初始化,默认焦点 mui.plusReady(function(){ app.init(); mui("#txtBillNo")[0].focus(); //SetBillNo(); $('#info').height($(window).height()- $("#row001").height() - $("#div001").height()- $("#div002").height() - 70); }); // $(function(){ // billNo= GetMaxBillNO("1201",GetSysDateTime());//调拨单号,只要不离开界面,单号不变 // $('#info').height($(window).height()- $("#row001").height() - $("#div001").height()- $("#div002").height() - 70); // }) // $(function() { // SetBillNo(); // }); function SetBillNo() { $("#txtBillNo").click(function() { GetBillList(); PopPicker.show(function(items) { var billNo = items[0].text; $("#txtBillNo").val(billNo); }); }); } function GetBarInfoT() { if(event.keyCode == 13) { //用户ID var currentSession = app.loadconfig(app.CONFIG_CURRENT_SESSION); var user_id = currentSession.user_id; // var user_id = "admin"; $.ajax({ url: app.API_URL_HEADER + "/WARBAB/GetBarInfoNAME", data: { txtBillNoN: $("#txtBillNoN").val(), logID: user_id,//Admin //先写死,便于调试 }, DataType: "json", type: "post", async: false, //timeout: 15000, success: function(data) { //console.log(JSON.stringify(data)); if(data.status != 0) { playerAudio("NG"); mui.alert(data.message,"","",function(){ mui("#txtBillNoN")[0].focus(); $("#txtBillNoN").val(""); }); return; } else { matterTable = data.data.matterTable; $("#txtBillNo").val("");//先清空一下数据源 $("#txtBillNo").val(data.data.NAME);//填入条码明细信息 mui("#DAB001")[0].focus(); } }, error: function(xhr, type, errorThrown) { alert("获取数据异常:" + JSON.stringify(errorThrown)); } }); } }; function GetBillList() { var billDate = $("#txtBillDate").val(); var o = {}; o["billDate"] = billDate; $.ajax({ url: app.API_URL_HEADER + '/IQCPBA/GetBillNoListsT', data: "", dataType: "json", type: "post", success: function(resdata) { var dataWorkers = null; dataWorkers = $.parseJSON(resdata.data); PopPicker.setData(dataWorkers); }, error: function(xhr, type, errorThrown) { alert("获取数据异常:" + JSON.stringify(errorThrown)); } }); } //数字拖动之后调整数字小图标位置 function onStopDrag(e) { var d = e.data; if(d.left < 0) { d.left = 0 } if(d.top < 0) { d.top = 0 } if(d.top + $(d.target).outerHeight() > $(d.parent).height()) { $("#dgWOMDAG-sum")[0].innerHTML = "0"; $("#dgWOMDAG-sum").css("top", d.startTop + "px"); $("#dgWOMDAG-sum").css("left", d.startLeft + "px"); $("#dgWOMDAG-sum").css("position", "initial"); i = 0; } } //扫描条码处理方法 function GetBarInfo() { if(event.keyCode == 13) { //如果未输入条码,跳出方法 if($("#DAB001").val() == "") { $("#DAB001").focus(); playerAudio("NG"); mui.toast("请先扫描物料条码!"); return; } if($("#txtGX").val() == "") { $("#txtGX").focus(); playerAudio("NG"); mui.toast("请先扫描工序!"); return; } if($("#txtSL").val() == "") { $("#txtSL").focus(); playerAudio("NG"); mui.toast("请先输入数量!"); return; } if($("#txtBillNo").val() == "") { $("#DAB001").focus(); playerAudio("NG"); mui.toast("请先选择入库人员!"); $("#DAB001").val(""); return; } //用户ID var currentSession = app.loadconfig(app.CONFIG_CURRENT_SESSION); var user_id =$("#txtBillNo").val(); //currentSession.user_id; var mun=$("#txtSL").val(); // var user_id = "admin"; $.ajax({ url: app.API_URL_HEADER + "/WARBAB/GetBarInfo", data: { DAB001: $("#DAB001").val(), check: $("#txtSL").val(), //获取复选框是否被选中(true,false) curStore: $("#txtGX").val() == null ? "" : $("#txtGX").val(), //当前库位 billNo:billNo, logID: user_id,//Admin //先写死,便于调试 }, DataType: "json", type: "post", async: false, //timeout: 15000, success: function(data) { //console.log(JSON.stringify(data)); if(data.status != 0) { playerAudio("NG"); mui.alert(data.message,"","",function(){ mui("#DAB001")[0].focus(); $("#DAB001").val(""); }); return; } else { matterTable = data.data.matterTable; $("#info").val("");//先清空一下数据源 $("#info").val(data.data.infos);//填入条码明细信息 GetStore(); } }, error: function(xhr, type, errorThrown) { alert("获取数据异常:" + JSON.stringify(errorThrown)); } }); } }; function BarcodePutInStorageHint(){ $.ajax({ url: app.API_URL_HEADER + app.API_METHOD_ESP, data: { spname: "BarcodePutInStorageHint", returnvalue: 1, _sp_DAB001: $("#DAB001").val() }, type: "post", success: function(data) { console.log(JSON.stringify(data)); if(data.status == 0) { $("#hint")[0].innerHTML= "个数/扫描数/送货数:"+ data.data[0]["A1"]+"/"+ data.data[0]["B1"]+"/"+ data.data[0]["B"]; ; } else { $("#hint")[0].innerHTML=""; } }, error: function(xhr, type, errorThrown) { } }); } //扫描库位处理方法 function GetStore() { //用户ID var currentSession = app.loadconfig(app.CONFIG_CURRENT_SESSION); var user_id = currentSession.user_id; var userRY=$("#txtBillNo").val(); var billNo=$("#txtGX").val()+'-'+$("#txtSL").val(); $.ajax({ url: app.API_URL_HEADER + "/WARBAB/GetStoreTT", // url: "http://localhost:27611/api/WARBAB/GetStore", data:{ userRY:userRY, DAB001:$("#DAB001").val(), logID: user_id,//'admin', //先写死,便于调试 billNo:billNo, }, DataType:"json", type:"post", async:false, //timeout:15000, success:function(data){ //console.log(JSON.stringify(data)); if(data.status != 0){ mui.alert(data.message);//错误信息弹框 $("#MBA001")[0].focus(); $("#MBA001").val(""); return; } if(data.data<=0){ mui.alert(data.message); return; }else{ $("#DAB001").val(""); $("#DAB001")[0].focus(); //$("#checkdefault").prop("checked", true); if(WLBM == matterTable[0]["DAB020"].toString()) $("#dgWOMDAG-sum")[0].innerHTML = ++i; else{ WLBM = matterTable[0]["DAB020"].toString(); i = 1; $("#dgWOMDAG-sum")[0].innerHTML = i; } playerAudio("OK"); mui.toast("报工成功!"); // playerAudio("OK"); } }, error: function(xhr, type, errorThrown) { mui.toast("报工异常!"); alert("获取数据异常:" + JSON.stringify(errorThrown)); return; } }); } /* 当页面的文本失去焦点时,让其再次获取焦点 */ /** * @param {出发DOM控件:this} e */ //function SetInputFoucs(codeID) { // var itemTag = document.activeElement.tagName; //获取元素的标签名 // var name = document.activeElement.name; //获取元素的名称 // //如果控件不是文本 // //如果控件是文本,Name非空时(如checkbox) // //条码获取焦点 // if ((itemTag != 'INPUT') || // (itemTag == 'INPUT' && name != '')) { // $(codeID).focus(); // } //}