protected override void ReleaseProcedureItemHandler(Object item) { Task.Run(() => { ProcedureControlServices procItem = item as ProcedureControlServices; RobotUnity robot = procItem.GetRobotUnity(); robot.ShowText("Procedure :" + procItem.procedureCode); robot.ShowText("Robot Rleased :" + robot.properties.Label); robot.ShowText(">>>>>>>>>"); if (procItem.procedureCode == ProcedureControlServices.ProcedureCode.PROC_CODE_ROBOT_TO_READY) { robotManagementService.AddRobotUnityReadyList(robot); } else if (procItem.procedureCode == ProcedureControlServices.ProcedureCode.PROC_CODE_ROBOT_TO_CHARGE) { robotManagementService.AddRobotUnityReadyList(robot); } else { robot.ShowText("Add Wait Task" + robot.properties.Label); robot.ShowText("----------------"); robotManagementService.AddRobotUnityWaitTaskList(robot); try { procItem.ReleaseProcedureHandler -= ReleaseProcedureItemHandler; } catch { } } /* var element = RegisterProcedureItemList.Find (e => e.item.procedureCode == procItem.procedureCode); * element.procedureDataItems.EndTime = DateTime.Now; * element.procedureDataItems.StatusProcedureDelivered = "OK"; * RegisterProcedureItemList.Remove (element);*/ }); }
protected override void ErrorApprearInProcedureItem(Object item) { // chờ xử lý // error staus is true; // báo sự cố cho lớp robotmanagement // đợi cho chờ xử lý// hủy bỏ quy trình // add order lại list device ProcedureControlServices procItem = item as ProcedureControlServices; if (procItem.procedureCode == ProcedureCode.PROC_CODE_ROBOT_TO_READY) { } else if (procItem.procedureCode == ProcedureCode.PROC_CODE_ROBOT_TO_CHARGE) { } else { // lưu lại giá trị order // RestoreOrderItem (procItem.order); } //SolvedProblem pSP = new SolvedProblem(item); //pSP.Show(); //robot.setColorRobotStatus(RobotStatusColorCode.ROBOT_STATUS_ERROR); // robot.border.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, // new Action(delegate () // { // robot.setColorRobotStatus(RobotStatusColorCode.ROBOT_STATUS_ERROR); // })); // SolvedProblem pSP = new SolvedProblem(item); // pSP.Show(); }
public void RegisteAnItem(ProcedureControlServices item, ProcedureDataItems procedureDataItems, RobotAgent robot, DoorService door) { RegisterProcedureItem itemprocedure = new RegisterProcedureItem() { item = item, robot = robot, procedureDataItems = procedureDataItems }; item.ReleaseProcedureHandler += ReleaseProcedureItemHandler; RegisterProcedureItemList.Add(itemprocedure); }
protected virtual void ReleaseProcedureItemHandler(ProcedureControlServices item) { Task.Run(() => { var element = RegisterProcedureItemList.Find(e => e.item == item); element.procedureDataItems.EndTime = DateTime.Now; element.procedureDataItems.DeliveryInfo = item.DeliveryInfo; element.procedureDataItems.StatusProcedureDelivered = "OK"; // gui den database RegisterProcedureItemList.Remove(element); }); }
protected void Debug(object ojb, string log) { ProcedureControlServices pCs = (ProcedureControlServices)ojb; RobotUnity rb = pCs.GetRobotUnity(); string rBid = rb.properties.Label + " => (^_^) "; switch (pCs.procedureCode) { case ProcedureCode.PROC_CODE_BUFFER_TO_MACHINE: Console.WriteLine(rBid + "BUFFER_TO_MACHINE:" + log); break; case ProcedureCode.PROC_CODE_FORKLIFT_TO_BUFFER: Console.WriteLine(rBid + "FORKLIFT_TO_BUFFER:" + log); break; case ProcedureCode.PROC_CODE_BUFFER_TO_RETURN: Console.WriteLine(rBid + "BUFFER_TO_RETURN:" + log); break; case ProcedureCode.PROC_CODE_MACHINE_TO_RETURN: Console.WriteLine(rBid + "MACHINE_TO_RETURN:" + log); break; case ProcedureCode.PROC_CODE_RETURN_TO_GATE: Console.WriteLine(rBid + "RETURN_TO_GATE:" + log); break; case ProcedureCode.PROC_CODE_ROBOT_TO_READY: Console.WriteLine(rBid + "ROBOT_TO_READY:" + log); break; case ProcedureCode.PROC_CODE_ROBOT_TO_CHARGE: Console.WriteLine(rBid + "ROBOT_TO_CHARGE:" + log); break; default: break; } }
protected override void ReleaseProcedureItemHandler(Object item) { Task.Run(() => { ProcedureControlServices procItem = item as ProcedureControlServices; RobotUnity robot = procItem.GetRobotUnity(); robot.ShowText("Procedure :" + procItem.procedureCode); robot.ShowText("Robot Rleased :" + robot.properties.Label); robot.ShowText(">>>>>>>>>"); robot.border.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { robot.setColorRobotStatus(RobotStatusColorCode.ROBOT_STATUS_OK); })); if (procItem.procedureCode == ProcedureControlServices.ProcedureCode.PROC_CODE_ROBOT_TO_READY) { robotManagementService.AddRobotUnityReadyList(robot); } else if (procItem.procedureCode == ProcedureControlServices.ProcedureCode.PROC_CODE_ROBOT_TO_CHARGE) { robotManagementService.AddRobotUnityReadyList(robot); } else { robot.ShowText("Add Wait Task" + robot.properties.Label); robot.ShowText("----------------"); robotManagementService.AddRobotUnityWaitTaskList(robot); try { procItem.ReleaseProcedureHandler -= ReleaseProcedureItemHandler; } catch { } } /* var element = RegisterProcedureItemList.Find (e => e.item.procedureCode == procItem.procedureCode); * element.procedureDataItems.EndTime = DateTime.Now; * element.procedureDataItems.StatusProcedureDelivered = "OK"; * RegisterProcedureItemList.Remove (element);*/ }); }
public void RegisteAnItem(ProcedureControlServices item, ProcedureDataItems procedureDataItems, RobotUnity robot) { }
protected virtual void CheckUserHandleError(object obj) { ProcedureControlServices p = (ProcedureControlServices)obj; robot.ShowText("ErrorCode -> " + getStringError(p.errorCode)); //robot.border.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, //new Action(delegate () //{ robot.setColorRobotStatus(RobotStatusColorCode.ROBOT_STATUS_ERROR); //})); Thread.Sleep(5000); //robot.border.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, //new Action(delegate () //{ robot.setColorRobotStatus(RobotStatusColorCode.ROBOT_STATUS_RUNNING); //})); //Thread.Sleep(1000); /* bool keepRun = true; * * robot.ShowText ("ErrorCode -> " + getStringError(p.errorCode)); * robot.RegistrySolvedForm(this); * selectHandleError = SelectHandleError.CASE_ERROR_EXIT; * robot.ShowText("CASE_ERROR_EXIT"); * while (keepRun) * { * switch (selectHandleError) * { * case SelectHandleError.CASE_ERROR_WAITTING: * // Global_Object.PlayWarning (); * robot.border.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, * new Action(delegate () { * robot.setColorRobotStatus(RobotStatusColorCode.ROBOT_STATUS_ERROR); * order.status = StatusOrderResponseCode.ROBOT_ERROR; * })); * Thread.Sleep(1000); * break; * case SelectHandleError.CASE_ERROR_CONTINUOUS: * // Global_Object.StopWarning (); * robot.border.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, * new Action(delegate () { * robot.setColorRobotStatus(RobotStatusColorCode.ROBOT_STATUS_RUNNING); * })); * selectHandleError = SelectHandleError.CASE_ERROR_WAITTING; * order.status = StatusOrderResponseCode.DELIVERING; * ProRun = true; * keepRun = false; * break; * case SelectHandleError.CASE_ERROR_EXIT: * // Global_Object.StopWarning (); * robot.border.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, * new Action(delegate () { * robot.setColorRobotStatus(RobotStatusColorCode.ROBOT_STATUS_ERROR); * * })); * order.status = StatusOrderResponseCode.ROBOT_ERROR; * robot.PreProcedureAs = robot.ProcedureAs; * * ErrorProcedureHandler(obj); * ProRun = false; * keepRun = false; * break; * default: * break; * } * Thread.Sleep(500); * } * selectHandleError = SelectHandleError.CASE_ERROR_WAITTING;*/ }
protected virtual void ErrorApprearInProcedureItem(ProcedureControlServices item) { // chờ xử lý // error staus is true; // báo sự cố cho lớp robotmanagement // đợi cho chờ xử lý// hủy bỏ quy trình }