1
huanghongfeng
2025-06-06 f5b8c1ae89286dada20ea433ffac84f4c9e72a29
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -104,6 +104,8 @@
        public void RequestInbound(CommonConveyorLine conveyorLine)
        {
            try
            {
            //1楼输送线判断
            HandleEvent2(conveyorLine, "PLC_WCS_B._03_PLC_EVENT", "PLC_WCS_B._03_PLC_LPN", "WCS_PLC_B._03_WCS_TO","原材料扫码站台");  //判断巷道
            HandleEvent2(conveyorLine, "PLC_WCS_C._02_PLC_EVENT", "PLC_WCS_C._02_PLC_LPN", "WCS_PLC_C._02_WCS_TO", "成品扫码站台");  //判断巷道
@@ -111,6 +113,12 @@
            CheckForEmptyPallet(conveyorLine, "PLC_WCS_C._01_PLC_EVENT", "PLC_WCS_C._01_PLC_LPN", "PLC_WCS_C._01_PLC_PUT", "R01-002-041-001-01"); //判断是否取空托出库
            ProcessConveyorEvent(conveyorLine, "PLC_WCS_B._01_PLC_EVENT", "PLC_WCS_B._01_PLC_LPN", "R02-003-027-001-01", "WCS_PLC_B._03_WCS_TO");// å¤„理 B 
            ProcessConveyorEvent(conveyorLine, "PLC_WCS_C._03_PLC_EVENT", "PLC_WCS_C._03_PLC_LPN", "R01-003-041-001-01", "WCS_PLC_C._02_WCS_TO");// å¤„理 C
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public void RequestInbound2(CommonConveyorLine conveyorLine)
@@ -129,6 +137,8 @@
        }
        public void ConveyorLineInFinish(CommonConveyorLine conveyorLine, string SCAddress)
        {
            try
        {
            DeviceProDTO? deviceProDTO2 = GetDeviceProDTO(conveyorLine, SCAddress, "R_StackerCraneLowered");    //读取输送线 â€œå †åž›æœºæ”¾ä¸‹â€ ä¿¡å·
            if (deviceProDTO2 != null)
@@ -170,6 +180,12 @@
                    }
                }
            }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        //获取输送线实例
@@ -178,69 +194,12 @@
            return conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == SCAddress && x.DeviceProParamName == Interactivet);
        }
        /// <summary>
        /// ç”¨äºŽå…¥åº“判断巷道
        /// </summary>
        /// <param name="conveyorLine"></param>
        /// <param name="eventTag"></param>
        /// <param name="barcodeTag"></param>
        /// <param name="writeTag"></param>
        private void HandleEvent(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string writeTag)
        {
            try
            {
                byte events = conveyorLine.Communicator.Read<byte>(eventTag); // è¯»å–事件
                if (events == 1)
                {
                    string barcode = conveyorLine.Communicator.Read<string>(barcodeTag); // è¯»å–条码
                    if (barcode != "1" || barcode != "0")
                    {
                        if ((_taskService.ToPlatform(barcode)).Status)
                        {
                            if (conveyorLine.Communicator.Read<string>("PLC_WCS_B._01_PLC_LPN") == "")
                            {
                                // å†™å…¥å޻向2号堆垛机
                                bool result = conveyorLine.Communicator.Write(writeTag, (byte)3);   //原材料去向
                                if (result)
                                {
                                    WriteLog.GetLog("PLC日志").Write("写入去向:3", "去向");
                                }
                            }
                        }
                    }
                    if (barcode == "1")
                    {
                        // å†™å…¥å޻向2号堆垛机
                        bool result = conveyorLine.Communicator.Write(writeTag, (byte)1);   //空托去向
                        if (result)
                        {
                            WriteLog.GetLog("PLC日志").Write("空托入库,写入去向:1", "去向");
                        }
                    }
                    /*else
                    {
                        // å†™å…¥å޻向1号堆垛机
                        bool result = conveyorLine.Communicator.Write(writeTag, (byte)1);
                        if (result)
                        {
                            WriteLog.GetLog("PLC日志").Write("写入去向:2", "去向");
                        }
                        WriteLog.GetLog("PLC日志").Write("入库失败", "入库组盘");
                    }*/
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        //新的巷道判断
        private void HandleEvent2(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string writeTag,string Platform)
        {
            try
        {
            byte events = conveyorLine.Communicator.Read<byte>(eventTag); // è¯»å–事件
            string barcode = conveyorLine.Communicator.Read<string>(barcodeTag).Trim(); // è¯»å–条码
@@ -303,11 +262,19 @@
                wcs_PLCto01(Platform+":错误信息", "错误", $"读取到输送线,申请:{events},条码:{barcode}");
            }
        }
            catch (Exception ex)
            {
                throw;
            }
        }
        //用于判断是否补空托 A区
        private void CheckForEmptyPallet(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string plcput, string Loc)
        {
            try
            {
            Byte events = conveyorLine.Communicator.Read<Byte>(eventTag);  // è¯»å–事件
            if (events == 1)        //1为空,0为有
            {
@@ -327,10 +294,18 @@
                wcs_PLCto02(Loc + ":错误信息", "错误", $"读取到输送线,申请:{events}");
            }
        }
            catch (Exception ex)
            {
                throw;
            }
        }
        //用于判断入库站台
        private void ProcessConveyorEvent(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string taskCode, string writeTag)
        {
            try
        {
            byte eventStatus = conveyorLine.Communicator.Read<byte>(eventTag);
            if (eventStatus == 1)
@@ -424,6 +399,12 @@
                }
            }
        }
            catch (Exception ex)
            {
                throw;
            }
        }
        public bool SetLine(CommonConveyorLine conveyorLine, string DeviceProDataBlock, byte Pali)
        {
            return conveyorLine.Communicator.Write(DeviceProDataBlock, Pali);