1
huanghongfeng
2025-10-22 0cbe01e1241f9af562d86dc79b5f0949ada81dba
´úÂë¹ÜÀí/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -257,18 +257,28 @@
        {
            return BaseDal.QueryFirst(x => x.RGVTaskType == (int)RGVTaskTypeEnum.TravelingOnly && x.TaskState == (int)TaskOutStatusEnum.OutNew && x.NextAddress == Nextaderr, TaskOrderBy);
        }
        /// <summary>
        /// èŽ·å–æ¯è½¦æ˜¯å¦æœ‰ä»»åŠ¡ï¼Œè¿›è¡Œåˆ¤æ–­
        /// </summary>
        public Dt_Task ObtainMuChetaskbool(AGVStation ZicheinnerSide)
        {
            Dt_Task dt_Task = BaseDal.QueryFirst(x => (x.TaskState == (int)TaskOutStatusEnum.OutNew || x.TaskState == (int)TaskOutStatusEnum.RGV_OutMothercarExecuting) && x.NextAddress == ZicheinnerSide.MotherCarDeviceCode.ToString(), TaskOrderBy);
            if (dt_Task != null) return dt_Task;
            Dt_Task dt_Task2 = BaseDal.QueryFirst(x => x.Roadway == ZicheinnerSide.ChildPosiDeviceCode, TaskOrderBy);
            if (dt_Task2 != null) return dt_Task2;
            return null;
            return BaseDal.QueryFirst(x => x.RGVTaskType == (int)RGVTaskTypeEnum.TravelingOnly && (x.TaskState == (int)TaskOutStatusEnum.OutNew || x.TaskType == (int)TaskOutStatusEnum.RGV_OutMothercarExecuting), TaskOrderBy);
        }
        public Dt_Task GetChariotTaskBool(string ChildPosiDeviceCode)
        {
            Dt_Task dt_Task2 = BaseDal.QueryFirst(x => x.Roadway == ChildPosiDeviceCode, TaskOrderBy);
            if (dt_Task2 != null) return dt_Task2;
            return null;
        }
        /// <summary>
        /// èŽ·å–HCJ站台是否有任务
        /// </summary>
        public Dt_Task GetHCJTaskBool(string ChildPosiDeviceCode,int HCJaddres)
        {
            Dt_Task dt_Task2 = BaseDal.QueryFirst(x => x.Roadway == ChildPosiDeviceCode && x.CurrentAddress== HCJaddres.ToString(), TaskOrderBy);
            if (dt_Task2 != null) return dt_Task2;
            return null;
        }
@@ -339,13 +349,22 @@
        }
        /// <summary>
        /// èŽ·å–æ¯è½¦ç§»åŠ¨ä»»åŠ¡å’Œç§»åŠ¨ä¸­çš„ä»»åŠ¡
        /// èŽ·å–æ¯è½¦ç§»åŠ¨ä»»åŠ¡å’Œç§»åŠ¨ä¸­çš„ä»»åŠ¡ï¼ˆå…¥åº“ï¼‰
        /// </summary>
        /// <param name="DeviceCode"></param>
        /// <returns></returns>
        public Dt_Task MothermachinemovementTask2(string DeviceCode)
        {
            return BaseDal.QueryFirst(x => x.Roadway == DeviceCode && x.TaskState == (int)TaskInStatusEnum.RGV_InZicheReleaseFinish && x.TaskState == (int)TaskInStatusEnum.RGV_InMothercarExecuting && x.RGVTaskType == (int)RGVTaskTypeEnum.TravelingOnly, TaskOrderBy);
            return BaseDal.QueryFirst(x => x.Roadway == DeviceCode && (x.TaskState == (int)TaskInStatusEnum.RGV_InZicheReleaseFinish || x.TaskState == (int)TaskInStatusEnum.RGV_InMothercarExecuting || x.RGVTaskType == (int)RGVTaskTypeEnum.TravelingOnly), TaskOrderBy);
        }
        /// <summary>
        /// èŽ·å–æ¯è½¦ç§»åŠ¨ä»»åŠ¡å’Œç§»åŠ¨ä¸­çš„ä»»åŠ¡ï¼ˆå‡ºåº“ï¼‰
        /// </summary>
        /// <param name="DeviceCode"></param>
        public Dt_Task OutMothermaTask(string DeviceCode)
        {
            return BaseDal.QueryFirst(x => x.Roadway == DeviceCode && (x.TaskState == (int)TaskOutStatusEnum.OutNew || x.TaskState == (int)TaskOutStatusEnum.RGV_OutMothercarExecuting || x.RGVTaskType == (int)TaskOutStatusEnum.RGV_OutMothercarFinish), TaskOrderBy);
        }
