/**
|
* 作者:G98138 黎锋
|
* 时间:2018-09-04
|
* 描述:库位 绑定
|
*
|
* 业务思路:
|
* 1. 扫描条码
|
* 1.1 非条码库存表的条码, 提示( OK) *
|
* 1.2 非待入库条码, 提示( OK) *
|
* 1.3 通过条码找到上一次该物料的库位, 作为推荐库位( OK)
|
* 注意: 如果勾选了“默认库位”, 且在上一次绑定的库位和当前界面显示的库位一致 , 则直接绑定库位, 不需要再扫描库位 *
|
|
* 2. 扫描库位条码 *
|
* 2.1 非库位条码, 提示( OK) *
|
* 2.2 非该仓库的库位, 提示( OK) *
|
*/
|
|
// 全局变量
|
var billNo = '';
|
var DH = '';
|
var i = 0; //计算扫描条码数量
|
var WLBM = "";//物料编码
|
var matterTable = null;
|
|
//初始化,默认焦点
|
mui.plusReady(function(){
|
app.init();
|
GetInfoGYS();
|
console.log("连接测试!");
|
//initBluetooth();
|
$('#info').height($(window).height()- $("#row001").height() - $("#div001").height()- $("#div002").height() - 70);
|
});
|
|
function GetInfoGYS() {
|
$.ajax({
|
url: app.API_URL_HEADER + "/WARBAB/GetInfoGYS",
|
|
DataType: "json",
|
type: "post",
|
async: false,
|
//timeout: 15000,
|
success: function(data) {
|
if (data.status == 0) {
|
|
var selectElementD = document.getElementById('GYS');
|
selectElementD.innerHTML = "";
|
matterTable = data.data.matterTable;
|
|
var option = document.createElement("option");
|
option.value = "";
|
option.text = "请选择客户";
|
selectElementD.appendChild(option);
|
|
for (var i = 0; i < matterTable.length; i++) {
|
var option = document.createElement("option");
|
option.value = matterTable[i]["DFA002"];
|
option.text = matterTable[i]["DFA002"];
|
selectElementD.appendChild(option);
|
}
|
|
} else {
|
|
alert("获取数据异常:" + response.message);
|
}
|
|
},
|
error: function(xhr, type, errorThrown) {
|
alert("获取数据异常:" + JSON.stringify(errorThrown));
|
}
|
});
|
|
}
|
|
function GetInfoDFA() {
|
$.ajax({
|
url: app.API_URL_HEADER + "/WARBAB/GetInfoDFA",
|
|
DataType: "json",
|
type: "post",
|
async: false,
|
data: {
|
GYS:$("#GYS").val(),
|
CX:$("#searchInput1").val()
|
},
|
//timeout: 15000,
|
success: function(data) {
|
if (data.status == 0) {
|
|
var selectElementD = document.getElementById('DFA001');
|
selectElementD.innerHTML = "";
|
matterTable = data.data.matterTable;
|
|
var option = document.createElement("option");
|
option.value = "";
|
option.text = "请选择发货通知单";
|
selectElementD.appendChild(option);
|
|
for (var i = 0; i < matterTable.length; i++) {
|
var option = document.createElement("option");
|
option.value = matterTable[i]["DFA001"];
|
option.text = matterTable[i]["DFA001"];
|
selectElementD.appendChild(option);
|
}
|
|
} else {
|
|
alert("获取数据异常:" + response.message);
|
}
|
|
},
|
error: function(xhr, type, errorThrown) {
|
alert("获取数据异常:" + JSON.stringify(errorThrown));
|
}
|
});
|
|
}
|
|
function GetInfoBarcode(){
|
console.log(1);
|
$.ajax({
|
url: app.API_URL_HEADER + "/WARBAB/GetBarcodeInfoHD",
|
|
DataType: "json",
|
type: "post",
|
async: false,
|
data: {
|
DFA001:$("#DFA001").val(),
|
ITEMNO:$("#ITEMNO").val()
|
},
|
//timeout: 15000,
|
success: function(data) {
|
if (data.status == 0) {
|
matterTable = data.data.matterTable;
|
populateTable(matterTable);
|
matterTableT = data.data.matterTableT;
|
$("#YSHJ").val(matterTableT[0]["hd004"]);
|
$("#SLHJ").val(matterTableT[0]["CKDD007"]);
|
} else {
|
|
alert("获取数据异常:" + data.message);
|
}
|
|
},
|
error: function(xhr, type, errorThrown) {
|
alert("获取数据异常:" + JSON.stringify(errorThrown));
|
}
|
});
|
}
|
|
function populateTable(data) {
|
|
console.log(data);
|
let tbody = document.querySelector("#myTable tbody");
|
|
// 清空表格内容
|
tbody.innerHTML = "";
|
|
// 循环遍历数据,生成表格行
|
for (let i = 0; i < data.length; i++) {
|
let tr = document.createElement("tr");
|
|
// 创建表格单元格,并将数据填入
|
let td1 = document.createElement("td");
|
td1.textContent = data[i]["CKDD002"];
|
tr.appendChild(td1);
|
|
let td2 = document.createElement("td");
|
td2.textContent = data[i]["CKDD009"];
|
tr.appendChild(td2);
|
|
let td3 = document.createElement("td");
|
td3.textContent = data[i]["CKDD011"];
|
tr.appendChild(td3);
|
|
let td4 = document.createElement("td");
|
td4.textContent = data[i]["CKDD007"];
|
tr.appendChild(td4);
|
|
let td5 = document.createElement("td");
|
td5.textContent = data[i]["isHD"];
|
tr.appendChild(td5);
|
|
tbody.appendChild(tr);
|
|
$(function() {
|
// 将标题行的背景颜色设置为灰色
|
$('tr:first-child th').css('background-color', 'gray');
|
|
// 遍历表格的每一行,除了标题行
|
$('tr').each(function() {
|
// 获取实盘数量单元格的值
|
var $cell = $(this).find('td:nth-child(5)');
|
var quantity = $cell.text();
|
// 判断实盘数量是否为0
|
if (quantity == "是") {
|
// 设置行的背景颜色为黄色
|
$(this).css('background-color', 'greenyellow');
|
}else
|
{
|
$(this).css('background-color', 'beige');
|
}
|
});
|
});
|
}
|
};
|
|
function GetInfoITEMNO() {
|
$.ajax({
|
url: app.API_URL_HEADER + "/WARBAB/GetInfoITEMNO",
|
|
DataType: "json",
|
type: "post",
|
async: false,
|
data: {
|
DFA001:$("#DFA001").val(),
|
},
|
//timeout: 15000,
|
success: function(data) {
|
if (data.status == 0) {
|
|
var selectElementD = document.getElementById('ITEMNO');
|
selectElementD.innerHTML = "";
|
|
matterTable = data.data.matterTable;
|
|
var option = document.createElement("option");
|
option.value = "";
|
option.text = "请选择物料编码";
|
selectElementD.appendChild(option);
|
|
for (var i = 0; i < matterTable.length; i++) {
|
var option = document.createElement("option");
|
option.value = matterTable[i]["DFB005"];
|
option.text = matterTable[i]["DFB005"];
|
selectElementD.appendChild(option);
|
}
|
|
} else {
|
|
alert("获取数据异常:" + data.message);
|
}
|
|
},
|
error: function(xhr, type, errorThrown) {
|
alert("获取数据异常:" + JSON.stringify(errorThrown));
|
}
|
});
|
|
}
|
|
function CheckBarInfo(){
|
|
if($("#DFA001").val() == ""){
|
alert("请选择发货通知单");
|
return ;
|
}
|
if($("#ITEMNO").val() == ""){
|
alert("请选择物料编码");
|
return ;
|
}
|
$.ajax({
|
url: app.API_URL_HEADER + "/WARBAB/CheckBarInfo",
|
|
DataType: "json",
|
type: "post",
|
async: false,
|
data: {
|
DFA001:$("#DFA001").val(),
|
ITEMNO:$("#ITEMNO").val(),
|
DAB001:$("#DAB001").val(),
|
},
|
//timeout: 15000,
|
success: function(data) {
|
if(data.status == 1){
|
$("#DAB001").val("");
|
GetInfoBarcode();
|
}
|
else{
|
alert("核对失败" + data.message);
|
$("#DAB001").val("");
|
}
|
},
|
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();
|
// }
|
//}
|