index.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>华力机电SIMANC</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
  7. <meta name="apple-mobile-web-app-capable" content="yes">
  8. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  9. <!--标准mui.css-->
  10. <link rel="stylesheet" type="text/css" href="css/mui.min.css">
  11. <!--App自定义的css-->
  12. <link rel="stylesheet" type="text/css" href="css/app.css" />
  13. <style>
  14. .mui-btn-block {
  15. margin-bottom: 0;
  16. }
  17. .mui-content-padded {
  18. margin: 2px;
  19. }
  20. .mui-col {
  21. display: inline-block;
  22. padding: 2px;
  23. }
  24. /*滚动条样式*/
  25. ::-webkit-scrollbar {
  26. width: 10px;
  27. background-color: #F5F5F5;
  28. }
  29. /*定义滚动条轨道 内阴影+圆角*/
  30. ::-webkit-scrollbar-track {
  31. background-color: #103643;
  32. }
  33. /*定义滑块 内阴影+圆角*/
  34. ::-webkit-scrollbar-thumb {
  35. background-color: #0b6d78;
  36. }
  37. .mui-btn-royal {
  38. background-color: rgba(141, 157, 199, 0.5);
  39. border: 1px solid rgba(141, 157, 199, 0.5)
  40. }
  41. .active {
  42. background-color: #d4d4d4;
  43. color: white;
  44. }
  45. .up {
  46. background: #0087c5 url(img/top.svg) no-repeat 50% 10%;
  47. }
  48. .down {
  49. background: #0087c5 url(img/bottom.svg) no-repeat 50% 10%;
  50. }
  51. .text-success {
  52. color: #27c24c
  53. }
  54. .mui-col-xs-3 {
  55. width: 23%;
  56. }
  57. .mui-col-xs-2 {
  58. width: 23%;
  59. }
  60. </style>
  61. </head>
  62. <body style="background: url(img/bg.png) no-repeat 0px 0px">
  63. <div class="mui-content" style="background: #2e3342;background-color: rgba(255,255,255,0)">
  64. <div class="mui-content-padded">
  65. <div class="mui-row">
  66. <div class="mui-col mui-col-xs-12">
  67. <span id="agvstatus" style="position: fixed;">·</span>
  68. <div id="title" style="text-align: center;padding-bottom: 2px;background: url(img/title_bg.png) no-repeat 0 7px;background-size:100%;">
  69. <a style="color: #FFFFFF;font-size: 20px;">华力西曼克</a>
  70. </div>
  71. </div>
  72. <div class="mui-col mui-col-xs-12" id="btt" style="min-height:480px;overflow-y:auto;max-height:480px">
  73. <div class="mui-col mui-col-xs-12" style="height: 235px;text-align: center;background: url(img/top_bg2.png) no-repeat 0 0;background-size:100%;">
  74. <div class="mui-col mui-col-xs-12" style="padding-top: 10px;height: 30px;">
  75. <div style=" width: 50%;float: left;">
  76. <img id="speed" src="" style="margin-left: -80px;width: 13%;">
  77. </div>
  78. <div style=" width: 50%;float: left;">
  79. <img id="battery" src="img/battery-100.png" style="margin-right: -80px;width: 23%;">
  80. </div>
  81. </div>
  82. <div class="mui-col mui-col-xs-12" style="margin-top: -5px;">
  83. <div id="tgts" style="width: 120px;height:90px;border-radius: 12px;border: 2px solid #298890;float: left;margin-left: 23px;">
  84. <div style="margin-left: -60px;margin-top: 15px;">
  85. <a style="color: #FFFFFF;font-size: 18px;">目标</a><br>
  86. </div>
  87. <div style="margin-left: -60px;margin-top: 10px;">
  88. <a style="color: #FFFFFF;font-size: 18px;">站点</a><br>
  89. </div>
  90. <div style="margin-left: 40px;margin-top: -35px;">
  91. <a id="tgtstation" style="color: #FFFFFF;font-size: 50px;"></a><br>
  92. </div>
  93. </div>
  94. <div id="jack" style="width: 120px;height:90px;border-radius: 12px;border: 2px solid #298890;float: right;margin-right: 20px;">
  95. <div style="margin-left: -60px;margin-top: 15px;">
  96. <a style="color: #FFFFFF;font-size: 18px;">顶升</a><br>
  97. </div>
  98. <div style="margin-left: -60px;margin-top: 10px;">
  99. <a style="color: #FFFFFF;font-size: 18px;">状态</a><br>
  100. </div>
  101. <div style="margin-left: 50px;margin-top: -53px;">
  102. <img id="liftstatus" src="img/liftstatus.png" width="60%">
  103. </div>
  104. </div>
  105. </div>
  106. <div class="mui-col mui-col-xs-12" style="height: 40px;padding-left: 15px;margin-top: -5px;">
  107. <div id="stop" style="width: 30%;height: 40px;line-height:40px;float: left;margin-left: 5px;background: url(img/btn4_bg.png);color: #FFFFFF;text-align: center;">停止</div>
  108. <div id="run" style="width: 30%;height: 40px;line-height:40px;float: left;margin-left: 5px;background: url(img/btn4_bg.png);color: #FFFFFF;text-align: center;">运行</div>
  109. <div id="warning" style="width: 30%;height: 40px;line-height:40px;float: left;margin-left: 5px;background: url(img/btn4_bg.png);color: #FFFFFF;text-align: center;">注意</div>
  110. </div>
  111. <div class="mui-col mui-col-xs-12">
  112. <div id="info" style="width: 89%;height: 35px;margin-left: 19px;color:#fff;font-size:15px;line-height: 30px;background-color: #0b6d78;border-radius: 3px;text-align: center;padding-left: 5px;"></div>
  113. </div>
  114. </div>
  115. <div class="mui-col mui-col-xs-12" style="margin-top: -5px;">
  116. <div id="btlist" style="padding-left: 15px;height:190px">
  117. <div class="mui-col mui-col-xs-2 client"><button type="button" class="mui-btn mui-btn-royal mui-btn-block" name="stbtn" id="1" value="1">c1</button></div>
  118. <div class="mui-col mui-col-xs-2 client"><button type="button" class="mui-btn mui-btn-royal mui-btn-block" name="stbtn" id="2" value="2">c2</button></div>
  119. <div class="mui-col mui-col-xs-2 client"><button type="button" class="mui-btn mui-btn-royal mui-btn-block" name="stbtn" id="3" value="3">c3</button></div>
  120. <div class="mui-col mui-col-xs-2 client"><button type="button" class="mui-btn mui-btn-royal mui-btn-block" name="stbtn" id="4" value="4">c4</button></div>
  121. <div class="mui-col mui-col-xs-2 client"><button type="button" class="mui-btn mui-btn-royal mui-btn-block" name="stbtn" id="5" value="5">c5</button></div>
  122. <div class="mui-col mui-col-xs-2 client"><button type="button" class="mui-btn mui-btn-royal mui-btn-block" name="stbtn" id="6" value="6">c6</button></div>
  123. <div class="mui-col mui-col-xs-2 client"><button type="button" class="mui-btn mui-btn-royal mui-btn-block" name="stbtn" id="7" value="7">c7</button></div>
  124. <div class="mui-col mui-col-xs-2 client"><button type="button" class="mui-btn mui-btn-royal mui-btn-block" name="stbtn" id="8" value="8">c8</button></div>
  125. </div>
  126. </div>
  127. </div>
  128. <div class="mui-col mui-col-xs-12" style="text-align:center;margin-top: 10px;">
  129. <div class="mui-col mui-col-xs-2">
  130. <a href="settings.html" style="color: #9fb3b4;"><span class="mui-icon mui-icon-settings"></span></a>
  131. </div>
  132. <div class="mui-col mui-col-xs-3" id="gomoving">
  133. <button type="button" class="mui-btn mui-btn-royal mui-btn-block operation" id="moving" style="border:1px solid #4a5a6a;">移动</button>
  134. </div>
  135. <div class="mui-col mui-col-xs-3" id="gostart">
  136. <button type="button" class="mui-btn mui-btn-royal mui-btn-block operation" id="start" style="border:1px solid #4a5a6a;">搬运</button>
  137. </div>
  138. <div class="mui-col mui-col-xs-3" id="gostart_client">
  139. <button type="button" class="mui-btn mui-btn-royal mui-btn-block operation" id="start_client" style="border:1px solid #4a5a6a;">client</button>
  140. </div>
  141. <div class="mui-col mui-col-xs-3">
  142. <button type="button" class="mui-btn mui-btn-royal mui-btn-block operation" id="cancel" style="border:1px solid #4a5a6a;">取消</button>
  143. </div>
  144. <div class="mui-col mui-col-xs-2" id="task_list">
  145. <a href="tasklist.html" style="color: #9fb3b4;"><span class="mui-icon mui-icon-bars"></span></a>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. </body>
  152. <script src="js/jquery.min.js"></script>
  153. <script src="js/mui.min.js"></script>
  154. <script src="js/lodash.js"></script>
  155. <script src="js/msg.js"></script>
  156. <script src="js/Sortable.min.js"></script>
  157. <script src="js/mui.js"></script>
  158. <script src="js/jquery.min.js"></script>
  159. <script src="js/mui.min.js"></script>
  160. <script type="text/javascript">
  161. var $btlist = $('#btlist');
  162. $(function() {
  163. //查询所选模式(service、client)
  164. workmode = localStorage.getItem("workmode");
  165. SetConfig()
  166. //获取按钮
  167. //获取状态
  168. if(workmode == "service"){
  169. createList();
  170. startLog();
  171. setInterval(function() {
  172. if (ws.readyState === 3) {
  173. startLog();
  174. }
  175. }, 1000);
  176. }
  177. //注册按钮点击事件click touchstart
  178. $("button[name]").on("touchstart", onSelectStation);
  179. //设置操作按钮
  180. $("#gostart").addClass("mui-hidden");
  181. $("#gostart_client").addClass("mui-hidden");
  182. $("#moving").attr("disabled", true);
  183. $("#start").attr("disabled", true);
  184. $("#start_client").attr("disabled", true);
  185. $('#cancel').attr("disabled", true);
  186. })
  187. //按钮点击事件
  188. function SetConfig() {
  189. //获取保存的ip、agvid、mapid等,如果没有数据,则设置为默认
  190. if (localStorage.getItem("ip") == "" || localStorage.getItem("ip") == null) {
  191. ip = "192.168.1.92:8888";
  192. url = "http://192.168.1.92:8888"
  193. posturl = "http://192.168.1.92:8899"
  194. } else {
  195. ip = localStorage.getItem("ip") + ":8888";
  196. url = "http://" + localStorage.getItem("ip") + ":8888";
  197. posturl = "http://" + localStorage.getItem("ip") + ":8899";
  198. }
  199. if (localStorage.getItem("agvid") == "" || localStorage.getItem("agvid") == null) {
  200. agvid = 1;
  201. } else {
  202. agvid = parseInt(localStorage.getItem("agvid"))
  203. }
  204. if (localStorage.getItem("mapid") == "" || localStorage.getItem("mapid") == null) {
  205. mapid = "2020032608412704";
  206. } else {
  207. mapid = localStorage.getItem("mapid")
  208. }
  209. workmode = localStorage.getItem("workmode");
  210. if (workmode == "client") {
  211. $("#gostart").addClass("mui-hidden")
  212. $("#gostart_client").removeClass("mui-hidden")
  213. } else {
  214. $("#gostart_client").addClass("mui-hidden")
  215. $("#gostart").removeClass("mui-hidden")
  216. }
  217. }
  218. function onSelectStation(evt) {
  219. var $this = $(this);
  220. if ($("div[id='btlist']").is(':active')) {
  221. $this.removeClass('active');
  222. } else {
  223. $this.addClass('active');
  224. }
  225. if ($("div[id='btlist']").find(".active").length == 1) {
  226. $("#moving").attr("disabled", false);
  227. $this.addClass('up');
  228. //$("#start").removeAttr("disabled");
  229. $("#cancel").removeAttr("disabled");
  230. } else if ($("div[id='btlist']").find(".active").length == 2) {
  231. $("#gomoving").addClass("mui-hidden");
  232. SetConfig();
  233. $this.addClass('down');
  234. $('#start').attr("disabled", false);
  235. $("#start_client").attr("disabled", false);
  236. $("#handling").removeAttr("disabled");
  237. $("#cancel").removeAttr("disabled");
  238. }
  239. if ($("div[id='btlist']").find(".active").length >= 2) {
  240. $("button[name='stbtn']").css("pointer-events", "none")
  241. } else {
  242. $("button[name='stbtn']").css("pointer-events", "auto")
  243. }
  244. };
  245. //取消按钮操作
  246. function Reset(evt) {
  247. if ($("div[id='btlist']").find(".active")) {
  248. $("#gostart").addClass("mui-hidden");
  249. $("#gomoving").removeClass("mui-hidden");
  250. $("button[name='stbtn']").removeClass('up');
  251. $("button[name='stbtn']").removeClass('down');
  252. $("button[name='stbtn']").removeClass('active');
  253. $("button[name='stbtn']").css("pointer-events", "auto");
  254. $('#start').attr("disabled", true);
  255. $('#start_client').attr("disabled", true);
  256. $('#cancel').attr("disabled", true);
  257. $('#moving').attr("disabled", true);
  258. if (localStorage.getItem("workmode") == "client") {
  259. $("#gomoving").removeClass("mui-hidden");
  260. $("#gostart").addClass("mui-hidden")
  261. $("#gostart_client").addClass("mui-hidden")
  262. } else {
  263. $("#gostart_client").addClass("mui-hidden")
  264. $("#gostart").addClass("mui-hidden")
  265. }
  266. }
  267. }
  268. //移动按钮
  269. $("#moving").click(function() {
  270. let to;
  271. $("div[id='btlist']").find(".up").each(function(evt) {
  272. to = parseInt(($(this).context).id);
  273. });
  274. if(workmode == "service"){
  275. SendCmd(agvid, msgTypeToStation, {
  276. "Stn": to
  277. }, function(d) {
  278. mui.toast("任务发送成功...")
  279. Reset()
  280. })
  281. }
  282. if(workmode == "client"){
  283. var bt_value = [];
  284. $("div[id='btlist']").find(".up").each(function(evt) {
  285. bt_value.push($(this).val());
  286. });
  287. id = Math.round(new Date().getTime()/1000).toString();
  288. var s = parseInt(bt_value[0])
  289. var d = parseInt(bt_value[0])
  290. var strone = {
  291. "t": "AddTsk",
  292. "id": id,
  293. "s": s,
  294. "d": d
  295. }
  296. var ss = JSON.stringify(strone)
  297. $.post(posturl, ss);
  298. mui.toast("任务发送成功...")
  299. Reset()
  300. }
  301. });
  302. //搬运按钮
  303. $("#start").click(function() {
  304. var bt_value = [];
  305. $("div[id='btlist']").find(".up").each(function(evt) {
  306. bt_value.push($(this).val());
  307. });
  308. $("div[id='btlist']").find(".down").each(function(evt) {
  309. bt_value.push($(this).val());
  310. });
  311. AddTransTask(agvid, bt_value[0], bt_value[1], function(d) {
  312. if (d == "ok"){
  313. mui.toast("任务发送成功...")
  314. } else {
  315. mui.toast("任务发送失败...")
  316. }
  317. Reset()
  318. })
  319. });
  320. //客户端搬运按钮
  321. $("#start_client").on("click", function() {
  322. var bt_value = [];
  323. $("div[id='btlist']").find(".up").each(function(evt) {
  324. bt_value.push($(this).val());
  325. });
  326. $("div[id='btlist']").find(".down").each(function(evt) {
  327. bt_value.push($(this).val());
  328. });
  329. id = Math.round(new Date().getTime()/1000).toString();
  330. var s = parseInt(bt_value[0])
  331. var d = parseInt(bt_value[1])
  332. var strone = {
  333. "t": "AddTsk",
  334. "id": id,
  335. "s": s,
  336. "d": d
  337. }
  338. var ss = JSON.stringify(strone)
  339. $.post(posturl, ss);
  340. mui.toast("任务发送成功...")
  341. Reset()
  342. });
  343. function AddTransTask(agvid, from, to, callback) {
  344. $.post(url + "/task", {
  345. id: agvid,
  346. from: from,
  347. to: to
  348. }, callback);
  349. };
  350. function SendCmd(agvid, cmd, opt, func) {
  351. let param = {
  352. "t": cmd
  353. };
  354. opt = _.extend(param, opt);
  355. //console.log("param", opt);
  356. $.post(url + "/agv/SendString/" + agvid,
  357. JSON.stringify(opt),
  358. func
  359. );
  360. }
  361. //取消按钮
  362. $("#cancel").on("click", Reset);
  363. //填充按钮列表
  364. function createList() {
  365. $.get(url + "/map/getStations/" + mapid, function(data) {
  366. IDARR = localStorage.getItem(mapid+agvid+"ARR");
  367. trs = "";
  368. if(IDARR == "" ||IDARR == undefined){
  369. ARRS = [];
  370. for (i in data) {
  371. if (data[i].Name != "" && data[i].Name != "rect") {
  372. var ids = data[i].Id - (agvid * 100)
  373. ARRS.push(parseInt(data[i].Id));
  374. trs += '<div class="mui-col mui-col-xs-3" drag-id="'+ids+'">' +
  375. '<button type="button" class="mui-btn mui-btn-royal mui-btn-block" name="stbtn" id="' + ids +
  376. '" value="' + ids + '">' +
  377. data[i].Name + '</button></div>'
  378. }
  379. }
  380. ARR = ARRS.join(",");
  381. localStorage.setItem(mapid + agvid + 'ARR', ARR);
  382. } else {
  383. arr = IDARR.split(",");// 在每个逗号(,)处进行分解。
  384. var id_arr = arr.sort(function(a, b){return a - b});//按从小到大排序
  385. for (x in id_arr) {
  386. for (i in data) {
  387. if((data[i].Name != "") && data[i].Name != "rect"){
  388. var ids = data[i].Id - (agvid * 100)
  389. if ((data[i].Id == id_arr[x])) {
  390. trs += '<div class="mui-col mui-col-xs-3" drag-id="'+ids+'">' +
  391. '<button type="button" class="mui-btn mui-btn-royal mui-btn-block" name="stbtn" id="' + ids +
  392. '" value="' + ids + '">' +
  393. data[i].Name + '</button></div>'
  394. }
  395. }
  396. }
  397. }
  398. }
  399. if (localStorage.getItem("workmode") == "client") {
  400. $(".client").removeClass("mui-hidden")
  401. } else {
  402. $(".client").addClass("mui-hidden")
  403. $btlist.append(trs);
  404. }
  405. //注册按钮点击事件click touchstart
  406. $("button[name]").on("touchstart", onSelectStation);
  407. })
  408. }
  409. //新建ws连接,获取agv的状态
  410. let ws;
  411. function startLog() {
  412. ws = new WebSocket("ws://" + ip + "/ws/msg/" + agvid);
  413. ws.onmessage = function(e) {
  414. let result;
  415. let msg = JSON.parse(e.data);
  416. switch (msg.type) {
  417. case msgTypeStatus:
  418. // 每秒一次状态
  419. let stMap = JSON.parse(msg.data);
  420. //根据状态设置图标等
  421. showStatusValue(stMap);
  422. //当前站点按钮文字闪烁
  423. if (agvid == msg.id) {
  424. let stMap = JSON.parse(msg.data);
  425. $("#agvstatus").toggleClass("text-success");
  426. $(".mui-btn").removeClass("text-success");
  427. $("#" + stMap.Station + "").addClass("text-success");
  428. }
  429. break;
  430. //读取设置状态,可以获得电池伏数
  431. case msgTypeGetCfg:
  432. //console.log(msg.type, msg.data);
  433. break;
  434. default:
  435. //console.log(msg.type, msg.data);
  436. }
  437. };
  438. }
  439. //根据获取到的agv状态,设置速度、电量、站点、顶升、提示信息、运行按钮等的颜色和文字显示
  440. function showStatusValue(status) {
  441. for (let k in status) {
  442. let v = status[k];
  443. //电量显示
  444. if (k == "BatteryVolt") {
  445. if (v >= 5200) { //BatteryVoltFull
  446. document.getElementById("battery").src = "img/battery-100.png";
  447. }
  448. if (5000 <= v && v < 5200) { //BatteryVoltHigh
  449. document.getElementById("battery").src = "img/battery-80.png";
  450. }
  451. if (4800 <= v && v < 5000) { //BatteryVoltMid
  452. document.getElementById("battery").src = "img/battery-60.png";
  453. }
  454. if (4700 <= v && v < 4800) { //BatteryVoltLow
  455. document.getElementById("battery").src = "img/battery-40.png";
  456. }
  457. if (4500 <= v && v < 4700) { //BatteryVoltWarn
  458. document.getElementById("battery").src = "img/battery-20.png";
  459. }
  460. if (v <= 4500) { //BatteryVoltStop
  461. document.getElementById("battery").src = "img/battery-0.png";
  462. }
  463. }
  464. //目标站点
  465. if (k == "TgtStation") {
  466. if (v == "65535") {
  467. $("#tgtstation").text("0");
  468. } else {
  469. $("#tgtstation").text(v);
  470. }
  471. }
  472. //顶升状态
  473. if (k == "LiftStatus") {
  474. if (v == 1 || v == 3 || v == 5 || v == 7) {
  475. document.getElementById("liftstatus").src = "img/liftstatus-up.png";
  476. } else if (v == 0) {
  477. document.getElementById("liftstatus").src = "img/liftstatus.png";
  478. } else {
  479. if (status.Status == "1") {
  480. document.getElementById("liftstatus").src = "img/liftstatus.png";
  481. } else {
  482. document.getElementById("liftstatus").src = "img/liftstatus-down.png";
  483. }
  484. }
  485. }
  486. //停止运行注意按钮及信息提示框
  487. if (k == "Status") {
  488. document.getElementById("speed").src = "";
  489. if (v == 0) {
  490. $("#info").text("未设置");
  491. }
  492. if (v == 1) {
  493. $("#info").text("就绪");
  494. }
  495. if (v == 2) {
  496. $("#info").text("运行");
  497. document.getElementById("speed").src = "img/speed-high.png";
  498. document.getElementById("run").style.backgroundImage = "url('img/btn2_bg.png')";
  499. } else {
  500. document.getElementById("run").style.backgroundImage = "url('img/btn4_bg.png')";
  501. }
  502. if (v == 3 || v == 4 ||(v == 5)) {
  503. if (v == 3) {
  504. $("#info").text("停止");
  505. }
  506. if (v == 4) {
  507. $("#info").text("急停");
  508. }
  509. if (v == 5) {
  510. $("#info").text("刹车");
  511. }
  512. document.getElementById("stop").style.backgroundImage = "url('img/btn3_bg.png')";
  513. } else {
  514. document.getElementById("stop").style.backgroundImage = "url('img/btn4_bg.png')";
  515. }
  516. if (v == 6) {
  517. $("#info").text("驱动器错误");
  518. }
  519. if (v == 7) {
  520. $("#info").text("导航错误");
  521. }
  522. if (v == 8) {
  523. $("#info").text("任务错误");
  524. }
  525. if (v == 9) {
  526. document.getElementById("speed").src = "img/speed-medium.png";
  527. $("#info").text("手动控制");
  528. }
  529. if (v == 11 || v == 22) {
  530. if (v == 11) {
  531. document.getElementById("speed").src = "img/speed-medium.png";
  532. $("#info").text("前方障碍");
  533. }
  534. if (v == 22) {
  535. document.getElementById("speed").src = "img/speed-medium.png";
  536. $("#info").text("障碍减速");
  537. }
  538. document.getElementById("warning").style.backgroundImage = "url('img/btn1_bg.png')";
  539. } else {
  540. document.getElementById("warning").style.backgroundImage = "url('img/btn4_bg.png')";
  541. }
  542. if (v == 12) {
  543. $("#info").text("防撞停止");
  544. }
  545. if (v == 15) {
  546. $("#info").text("低电压停止");
  547. }
  548. if (v == 21) {
  549. $("#info").text("低电压运行");
  550. }
  551. if (v == 31) {
  552. $("#info").text("前磁导脱线");
  553. }
  554. if (v == 32) {
  555. $("#info").text("后磁导脱线");
  556. }
  557. if (v == 33) {
  558. $("#info").text("左磁导脱线");
  559. }
  560. if (v == 34) {
  561. $("#info").text("右磁导脱线");
  562. }
  563. if (v == 71) {
  564. $("#info").text("取货失败1");
  565. }
  566. if (v == 72) {
  567. $("#info").text("取货失败2");
  568. }
  569. if (v == 73) {
  570. $("#info").text("放货失败");
  571. }
  572. }
  573. }
  574. if (status.Status == "9" && status.FWlkRpm != "0") {
  575. document.getElementById("run").style.backgroundImage = "url('img/btn2_bg.png')";
  576. document.getElementById("stop").style.backgroundImage = "url('img/btn4_bg.png')";
  577. }
  578. if (status.Status == "9" && status.FWlkRpm == "0") {
  579. document.getElementById("run").style.backgroundImage = "url('img/btn4_bg.png')";
  580. document.getElementById("stop").style.backgroundImage = "url('img/btn3_bg.png')";
  581. }
  582. };
  583. $(function() {
  584. if(workmode == "service"){
  585. GetTransTask(agvid, function (d) {
  586. console.log("GetTransTask: ", d)
  587. });
  588. }
  589. })
  590. function GetTransTask(agvid, callback) {
  591. $.post(url + "/task/get", {
  592. id: agvid,
  593. }, callback);
  594. }
  595. </script>
  596. </html>