@@ -386,6 +405,8 @@
        {
            return BaseDal.QueryFirst(x => x.Roadway == DeviceCode && (x.TaskState == (int)TaskInStatusEnum.RGV_InReleaseFinish || x.TaskState == (int)TaskInStatusEnum.RGV_InZicheExecuting || x.TaskState == (int)TaskInStatusEnum.RGV_InZicheFinish || x.TaskState == (int)TaskInStatusEnum.RGV_InZicheReleaseExecuting || x.TaskState == (int)TaskInStatusEnum.RGV_InZicheReleaseFinish) && x.RGVTaskType == (int)RGVTaskTypeEnum.PickingUp, TaskOrderBy);
        }
@@ -944,6 +965,8 @@
                task.TaskState = (int)TaskOutStatusEnum.RGV_OutZicheReleaseFinish;
                task.RGVTaskType = (int)RGVTaskTypeEnum.PickingUp;
                task.Roadway = "RGV118";
                task.CurrentAddress = "1171";
                task.NextAddress = "";
            }
            else
            {
@@ -992,7 +1015,6 @@
                        rGVstatus.msg = "明和WCS接收到RGV编号为空,请检查";
                        return rGVstatus;
                    }
                    IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == item.rgvTag);
                    if (device == null)
                    {
@@ -1000,11 +1022,10 @@
                        rGVstatus.msg = "查询的RGV已断线";
                        return rGVstatus;
                    }
                    CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
                    SpeStackerCrane Commonstacker = (SpeStackerCrane)device;
                    //当前位置
                    DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == item.rgvTag && x.DeviceProParamName == "RGVCurrentlocation" && x.DeviceProParamType == "RGVCurrentlocation");
                    DeviceProDTO? deviceProDTO = Commonstacker.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == item.rgvTag && x.DeviceProParamName == "RGVCurrentlocation" && x.DeviceProParamType == "RGVCurrentlocation");
                    if (item.type == "pick")   //取货
                    {
@@ -1018,7 +1039,7 @@
                            return rGVstatus;
                        }
                        int Currentlocation = conveyorLine.Communicator.Read<short>(deviceProDTO.DeviceProAddress);
                        int Currentlocation = Commonstacker.Communicator.Read<short>(deviceProDTO.DeviceProAddress);
                        if (Currentlocation == aGVStation.Motherinlaw)    //是否在取货位
                        {
                            rGVstatus.code = 0;
@@ -1039,10 +1060,10 @@
                    else if (item.type == "put")    //放货
                    {
                        AGVStation aGVStation = _gvStationService.Corridorequipment(item.rgvTag);
                        int Currentlocation = conveyorLine.Communicator.Read<short>(deviceProDTO.DeviceProAddress);
                        int Currentlocation = Commonstacker.Communicator.Read<short>(deviceProDTO.DeviceProAddress);
                        DeviceProDTO? deviceProFh = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == item.rgvTag && x.DeviceProParamName == "RgvEquipmentStatus" && x.DeviceProParamType == "RgvEquipmentStatus");
                        int Itstock = conveyorLine.Communicator.Read<short>(deviceProFh.DeviceProAddress);
                        DeviceProDTO? deviceProFh = Commonstacker.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == item.rgvTag && x.DeviceProParamName == "RgvEquipmentStatus" && x.DeviceProParamType == "RgvEquipmentStatus");
                        int Itstock = Commonstacker.Communicator.Read<short>(deviceProFh.DeviceProAddress);
                        if (aGVStation.Motherinlaw== Currentlocation && Itstock==0)
                        {