/**
|
*
|
*/
|
|
// 全局变量
|
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("#txtGX")[0].focus();
|
|
|
}
|
},
|
error: function(xhr, type, errorThrown) {
|
alert("获取数据异常:" + JSON.stringify(errorThrown));
|
}
|
});
|
}
|
};
|
|
|
//扫描工单条码处理方法
|
function GetBarInfo() {
|
if(event.keyCode == 13) {
|
//如果未输入条码,跳出方法
|
|
if($("#txtHBGD").val() == "") {
|
$("#txtHBGD").focus();
|
playerAudio("NG");
|
mui.toast("请先扫描合并工单条码!");
|
return;
|
}
|
|
if($("#txtGX").val() == "") {
|
$("#txtGX").focus();
|
playerAudio("NG");
|
mui.toast("请先扫描工序!");
|
return;
|
}
|
console.log(1);
|
|
if($("#txtBillNo").val() == "") {
|
$("#txtBillNoN").focus();
|
playerAudio("NG");
|
mui.toast("请先选择入库人员!");
|
//$("#txtBillNoN").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/GetHBGDInfo_BG",
|
|
data: {
|
HBGD: $("#txtHBGD").val(),
|
GX: $("#txtGX").val(), //当前库位
|
},
|
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("#txtHBGD")[0].focus();
|
$("#txtHBGD").val("");
|
});
|
return;
|
} else {
|
console.log(data.data);
|
populateTable(data.data);
|
mui("#txtSL")[0].focus();
|
$("#txtSL").val("");
|
}
|
},
|
error: function(xhr, type, errorThrown) {
|
alert("获取数据异常:" + JSON.stringify(errorThrown));
|
}
|
});
|
}
|
};
|
|
function populateTable(data) {
|
|
console.log('1');
|
let tbody = document.querySelector("#myTable tbody");
|
|
// 清空表格内容
|
tbody.innerHTML = "";
|
|
let totalQuantity = 0; // 初始化报工数量总和为0
|
|
// 循环遍历数据,生成表格行
|
for (let i = 0; i < data["指令工单"].length; i++) {
|
let tr = document.createElement("tr");
|
|
// 创建表格单元格,并将数据填入
|
let td1 = document.createElement("td");
|
td1.textContent = data["指令工单"][i];
|
tr.appendChild(td1);
|
|
let td2 = document.createElement("td");
|
td2.textContent = data["工序名称"][i];
|
tr.appendChild(td2);
|
|
let td3 = document.createElement("td");
|
td3.textContent = data["报工数量"][i];
|
tr.appendChild(td3);
|
|
let td4 = document.createElement("td");
|
td4.textContent = data["报工人员"][i];
|
tr.appendChild(td4);
|
|
let td5 = document.createElement("td");
|
td5.textContent = data["报工时间"][i];
|
tr.appendChild(td5);
|
|
totalQuantity += parseInt(data["报工数量"][i]); // 累加报工数量总和
|
|
tbody.appendChild(tr);
|
}
|
|
// 创建表格行来显示报工数量的汇总
|
let summaryRow = document.createElement("tr");
|
let summaryLabel = document.createElement("td");
|
summaryLabel.textContent = "报工数量汇总:";
|
let summaryValue = document.createElement("td");
|
summaryValue.textContent = totalQuantity;
|
summaryValue.setAttribute("colspan", "3"); // 设置该单元格横跨3列
|
summaryRow.appendChild(summaryLabel);
|
summaryRow.appendChild(summaryValue);
|
|
tbody.appendChild(summaryRow);
|
};
|
|
//扫描库位处理方法
|
function GetBarGX() {
|
|
if(event.keyCode == 13) {
|
|
if($("#txtGX").val() == "") {
|
$("#txtGX").focus();
|
playerAudio("NG");
|
mui.toast("请扫描工序");
|
$("#txtGX").val("");
|
return;
|
}
|
$("#txtHBGD").focus();
|
}
|
|
|
}
|
|
|
//确认报工数量
|
function HBBG() {
|
|
if(event.keyCode == 13)
|
{
|
if($("#txtSL").val() == "") {
|
$("#txtSL").focus();
|
playerAudio("NG");
|
mui.toast("请输入数量");
|
$("#txtSL").val("");
|
return;
|
}
|
var user_id =$("#txtBillNo").val(); //currentSession.user_id;
|
var currentSession = app.loadconfig(app.CONFIG_CURRENT_SESSION);
|
var BG_RY =currentSession.user_id;//
|
$.ajax({
|
url: app.API_URL_HEADER + "/WARBAB/HBBG",
|
|
data: {
|
HBGD: $("#txtHBGD").val(),
|
GX: $("#txtGX").val(), //当前库位
|
SL: $("#txtSL").val(), //当前库位
|
user_id: user_id,//Admin //先写死,便于调试
|
BG_RY:BG_RY,
|
|
},
|
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("#txtSL")[0].focus();
|
$("#txtSL").val("");
|
});
|
return;
|
} else {
|
$("#txtSL").val("");//先清空一下数据源
|
mui("#txtSL")[0].focus();
|
GetBarInfo();
|
|
mui.toast(data.message);
|
//initBluetooth();
|
|
}
|
},
|
error: function(xhr, type, errorThrown) {
|
alert("获取数据异常:" + JSON.stringify(errorThrown));
|
}
|
});
|
}
|
|
|
|
}
|
|
|
/* 当页面的文本失去焦点时,让其再次获取焦点 */
|
|
|
/**
|
* @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();
|
// }
|
//}
|