严智鑫
2025-11-13 945bc394f40d8af1072a53da9a94f24207124e6d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
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("任务错误");
            }
        }