1
huanghongfeng
2024-11-21 4cfeced9bc8985cdd89fdb540e6fe984f8469481
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -21,6 +21,7 @@
using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Quartz;
using SqlSugar;
using StackExchange.Profiling.Internal;
using System;
using System.Collections.Generic;
@@ -75,7 +76,15 @@
                    {
                        RequestInbound(conveyorLine);   //一楼C,B区业务
                    }
                    if (conveyorLine.DeviceCode == "1003")
                    {
                        _taskService.RequestWMSTask3("FK240711D2",1, "R02-002-027-011-01");
                    }
                    if (conveyorLine.DeviceCode == "1004")
                    {
                        RequestInbound3(conveyorLine);   //一楼C,B区业务
                    }
                }
@@ -243,53 +252,56 @@
        //新的巷道判断
        private void HandleEvent2(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string writeTag)
        {
            try
            byte events = conveyorLine.Communicator.Read<byte>(eventTag); // è¯»å–事件
            if (events == 1)
            {
                byte events = conveyorLine.Communicator.Read<byte>(eventTag); // è¯»å–事件
                if (events == 1)
                string barcode = conveyorLine.Communicator.Read<string>(barcodeTag).Trim(); // è¯»å–条码
                if (barcode != "1" || barcode != "0")
                {
                    string barcode = conveyorLine.Communicator.Read<string>(barcodeTag); // è¯»å–条码
                    if (barcode != "1" || barcode != "0")
                    WebResponseContent content = _taskService.ToPlatform(barcode);
                    if(content != null)
                    {
                        WebResponseContent content = _taskService.ToPlatform(barcode);
                        if ((int)content.Data == 1)
                        if (content.Status)
                        {
                            if (conveyorLine.Communicator.Read<string>("PLC_WCS_B._01_PLC_LPN") == "")
                            if(content.Data != null)
                            {
                                // å†™å…¥å޻向2号堆垛机
                                bool result = conveyorLine.Communicator.Write(writeTag, (byte)1);   //写入去向为长巷道
                                if (result)
                                if (content.Data.ToString() == "1")
                                {
                                    WriteLog.GetLog("PLC日志").Write($"条码{barcode},写入去向:1", "去向");
                                    if (conveyorLine.Communicator.Read<string>("PLC_WCS_C._03_PLC_LPN") == "")
                                    {
                                        // å†™å…¥å޻向2号堆垛机
                                        bool result = conveyorLine.Communicator.Write(writeTag, (byte)1);   //写入去向为长巷道
                                        if (result)
                                        {
                                            WriteLog.GetLog("PLC日志").Write($"条码{barcode},写入去向:1", "去向");
                                        }
                                    }
                                }
                                else if (content.Data.ToString() == "3")
                                {
                                    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($"条码{barcode},写入去向:3", "去向");
                                        }
                                    }
                                }
                            }
                        }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;
                else if (barcode == "1")
                {
                    bool result = conveyorLine.Communicator.Write(writeTag, (byte)1);   //空托去向
                    if (result)
                    {
                        WriteLog.GetLog("PLC日志").Write("空托入库,写入去向:1", "去向");
                    }
                }
            }
        }
        
@@ -362,23 +374,23 @@
            if (eventStatus == 1)
            {
                WriteLog.GetLog("PLC入库站台日志").Write($"读取到输送线申请入库信息EVENT为:{eventStatus},站台编号为:{taskCode}", "站台信息");
                string barcode = conveyorLine.Communicator.Read<string>(barcodeTag);
                if(barcode == "1")
                string barcode = conveyorLine.Communicator.Read<string>(barcodeTag).Trim();
                /*if(barcode == "1")
                {
                    string currentTime = DateTime.Now.ToString("HHmmss");
                    barcode = "KTP" + currentTime;
                }
                }*/
                if (barcode != null)
                {
                    bool result = conveyorLine.Communicator.Write(writeTag, (byte)0);
                    if(taskCode== "R01-003-042-001-01")
                    /*if(taskCode== "R01-003-042-001-01")
                    {
                        if ((_taskService.ToPlatform(barcode)).Status)
                        {
                            WriteLog.GetLog("PLC入库站台日志").Write($"组盘成功,站台编号为:{taskCode}", "站台信息");
                        }
                    }
                    }*/
                    // æ‹¿å–托盘条码申请入库信息
                    WebResponseContent content = _taskService.RequestWMSTask(barcode, taskCode); // ç”³è¯·å…¥åº“,生成堆垛机任务
                    if (content !=null)