Przeglądaj źródła

加缓存工位

wcs 4 lat temu
rodzic
commit
40b3064ea4
2 zmienionych plików z 25 dodań i 47 usunięć
  1. 13 38
      index.html
  2. 12 9
      settings.html

+ 13 - 38
index.html

@@ -152,10 +152,6 @@
 									<button type="button" class="mui-btn mui-btn-primary mui-btn-block mui-hidden"
 										id="Call"></button>
 								</div>
-								<div id="Caches" class="mui-col mui-col-xs-12 client mui-hidden" style="padding-top:10px">
-									<button type="button" class="mui-btn mui-btn-primary mui-btn-block"
-										id="Cache">缓存工位</button>
-								</div>
 								<div class="mui-col mui-col-xs-12 client" style="padding-top:10px">
 									<button type="button" class="mui-btn mui-btn-success mui-btn-block mui-hidden"
 										id="Finish">完成</button>
@@ -205,12 +201,6 @@
 				site = localStorage.getItem("site");
 				$("#Call").removeClass("mui-hidden");
 				$("#Call").html(site);
-				if (site == "下料工位") {
-					// 缓存工位按钮
-					$("#Caches").removeClass("mui-hidden")
-				} else {
-					$("#Caches").addClass("mui-hidden")
-				}
 			}
 			AcceptId = localStorage.getItem("AcceptId")
 			$("#Finish").attr("disabled", true);
@@ -227,35 +217,15 @@
 			DoneTermTask(agvid, AcceptId, function(d) {
 				if (d == "ok") {
 					mui.toast("任务发送成功...")
+				} else if (d == "lock") {
+					mui.toast("任务执行中,请稍后重试...")
 				} else {
-					if (d == "") {
-						if (msgAcceptId === AcceptId) {
-							mui.toast("当前工位任务执行中...")
-						}
-						if (msgAcceptId == (AcceptId - 1)) {
-							mui.toast("前序工位任务执行中...")
-						}
-					}
 					mui.toast("请稍后重试...")
 				}
 			})
 		})
-
-		//缓存工位
-		$("#Cache").click(function() {
-			let from, to;
-			from = 3;
-			to = 4;
-			AddTermTask(agvid, AcceptId, from, to, function(d) {
-				if (d == "ok") {
-					mui.toast("任务发送成功...")
-				} else {
-					mui.toast("请稍后重试...")
-				}
-			})
-		});
-
-		//上下箱工位、清扫工位、下料工位
+		
+		//上下箱工位、清扫工位、下料工位、缓存工位
 		$("#Call").click(function() {
 			let from, to;
 			if (site === "上下箱工位") {
@@ -270,11 +240,16 @@
 				from = 2;
 				to = 3;
 			}
+			if (site === "缓存工位") {
+				from = 3;
+				to = 4;
+			}
 			AddTermTask(agvid, AcceptId, from, to, function(d) {
 				if (d == "ok") {
 					mui.toast("任务发送成功...")
+				} else if (d == "lock") {
+					mui.toast("任务执行中,请稍后重试...")
 				} else {
-
 					mui.toast("请稍后重试...")
 				}
 			})
@@ -324,12 +299,12 @@
 							$("#Finish").attr("disabled", true);
 						}
 						if ((msgAcceptId == 1 && AcceptId == 2) || (msgAcceptId == 2 && AcceptId == 3) || (msgAcceptId ==
-								3 && AcceptId == 1)) {
+								3 && AcceptId == 4) || (msgAcceptId == 4 && AcceptId == 1)) {
 							$("#status").html("工作中", +msgAcceptId);
-							document.getElementById("workstatus").style.backgroundColor = "red"; // "#9C9C9C" ;// ;
+							document.getElementById("workstatus").style.backgroundColor = "red"; // "#9C9C9C" ;
 						} else {
 							$("#status").html("未工作");
-							document.getElementById("workstatus").style.backgroundColor = "green"; // "#9C9C9C" ;//
+							document.getElementById("workstatus").style.backgroundColor = "green"; // "#9C9C9C" ;
 						}
 						break;
 						//读取设置状态,可以获得电池伏数

+ 12 - 9
settings.html

@@ -93,7 +93,6 @@
 			</div>
 		</div>
 	</body>
-	<script src="js/mui.js"></script>
 	<script src="js/jquery.min.js"></script>
 	<script src="js/mui.min.js"></script>
 	<script>
@@ -111,13 +110,14 @@
 				$("#site").val(localStorage.getItem("site"));
 			}
 		})
-		 function tips() {
-			mui.toast("工位只能填写上下箱工位、清扫工位、下料工位")
-		 }
-		document.getElementById('site').onchange = function () {
+
+		function tips() {
+			mui.toast("工位只能填写上下箱工位、清扫工位、下料工位、缓存工位")
+		}
+		document.getElementById('site').onchange = function() {
 			var site = $("#site").val();
-			if(site !== "上下箱工位" &&site !== "清扫工位" &&site !== "下料工位"){
-				mui.toast("工位只能填写上下箱工位、清扫工位、下料工位");
+			if (site !== "上下箱工位" && site !== "清扫工位" && site !== "下料工位" && site !== "缓存工位") {
+				mui.toast("工位只能填写上下箱工位、清扫工位、下料工位、缓存工位");
 				$("#site").val("");
 			}
 		};
@@ -142,8 +142,8 @@
 
 			var mapid = $("#mapid").val();
 			var site = $("#site").val();
-			if(site !== "上下箱工位" &&site !== "清扫工位" &&site !== "下料工位"){
-				mui.toast("工位只能填写上下箱工位、清扫工位、下料工位");
+			if (site !== "上下箱工位" && site !== "清扫工位" && site !== "下料工位" && site !== "缓存工位") {
+				mui.toast("工位只能填写上下箱工位、清扫工位、下料工位、缓存工位");
 				$("#site").val("");
 				return
 			}
@@ -169,6 +169,9 @@
 			if (site === "下料工位") {
 				AcceptId = 3;
 			}
+			if (site === "缓存工位") {
+				AcceptId = 4;
+			}
 			localStorage.setItem("AcceptId", AcceptId);
 			window.location.href = "index.html";
 		})