src/A032.Process/ProcessControl_Method.cs
@@ -27,11 +27,11 @@
        List<TaskAssignInfo> taskAssignedList = new List<TaskAssignInfo>();
        #region AGV事件
        private void OnAGVBatterLvlChanged(SeerAGVDriver agv, float batterLvl)
        private void OnAGVBatteryLvlChanged(SeerAGVDriver agv, float preBatteryLvl, float batteryLvl)
        {
            var bind = Config.AGVBindCollection.FirstOrDefault(u => u.AGVId == agv.Id);
            SeerAGVInitialConfig iConfig = agv.InitialConfig as SeerAGVInitialConfig;
            if (batterLvl <= iConfig.BatteryLvlToCharge)
            if (batteryLvl <= iConfig.BatteryLvlToCharge && preBatteryLvl > iConfig.BatteryLvlToCharge)
            {
                Task.Run(() =>
                {
@@ -57,9 +57,14 @@
                return;
            }
            if (batterLvl >= iConfig.BatteryLvlChargeDone)
            if (batteryLvl >= iConfig.BatteryLvlChargeDone && preBatteryLvl < iConfig.BatteryLvlChargeDone)
            {
                bind.SetAGVStatus(TaskStatus.Available);
                var position = Config.PositionCollection.FirstOrDefault(u => u.PositionCode == agv.CurrentPosition);
                if (position != null && position.Description == PathPositionDefinition.Charge)
                {
                    bind.SetAGVStatus(TaskStatus.Available);
                }
                return;
            }
        }
@@ -105,19 +110,25 @@
                //}
                bind.SetAGVStatus(TaskStatus.Available);
                LogAsync(DateTime.Now, $"AGV到位{positionCode}", "");
                PathPosition position = Config.PositionCollection.FirstOrDefault(p => p.PositionCode == bind.AGVDest);
                switch (position.Description)
                {
                    case PathPositionDefinition.LoadEmptyTray:
                        LogAsync(DateTime.Now, $"AGV完成,准备上空Tray", "");
                        Robot_LoadEmptyTray(bind.Id, position);
                        break;
                    case PathPositionDefinition.LoadFullTray:
                        LogAsync(DateTime.Now, $"AGV完成,准备上满Tray", "");
                        Robot_LoadFullTraySnap(bind.Id, position);
                        break;
                    case PathPositionDefinition.UnloadEmptyTray:
                        LogAsync(DateTime.Now, $"AGV完成,准备下空Tray", "");
                        Robot_UnloadEmptyTraySnap(bind.Id, position);
                        break;
                    case PathPositionDefinition.UnloadFullTray:
                        LogAsync(DateTime.Now, $"AGV完成,准备下满Tray", "");
                        Robot_UnloadFullTraySnap(bind.Id, position);
                        break;
                    default:
@@ -183,8 +194,11 @@
                                    if (machineEmptyTrayDict[msg.Para2] < Config.Machine_EmptyTrayNum)
                                    {
                                        bind.RobotIOHandle.Reset();
                                        bind.RobotIOHandle.WaitOne();
                                        //bind.RobotIOHandle.Reset();
                                        //bind.RobotIOHandle.WaitOne();
                                        bind.Robot.MonitorHandle.WaitOne();
                                        //bind.Robot.IOChangedHandle.WaitOne();
                                        Thread.Sleep((bind.Robot.InitialConfig as AuboRobotInitialConfig).ScanInterval);
                                        if (!bind.IsFullTrayFull)
                                        {
@@ -206,12 +220,19 @@
                                {
                                    bind.CurrentFullTray = int.Parse(msg.Datas[1]);
                                    bind.RobotIOHandle.Reset();
                                    bind.RobotIOHandle.WaitOne();
                                    //bind.RobotIOHandle.Reset();
                                    //bind.RobotIOHandle.WaitOne();
                                    bind.Robot.MonitorHandle.WaitOne();
                                    //bind.Robot.IOChangedHandle.WaitOne();
                                    Thread.Sleep((bind.Robot.InitialConfig as AuboRobotInitialConfig).ScanInterval);
                                    if (!bind.IsFullTrayEmpty)
                                    {
                                        Camera_UnloadFullTray(robot.Id, msg.Para2);
                                    }
                                    else
                                    {
                                        bind.RobotStatus = TaskStatus.Available;
                                    }
                                }
                                break;
@@ -387,6 +408,7 @@
        [ProcessMethod("", "Robot_Monitor_FullTrayFull", "机器人监听事件-满Tray区域放满", true)]
        public ProcessResponse Robot_Monitor_FullTrayFull(IOperationConfig config, IDevice device)
        {
            //(device as AuboRobotDriver).IOChangedHandle.Reset();
            bool isFullTrayFull = config.InputPara[0] == 1;
            var bind = Config.AGVBindCollection.FirstOrDefault(u => u.RobotId == device.Id);
            if (isFullTrayFull)
@@ -425,7 +447,9 @@
                bind.IsFullTrayTaskAssigned = false;
            }
            bind.RobotIOHandle.Set();
            //(device as AuboRobotDriver).IOChangedHandle.Set();
            //bind.RobotIOHandle.Set();
            return new ProcessResponse(true);
        }
@@ -433,11 +457,13 @@
        [ProcessMethod("", "Robot_Monitor_FullTrayEmpty", "机器人监听事件-满Tray区域清空", true)]
        public ProcessResponse Robot_Monitor_FullTrayEmpty(IOperationConfig config, IDevice device)
        {
            //(device as AuboRobotDriver).IOChangedHandle.Reset();
            bool isFullTrayEmpty = config.InputPara[0] == 0;
            var bind = Config.AGVBindCollection.FirstOrDefault(u => u.RobotId == device.Id);
            bind.IsFullTrayEmpty = isFullTrayEmpty;
            bind.RobotIOHandle.Set();
            //(device as AuboRobotDriver).IOChangedHandle.Set();
            //bind.RobotIOHandle.Set();
            return new ProcessResponse(true);
        }
@@ -1194,6 +1220,7 @@
            bind.RobotStatus = TaskStatus.Running;
            bind.Robot.SendMsg(RobotMsgAction.Move, RobotMsgParas.LineSnap, position.PositionNo);
            //LogAsync(DateTime.Now, "Robot运动至下满Tray拍照", "");
        }
        //[ProcessMethod("", "Camera_UnloadFullTray", "相机操作卸载满Tray", true)]