1
huanghongfeng
2024-11-19 a3dfe45b801f14a574caf27effaed58f1dc3a763
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -97,11 +97,13 @@
        public void RequestInbound(CommonConveyorLine conveyorLine)
        {
            //1楼输送线判断
            HandleEvent(conveyorLine, "PLC_WCS_B._03_PLC_EVENT", "PLC_WCS_B._03_PLC_LPN", "WCS_PLC_B._03_WCS_TO");  //判断巷道
            HandleEvent(conveyorLine, "PLC_WCS_C._02_PLC_EVENT", "PLC_WCS_C._02_PLC_LPN", "WCS_PLC_C._02_WCS_TO");  //判断巷道
            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");  //判断巷道
            CheckForEmptyPallet(conveyorLine, "PLC_WCS_B._02_PLC_EVENT", "PLC_WCS_B._02_PLC_LPN", "PLC_WCS_B._02_PLC_PUT", "R02-002-027-001-01"); //判断是否取空托出库
            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_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
        }
@@ -120,11 +122,11 @@
        public void RequestInbound3(CommonConveyorLine conveyorLine)
        {
            ProcessConveyorEvent(conveyorLine, "PLC_WCS_A._02_PLC_EVENT", "PLC_WCS_A._02_PLC_LPN", "R02-003-043-011-01", "WCS_PLC_A._02_WCS_TO");// å¤„理 A21 ç«™å°äº‹ä»¶å…¥åº“
            ProcessConveyorEvent(conveyorLine, "PLC_WCS_A._02_PLC_EVENT", "PLC_WCS_A._02_PLC_LPN", "R01-002-043-001-01", "WCS_PLC_A._02_WCS_TO");// å¤„理 A21 ç«™å°äº‹ä»¶å…¥åº“
            ProcessConveyorEvent(conveyorLine, "PLC_WCS_A._03_PLC_EVENT", "PLC_WCS_A._03_PLC_LPN", "R01-003-042-011-01", "WCS_PLC_A._03_WCS_TO");// å¤„理 A22 ç«™å°äº‹ä»¶ å…¥æ–™
            //ProcessConveyorEvent(conveyorLine, "PLC_WCS_A._03_PLC_EVENT", "PLC_WCS_A._03_PLC_LPN", "R01-002-042-001-01", "WCS_PLC_A._03_WCS_TO");// å¤„理 A22 ç«™å°äº‹ä»¶ å…¥æ–™
            
            ConveyorLineInFinish(conveyorLine,"R01-002-044-001-01"); //用于写入输送线条码信息,用于出库
            //ConveyorLineInFinish(conveyorLine,"R01-002-044-001-01"); //用于写入输送线条码信息,用于出库
        }
        public void ConveyorLineInFinish(CommonConveyorLine conveyorLine,string SCAddress)
@@ -196,11 +198,14 @@
                    {
                        if ((_taskService.ToPlatform(barcode)).Status)
                        {
                            if(conveyorLine.Communicator.Read<string>("PLC_WCS_B._01_PLC_LPN")=="")
                            {
                            // å†™å…¥å޻向2号堆垛机
                            bool result = conveyorLine.Communicator.Write(writeTag, (byte)1);   //原材料去向
                                bool result = conveyorLine.Communicator.Write(writeTag, (byte)3);   //原材料去向
                            if (result)
                            {   
                                WriteLog.GetLog("PLC日志").Write("写入去向:3", "去向");
                                }
                            }
                        }
                    }
@@ -235,7 +240,60 @@
            }
        }
        //用于判断是否补空托
        //新的巷道判断
        private void HandleEvent2(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")
                    {
                        WebResponseContent content = _taskService.ToPlatform(barcode);
                        if ((int)content.Data == 1)
                        {
                            if (conveyorLine.Communicator.Read<string>("PLC_WCS_B._01_PLC_LPN") == "")
                            {
                                // å†™å…¥å޻向2号堆垛机
                                bool result = conveyorLine.Communicator.Write(writeTag, (byte)1);   //写入去向为长巷道
                                if (result)
                                {
                                    WriteLog.GetLog("PLC日志").Write($"条码{barcode},写入去向:1", "去向");
                                }
                            }
                        }else if ((int)content.Data == 3)
                        {
                            if (conveyorLine.Communicator.Read<string>("PLC_WCS_C._03_PLC_LPN") == "")
                            {
                                // å†™å…¥å޻向2号堆垛机
                                bool result = conveyorLine.Communicator.Write(writeTag, (byte)3);   //写入去向为短巷道
                                if (result)
                                {
                                    WriteLog.GetLog("PLC日志").Write($"条码{barcode},写入去向:3", "去向");
                                }
                            }
                        }
                    }else if (barcode == "1")
                    {
                        bool result = conveyorLine.Communicator.Write(writeTag, (byte)1);   //空托去向
                        if (result)
                        {
                            WriteLog.GetLog("PLC日志").Write("空托入库,写入去向:1", "去向");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        //用于判断是否补空托 A区
        private void CheckForEmptyPallet(CommonConveyorLine conveyorLine,string eventTag, string barcodeTag,string plcput,string Loc)
        {
@@ -262,8 +320,6 @@
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
@@ -273,7 +329,7 @@
            }
        }
        //用于判断是否出空托
        //用于判断是否出空托 D区
        private void CheckForEmptyPallet2(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string plcput, string Loc)
        {
            Byte events = conveyorLine.Communicator.Read<Byte>(eventTag);  // è¯»å–事件
@@ -316,7 +372,7 @@
                if (barcode != null)
                {
                    bool result = conveyorLine.Communicator.Write(writeTag, (byte)0);
                    if(taskCode== "R01-003-042-011-01")
                    if(taskCode== "R01-003-042-001-01")
                    {
                        if ((_taskService.ToPlatform(barcode)).Status)
                        {