var num3 = 0;//穿梭车的位置
|
var num4 = 0;//起始位置
|
var num5 = 0;//终点位置
|
var one = true;//用于判断第一个if进去没有
|
var two = false;//用于判断是否有任务
|
var begintime = 0;
|
var begintime1 = 0;
|
var isbeign = false;
|
var isbeign1 = false;
|
|
|
var size = "";
|
var rankid = "";
|
var loadid = "";
|
var tasktype = "";
|
|
|
var set1 = null;
|
function startMove() {
|
clearInterval(set1);
|
set1 = setInterval('change1()', 100);
|
|
|
}
|
|
|
//1.定时器(time,1)
|
//2.time( 查看是否有任务)
|
//3-1.有任务 change1 传递参数
|
//3-1-1.找到当前车位置
|
//3-1-2.
|
//3-2.无任务不操作
|
function change1() {
|
var img = document.getElementById('div1');
|
var imgs = document.getElementById('divss');
|
var img1 = document.getElementById('div1s');
|
var number = 1;
|
|
if (two) {
|
|
if (one) {
|
|
if (num4 < num3) {
|
number = -1;
|
}
|
|
if (num4 == num3) {
|
|
if (!isbeign) {// !isbeign=false
|
begintime = new Date().getTime();
|
isbeign = true;
|
} else {
|
var cha = new Date().getTime() - begintime;
|
if (cha > 20000) {
|
for (var i = 0; i <= 104; i++) {
|
var a1 = document.getElementById("divs" + i + "");
|
if (a1 == null) {
|
continue;
|
}
|
var vluess = a1.getAttribute("value");
|
var b1 = a1.offsetTop;
|
if (b1 == num3) {
|
for (var j = 1; j <= 104; j++) {
|
var a2 = document.getElementById("qaz" + j + "");
|
var a3 = document.getElementById("plm" + j + "");
|
if (a2 == null || a3 == null) {
|
continue;
|
}
|
var style1 = a2.getAttribute("style");
|
var style2 = a3.getAttribute("style");
|
var vluess1 = a2.getAttribute("value");
|
if (vluess1 == vluess) {
|
if (vluess1 < 100) {
|
$.ajax({
|
url: contextPath + "/shelfmanager/updateshelfrank?Ids=" + vluess1,
|
async: true,
|
type: "GET",
|
dataType: "json",
|
cache: false,
|
success: function (data) {
|
var obj = eval(data);
|
if (obj.code == 1) {
|
imgs.style = style1;
|
img1.style = style2;
|
imgs.style.width = "70px";
|
img1.style.width = a3.style.width;
|
a3.style.backgroundColor = "white";
|
a2.style.backgroundColor = "white";
|
img.style.top = num3 + "px";
|
|
|
}
|
else {
|
alert("出库失败");
|
}
|
|
},
|
error: function (data) {
|
alert("请求异常");
|
}
|
});
|
} else {
|
imgs.style.backgroundColor = "gray";
|
img1.style = style2;
|
a3.style.backgroundColor = "white";
|
a2.style.backgroundColor = "white";
|
img.style.top = num3 + "px";
|
}
|
|
|
break;
|
}
|
|
}
|
break;
|
}
|
isbeign = false;
|
one = false;
|
begintime = 0;
|
}
|
}
|
}
|
|
} else {
|
|
img.style.top = num3 + "px";
|
num3 = num3 + number;
|
return;
|
}
|
}
|
|
if (num5 < num3) {
|
number = -1;
|
}
|
|
|
if (num5 == num3) {
|
if (!isbeign1) {
|
begintime1 = new Date().getTime();
|
isbeign1 = true;
|
} else {
|
var cha1 = new Date().getTime() - begintime1;
|
if (cha1 > 20000) {
|
for (var i = 0; i <= 104; i++) {
|
var a1 = document.getElementById("divs" + i + "");
|
if (a1 == null) {
|
continue;
|
}
|
var vluess = a1.getAttribute("value");
|
var b1 = a1.offsetTop;
|
if (b1 == num3) {
|
for (var j = 1; j <= 104; j++) {
|
var a2 = document.getElementById("qaz" + j + "");
|
var a3 = document.getElementById("plm" + j + "");
|
if (a2 == null || a3 == null) {
|
continue;
|
}
|
var vluess1 = a2.getAttribute("value");
|
if (vluess1 == vluess) {
|
if (vluess1 > 57) {
|
a2.style.backgroundColor = "gray";
|
a3.style = img1.style;
|
a3.style.width = img1.style.width;
|
imgs.style.backgroundColor = "white";
|
img1.style.backgroundColor = "white";
|
img.style.top = num3 + "px";
|
break;
|
} else {
|
a2.style.backgroundColor = "gray";
|
a3.style.backgroundColor = img1.style.backgroundColor;
|
a3.style.width = img1.style.width;
|
imgs.style.backgroundColor = "white";
|
img1.style.backgroundColor = "white";
|
img.style.top = num3 + "px";
|
break;
|
}
|
|
}
|
|
}
|
break;
|
}
|
|
|
}
|
one = true;
|
two = false;
|
isbeign1 = false;
|
begintime1 = 0;
|
clearInterval(set1);
|
bge = setInterval("shelf()", "1000");
|
}
|
}
|
|
} else {
|
var img = document.getElementById('div1');
|
img.style.top = num3 + "px";
|
num3 = num3 + number;
|
return;
|
}
|
}
|
|
|
}
|
|
function shelf() {
|
$.ajax({
|
url: contextPath + "/shelfmanager/datashelftask",
|
async: true,
|
type: "GET",
|
cache: false,
|
success: function (data) {
|
|
if (data.size == "1") {
|
size = data.size;
|
rankid = (data.shelfRankId).toString();
|
loadid = (data.loadMachineRackId).toString();
|
tasktype = data.tackType;
|
|
two = true;
|
bge = window.clearInterval(bge);
|
panduan();
|
}
|
|
},
|
error: function (data) {
|
alert("请求异常");
|
}
|
});
|
}
|
|
|
|
|
|
function panduan() {
|
var img = document.getElementById('div1');
|
num3 = img.offsetTop;
|
|
if (tasktype == "从仓位到上片位") {
|
for (var i = 1; i <= 104; i++) {
|
var a1 = document.getElementById("divs" + i + "");
|
if (a1 == null) {
|
continue;
|
}
|
var vluess = a1.getAttribute("value");
|
if (vluess == rankid) {
|
num4 = parseInt(a1.style.top);
|
break;
|
}
|
|
}
|
for (var i = 1; i <= 104; i++) {
|
var a1 = document.getElementById("divs" + i + "");
|
if (a1 == null) {
|
continue;
|
}
|
var vluess = a1.getAttribute("value");
|
if (vluess == loadid) {
|
num5 = parseInt(a1.style.top);
|
break;
|
}
|
}
|
|
startMove();
|
} else if (tasktype == "从上片位到仓位") {
|
for (var i = 1; i <= 104; i++) {
|
var a1 = document.getElementById("divs" + i + "");
|
if (a1 == null) {
|
continue;
|
}
|
var vluess = a1.getAttribute("value");
|
if (vluess == rankid) {
|
num5 = parseInt(a1.style.top);
|
break;
|
}
|
|
}
|
for (var i = 1; i <= 104; i++) {
|
var a1 = document.getElementById("divs" + i + "");
|
if (a1 == null) {
|
continue;
|
}
|
var vluess = a1.getAttribute("value");
|
if (vluess == loadid) {
|
num4 = parseInt(a1.style.top);
|
break;
|
}
|
|
}
|
|
startMove();
|
} else {
|
alert("任务错误");
|
}
|
}
|