1
HuBingJie
2025-11-13 d58196721475e968769d708d9c14f60dd8d5671f
ÏîÄ¿´úÂë/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -51,38 +51,38 @@
            if (flag && value != null)
            {
                OtherDevice device = (OtherDevice)value;
                List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).Distinct().ToList();
                List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode);
                List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).Distinct().ToList();//获取设备下的站台
                List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); //获取设备下的站台
                try
                {
                    foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode)))
                    foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode))) //循环设备下的站台
                    {
                        DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(R_ConveyorLineDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); //读取
                        DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(R_ConveyorLineDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); //输送线读取的全部协议
                        DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(W_ConveyorLineDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); //写入
                        DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(W_ConveyorLineDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); //输送线写入的全部协议
                        if (deviceProRead != null && deviceProWrite != null) //读取写入
                        if (deviceProRead != null && deviceProWrite != null) //读取写入的协议判断是否为null
                        {
                            R_ConveyorLineInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineInfo>(deviceProRead.DeviceProAddress);
                            R_ConveyorLineInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineInfo>(deviceProRead.DeviceProAddress); //读取协议
                            W_ConveyorLineInfo conveyorLineInfoWrite = device.Communicator.ReadCustomer<W_ConveyorLineInfo>(deviceProWrite.DeviceProAddress);
                            W_ConveyorLineInfo conveyorLineInfoWrite = device.Communicator.ReadCustomer<W_ConveyorLineInfo>(deviceProWrite.DeviceProAddress); //写入协议
                            if (conveyorLineInfoRead == null || conveyorLineInfoWrite == null)
                            {
                                continue;
                            }
                            R_ConveyorLineStatus conveyorLineStatus = conveyorLineInfoRead.Status.ByteToBoolObject<R_ConveyorLineStatus>();
                            R_ConveyorLineStatus conveyorLineStatus = conveyorLineInfoRead.Status.ByteToBoolObject<R_ConveyorLineStatus>(); //获取设备状态
                            ConveyorLineSignal conveyorLineSignalRead = conveyorLineInfoRead.Signal.ByteToBoolObject<ConveyorLineSignal>();
                            bool ACK = device.GetValue<W_ConveyorLineDB, bool>(W_ConveyorLineDB.ACK, item.StationCode);
                            ConveyorLineSignal conveyorLineSignalRead = conveyorLineInfoRead.Signal.ByteToBoolObject<ConveyorLineSignal>(); //获取设备信号
                            bool ACK = device.GetValue<W_ConveyorLineDB, bool>(W_ConveyorLineDB.ACK, item.StationCode); //获取ACK确认信息
                            bool STB = device.GetValue<W_ConveyorLineDB, bool>(W_ConveyorLineDB.STB, item.StationCode);
                            bool STB = device.GetValue<W_ConveyorLineDB, bool>(W_ConveyorLineDB.STB, item.StationCode); //获取STB请求信息
                            //ConveyorLineSignal conveyorLineSignalWrite = conveyorLineInfoWrite.Signal.ByteToBoolObject<ConveyorLineSignal>();
                            //出库站台
                            if (item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt())
                            if (item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt())  //2007交互口进入
                            {
                                // å‡ºåº“
                                if (conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !STB && !ACK)//出库
                                if (conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !STB && !ACK)//2楼出库
                                {
                                    if (!string.IsNullOrEmpty(conveyorLineInfoRead.Barcode))
                                    {
@@ -90,9 +90,9 @@
                                        Dt_Task dt_Ta = _taskService.GetOutTaskInfo2(conveyorLineInfoRead.Barcode);
                                        if (dt_Ta != null)
                                        {
                                            device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode);
                                            device.SetValue(W_ConveyorLineDB.EndPos, dt_Ta.OutboundPlatform, item.StationCode);
                                            device.SetValue(W_ConveyorLineDB.TaskNo, dt_Ta.TaskNum, item.StationCode);
                                            device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode);
                                            //删除任务
                                            _taskRepository.DeleteData(dt_Ta);
@@ -107,12 +107,12 @@
                            //出入库站台
                            else if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt())
                            {
                                //入库生成堆垛机入库任务
                                //输送线完成修改成输送线完成状态待堆垛机执行任务
                                if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !ACK)
                                {
                                    if (!string.IsNullOrEmpty(conveyorLineInfoRead.Barcode))//采购入库
                                    if (!string.IsNullOrEmpty(conveyorLineInfoRead.Barcode))
                                    {
                                        WebResponseContent contentweb = _taskService.UpdateTaskIninfo(conveyorLineInfoRead.Barcode,item.StationCode);
                                        WebResponseContent contentweb = _taskService.UpdateTaskIninfo(conveyorLineInfoRead.Barcode,item.StationCode); //根据条码跟设备编号去查询并修改任务
                                        if (contentweb.Status)
                                        {
                                            device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode);
@@ -155,12 +155,13 @@
                                        }
                                    }
                                }*/
                                else if (!conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !STB && !ACK)//出库
                                else if (!conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !STB && !ACK)//其他楼层出库
                                {
                                    
                                    Dt_Task dt_Ta = _taskService.GetOutTaskInfo(item.StationCode);
                                    Dt_Task dt_Ta = _taskService.GetOutTaskInfo(item.StationCode);  //获取出库任务
                                    if (dt_Ta != null)
                                    {.1111
                                    {
                                        device.SetValue(W_ConveyorLineDB.TaskNo, dt_Ta.TaskNum, item.StationCode);
                                        device.SetValue(W_ConveyorLineDB.EndPos, dt_Ta.OutboundPlatform, item.StationCode);
                                        device.SetValue(W_ConveyorLineDB.STB, true, item.StationCode);
@@ -180,20 +181,19 @@
                                else if (!conveyorLineSignalRead.STB && conveyorLineSignalRead.ACK && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && STB && !ACK)
                                {
                                    device.SetValue(W_ConveyorLineDB.STB, false, item.StationCode);
                                }
                                }//清楚确认信号
                            }
                            //入库站台
                            else if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt())
                            else if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt()) //2014交互口
                            {
                                if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !ACK)
                                {
                                    if (conveyorLineInfoRead.TaskNo == 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode))//采购入库
                                    {
                                        Dt_Task dt_Ta = _taskService.GetTaskIninfo(conveyorLineInfoRead.Barcode);
                                        Dt_Task dt_Ta = _taskService.GetTaskIninfo(conveyorLineInfoRead.Barcode); //通过条码去查询任务
                                        if(dt_Ta != null)
                                        {
                                            device.SetValue(W_ConveyorLineDB.EndPos, dt_Ta.SourceAddress, item.StationCode);
                                            device.SetValue(W_ConveyorLineDB.TaskNo, dt_Ta.TaskNum, item.StationCode);
                                            device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode);