分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-03-26 874ceff175a7308da045943fb7def1f6c6560a51
优化NG任务触发逻辑
已删除1个文件
已修改6个文件
已添加1个文件
396 ■■■■ 文件已修改
代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob_a.cs 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/新文件夹/OutboundTask_a.cs 137 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/新文件夹/RestockHCJ_a.cs 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/Services/WCS/Partial/VV_DispatchService.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.Xml;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
@@ -407,7 +408,7 @@
                                WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN号为空", "PCS");
                                continue;
                            }
                            //var Wheel_id = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_id").First(), client).ToString();
                            var Detail = mes_DetailRepository.FindFirst(x => x.SN == Wheel_SN);
@@ -418,7 +419,7 @@
                                #endregion
                                continue;
                            }
                            var Head = mes_HeadRepository.FindFirst(x => x.jobID == Detail.jobID);
                            var Head = mes_HeadRepository.FindFirst(x => x.jobID == Detail.jobID && x.processCode == "17");
                            if (Head == null)
                            {
                                #region æ—¥å¿—记录
@@ -600,23 +601,34 @@
                            if (Stationinfo == null)
                            {
                                #region ä¸‹æ–™ä½æ¡ä»¶ä¸åŒ¹é…ç›´æŽ¥è§¦å‘入库任务
                                var stationinfos = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).ToList();
                                foreach (var stationinfo in stationinfos)
                                //var stationinfos = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).ToList();
                                //foreach (var stationinfo in stationinfos)
                                //{
                                //    agvtask(stationinfoRepository, stationinfo, (wheel == null ? wheel1.e : wheel.e), name == "3单元下料区" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
                                //}
                                #endregion
                                #region è§¦å‘NG任务
                                var NG = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault();
                                if (NG != null)
                                {
                                    agvtask(stationinfoRepository, stationinfo, (wheel == null ? wheel1.e : wheel.e), name == "3单元下料区" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
                                    if (NG.stationType != mes_Head.drawingNo)
                                        agvtask(stationinfoRepository, NG, (wheel == null ? wheel1.e : wheel.e), "TaskType_OutsourceInbound");
                                }
                                #endregion
                                Stationinfo = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 0).FirstOrDefault();
                                #region æ²¡æ‰˜ç›˜å¯ç”¨,触发入库任务
                                //if (Stationinfo == null)
                                //{
                                //    var stationinfos = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).ToList();
                                //    foreach (var stationinfo in stationinfos)
                                //    {
                                //        agvtask(stationinfoRepository, stationinfo, (wheel == null ? wheel1.e : wheel.e), name == "3单元下料区" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
                                //    }
                                //}
                                if (Stationinfo == null)
                                {
                                    var stationinfos = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).ToList();
                                    foreach (var stationinfo in stationinfos)
                                    {
                                        agvtask(stationinfoRepository, stationinfo, (wheel == null ? wheel1.e : wheel.e), name == "3单元下料区" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
                                    }
                                }
                                #endregion
                                #region MyRegion
@@ -695,29 +707,31 @@
                        else if ((Int16)PartStatus == 2)
                        {
                            dt_stationinfo Stationinfo = null;
                            if (mes_Detail.heatID != null)
                            {
                                Stationinfo = Stations
                            .Where(x => x.enable
                            && x.stationCode == NGStation
                            && x.location_state == LocationStateEnum.Stroge.ToString()
                            && x.quantity < 5
                            && x.stationType == mes_Head.drawingNo
                            && x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray")
                            && x.Number == mes_Detail.jobID
                            && x.heatNumber == mes_Detail.heatID).FirstOrDefault();
                            }
                            else
                            {
                                Stationinfo = Stations
                            .Where(x => x.enable
                            && x.stationCode == NGStation
                            && x.location_state == LocationStateEnum.Stroge.ToString()
                            && x.quantity < 5
                            && x.stationType == mes_Head.drawingNo
                            && x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray")
                            && x.Number == mes_Detail.jobID).FirstOrDefault();
                            }
                            //if (mes_Detail.heatID != null)
                            //{
                            //    Stationinfo = Stations
                            //.Where(x => x.enable
                            //&& x.stationCode == NGStation
                            //&& x.location_state == LocationStateEnum.Stroge.ToString()
                            //&& x.quantity < 5
                            //&& x.stationType == mes_Head.drawingNo
                            //&& x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray")
                            //&& x.Number == mes_Detail.jobID
                            //&& x.heatNumber == mes_Detail.heatID).FirstOrDefault();
                            //}
                            //else
                            //{
                            //var tray_type = "SmallTray";
                            //if ((wheel == null ? wheel1.e : wheel.e) > 1100) tray_type = "LargeTray";
                            Stationinfo = Stations
                        .Where(x => x.enable
                        && x.stationCode == NGStation
                        && x.location_state == LocationStateEnum.Stroge.ToString()
                        && x.quantity < 5
                        && x.stationType == mes_Head.drawingNo
                        && x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray")
                        /*&& x.Number == mes_Detail.jobID*/).FirstOrDefault();
                            //}
                            if (Stationinfo == null)
                            {
@@ -864,10 +878,19 @@
            var task = agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).FirstOrDefault();
            if (task != null) return;
            var mes_Head = mes_HeadRepository.FindFirst(x => x.jobID == stationinfo.Number);
            var mes_Head = mes_HeadRepository.Find(x => x.jobID == stationinfo.Number).FirstOrDefault();
            if (mes_Head == null)
            {
                stationinfo.remark = "触发入库任务,但未找到工单头表!";
                stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
                stationinfoRepository.Update(stationinfo, true);
                return;
            }
            dt_stationinfo TargetLocation = null;
            int CompeletedNum = Convert.ToInt32(mes_Head.quantity) - Convert.ToInt32(mes_Head.finishNum);
            if (mes_Head.quantity <= 50) tasktype = "TaskType_OutsourceInbound";
            if (tasktype == "TaskType_OutsourceInbound")
                TargetLocation = StationTask.GetEmptyLocation(stationinfoRepository);
            else if (tasktype == "TaskType_Inbound")
@@ -895,7 +918,7 @@
                    agv_TrayStatus = stationinfo.tray_status
                };
                agvtaskRepository.Add(agvtask, true);
                stationinfo.location_state = LocationStateEnum.Busy.ToString();
                stationinfo.location_state = LocationStateEnum.InBusy.ToString();
                stationinfoRepository.Update(stationinfo, true);
                TargetLocation.location_state = LocationStateEnum.InBusy.ToString();
                TargetLocation.stationType = agvtask.agv_materielid;
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs
@@ -36,7 +36,8 @@
            //EmptyTrayTask.InEmptyTrayTask();库内空托任务
            StationTask.CreateTask();
            OutboundTask.CreateOutboundTask();
            //OutboundTask.CreateOutboundTask();
            OutboundTask_a.CreateOutboundTask();
            ReplaceTray.ReplaceTrayTask();
            RestockHCJ.HCJGetBarcode();
            EmptyTrayTask.CreateEmptyTrayTask();
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob_a.cs
ÎļþÒÑɾ³ý
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs
@@ -43,7 +43,7 @@
                            var area = task.agv_Traytype == "SmallTray" ? "11" : "10";
                            //找1库区的空托位
                            var EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.stationCode.Contains("A") && x.location_state == "Stroge"/*LocationStateEnum.Stroge.ToString()*/ && x.enable)
                                .OrderBy(x => x.line).OrderByDescending(x => x.column).FirstOrDefault();
                                .OrderBy(x => x.column).OrderBy(x => x.line).FirstOrDefault();
                            #region ä¸€ä¸ªåŒºåŸŸåªèƒ½æœ‰ä¸€ä¸ªç©ºæ‰˜ä»»åŠ¡
                            //bool ok = false;
@@ -55,6 +55,7 @@
                            #endregion
                            if (EmptyStation == null)
                                EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.stationCode.Contains(area == "10" ? "D" : "C") && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
                            if (EmptyStation == null) continue;
                            #region åº“内存在任务占用
                            if (EmptyStation.location_state == LocationStateEnum.Busy.ToString())
                                continue;
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs
@@ -79,36 +79,6 @@
                            //todo å¯»æ‰¾å¯æ”¾è´§å¤–协放货台
                            tasktype = "TaskType_OutsourceInbound";
                            TargetLocation = GetEmptyLocation(stationinfoRepository);
                            #region MyRegion
                            //if (TargetLocation != null)
                            //{
                            //    dt_agvtask agvtask = new dt_agvtask()
                            //    {
                            //        agv_fromaddress = item.stationCode,
                            //        agv_id = Guid.NewGuid(),
                            //        agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                            //        agv_grade = 1,
                            //        agv_createtime = DateTime.Now,
                            //        agv_taskstate = "Create",
                            //        agv_materielid = item.stationType,
                            //        agv_qty = item.quantity,
                            //        agv_tasktype = "TaskType_OutsourceInbound",
                            //        agv_toaddress = TargetLocation.stationCode,
                            //        agv_userid = "系统",
                            //        bindSN = item.bindSN,
                            //        agv_worktype = Convert.ToInt32(mesinfo.processCode),
                            //        agv_materbarcode = mesinfo.materialCode,
                            //        agv_Traytype = item.tray_type,
                            //        jobID = item.Number,
                            //        agv_TrayStatus = item.tray_status
                            //    };
                            //    agvtaskRepository.Add(agvtask, true);
                            //    TargetLocation.location_state = LocationStateEnum.Busy.ToString();
                            //    TargetLocation.stationType = agvtask.agv_materielid;
                            //    stationinfoRepository.Update(TargetLocation, true);
                            //}
                            #endregion
                        }
                        else
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ÐÂÎļþ¼Ð/OutboundTask_a.cs
@@ -17,7 +17,7 @@
using static FreeSql.Internal.GlobalFilter;
using static System.Collections.Specialized.BitVector32;
namespace WIDESEA_WCS.JobsPart.Common.新文件夹
namespace WIDESEA_WCS.JobsPart.Common
{
    public class OutboundTask_a
    {
@@ -35,7 +35,7 @@
                Idt_inventoryRepository inventoryRepository = new dt_inventoryRepository(context);
                Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context);
                var mes_heads = mes_HeadRepository.Find(x => x.processCode == "28").OrderBy(x => x.expectedStartTime).ToList();
                var mes_heads = mes_HeadRepository.Find(x => x.processCode == "28").OrderByDescending(x => x.CreateTime).ToList();
                foreach (var mes_head in mes_heads)
                {
                    #region æ ¹æ®å·¥å•子表查找库存
@@ -48,9 +48,12 @@
                            var Station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault();
                            if (Station != null)
                            {
                                var stationinfos = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.quantity > 0 && x.enable && x.location_state == LocationStateEnum.Stroge.ToString()).OrderByDescending(x => x.column).ToList();
                                foreach (var stationinfo in stationinfos)
                                var stationinfo = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.enable && x.quantity > 0).OrderByDescending(x => x.column).FirstOrDefault();
                                if (stationinfo != null)
                                {
                                    if (stationinfo.location_state == LocationStateEnum.OutBusy.ToString() || stationinfo.location_state != LocationStateEnum.Stroge.ToString()) continue;
                                    if (string.IsNullOrEmpty(stationinfo.bindSN))
                                    {
                                        stationinfo.remark = "车轮SN号信息异常";
@@ -68,75 +71,73 @@
                                    }
                                    #region è´§ä½è½¦è½®å…¨éƒ¨åŒ…含在工单内则下发任务
                                    bool OK = false;
                                    //bool OK = false;
                                    foreach (var SN in lists)
                                    {
                                        OK = mes_DetailRepository.Find(x => x.jobID == mes_head.jobID && x.SN == SN).Any();
                                    }
                                    if (OK)
                                    {
                                        dt_agvtask agvtask = new dt_agvtask()
                                        {
                                            agv_fromaddress = stationinfo.stationCode,
                                            agv_id = Guid.NewGuid(),
                                            agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                                            agv_grade = 1,
                                            agv_createtime = DateTime.Now,
                                            agv_taskstate = "Queue",
                                            agv_materielid = stationinfo.stationType,
                                            agv_qty = stationinfo.quantity,
                                            agv_tasktype = "TaskType_Outbound",
                                            agv_toaddress = "",
                                            agv_userid = "系统",
                                            bindSN = stationinfo.bindSN,
                                            jobID = mes_head.jobID,
                                            agv_worktype = Convert.ToInt32(mes_head.processCode),
                                            agv_materbarcode = mes_head.materialCode,
                                            agv_Traytype = stationinfo.tray_type,
                                            agv_TrayStatus = stationinfo.tray_status
                                        };
                                        stationinfo.location_state = LocationStateEnum.OutBusy.ToString();
                                        stationinfoRepository.Update(stationinfo, true);
                                        agvtaskRepository.Add(agvtask, true);
                                        WriteDBLog.Success("创建出库任务", $"任务编号:{agvtask.agv_tasknum}", "PCS");
                                        continue;
                                    }
                                    #endregion
                                        if (!mes_DetailRepository.Find(x => x.jobID == mes_head.jobID && x.SN.Contains(SN)).Any()) return;
                                    #region è´§ä½è½¦è½®æœ‰ä¸€ä¸ªåŒ…含在工单内则下发任务
                                    //foreach (var SN in lists)
                                    //{
                                    //    if (mes_DetailRepository.Find(x => x.jobID == mes_head.jobID && x.SN == SN).Any())
                                    //    {
                                    //        dt_agvtask agvtask = new dt_agvtask()
                                    //        {
                                    //            agv_fromaddress = stationinfo.stationCode,
                                    //            agv_id = Guid.NewGuid(),
                                    //            agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                                    //            agv_grade = 2,
                                    //            agv_createtime = DateTime.Now,
                                    //            agv_taskstate = "Queue",
                                    //            agv_materielid = stationinfo.stationType,
                                    //            agv_qty = stationinfo.quantity,
                                    //            agv_tasktype = "TaskType_Outbound",
                                    //            agv_toaddress = "",
                                    //            agv_userid = "系统",
                                    //            bindSN = stationinfo.bindSN,
                                    //            jobID = mes_head.jobID,
                                    //            agv_worktype = Convert.ToInt32(mes_head.processCode),
                                    //            agv_materbarcode = mes_head.materialCode,
                                    //            agv_Traytype = stationinfo.tray_type,
                                    //            agv_TrayStatus = stationinfo.tray_status
                                    //        };
                                    //        stationinfo.location_state = LocationStateEnum.OutBusy.ToString();
                                    //        stationinfoRepository.Update(stationinfo, true);
                                    //        agvtaskRepository.Add(agvtask, true);
                                    //        WriteDBLog.Success("创建出库任务", $"任务编号:{agvtask.agv_tasknum}", "PCS");
                                    //        continue;
                                    //    }
                                    //}
                                    }
                                    dt_agvtask agvtask = new dt_agvtask()
                                    {
                                        agv_fromaddress = stationinfo.stationCode,
                                        agv_id = Guid.NewGuid(),
                                        agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                                        agv_grade = 1,
                                        agv_createtime = DateTime.Now,
                                        agv_taskstate = "Queue",
                                        agv_materielid = stationinfo.stationType,
                                        agv_qty = stationinfo.quantity,
                                        agv_tasktype = "TaskType_Outbound",
                                        agv_toaddress = "",
                                        agv_userid = "系统",
                                        bindSN = stationinfo.bindSN,
                                        jobID = mes_head.jobID,
                                        agv_worktype = Convert.ToInt32(mes_head.processCode),
                                        agv_materbarcode = mes_head.materialCode,
                                        agv_Traytype = stationinfo.tray_type,
                                        agv_TrayStatus = stationinfo.tray_status
                                    };
                                    stationinfo.location_state = LocationStateEnum.OutBusy.ToString();
                                    stationinfoRepository.Update(stationinfo, true);
                                    agvtaskRepository.Add(agvtask, true);
                                    WriteDBLog.Success("创建出库任务", $"任务编号:{agvtask.agv_tasknum}", "PCS");
                                    continue;
                                    #endregion
                                }
                                #region è´§ä½è½¦è½®æœ‰ä¸€ä¸ªåŒ…含在工单内则下发任务
                                //foreach (var SN in lists)
                                //{
                                //    if (mes_DetailRepository.Find(x => x.jobID == mes_head.jobID && x.SN == SN).Any())
                                //    {
                                //        dt_agvtask agvtask = new dt_agvtask()
                                //        {
                                //            agv_fromaddress = stationinfo.stationCode,
                                //            agv_id = Guid.NewGuid(),
                                //            agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                                //            agv_grade = 2,
                                //            agv_createtime = DateTime.Now,
                                //            agv_taskstate = "Queue",
                                //            agv_materielid = stationinfo.stationType,
                                //            agv_qty = stationinfo.quantity,
                                //            agv_tasktype = "TaskType_Outbound",
                                //            agv_toaddress = "",
                                //            agv_userid = "系统",
                                //            bindSN = stationinfo.bindSN,
                                //            jobID = mes_head.jobID,
                                //            agv_worktype = Convert.ToInt32(mes_head.processCode),
                                //            agv_materbarcode = mes_head.materialCode,
                                //            agv_Traytype = stationinfo.tray_type,
                                //            agv_TrayStatus = stationinfo.tray_status
                                //        };
                                //        stationinfo.location_state = LocationStateEnum.OutBusy.ToString();
                                //        stationinfoRepository.Update(stationinfo, true);
                                //        agvtaskRepository.Add(agvtask, true);
                                //        WriteDBLog.Success("创建出库任务", $"任务编号:{agvtask.agv_tasknum}", "PCS");
                                //        continue;
                                //    }
                                //}
                                #endregion
                            }
                        }
                    }
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ÐÂÎļþ¼Ð/RestockHCJ_a.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using WIDESEA_Comm;
using WIDESEA_Comm.LogInfo;
using WIDESEA_Core.BaseProvider;
using WIDESEA_Core.EFDbContext;
using WIDESEA_Entity.DomainModels;
using WIDESEA_WCS.IRepositories;
using WIDESEA_WCS.Repositories;
using WIDESEA_WCS.WCSClient;
using WIDESEA_WMS.IRepositories;
using WIDESEA_WMS.IServices;
using WIDESEA_WMS.Repositories;
namespace WIDESEA_WCS.JobsPart.Common
{
    public class RestockHCJ_a
    {
        /// <summary>
        /// æ›´æ–°é˜Ÿåˆ—任务
        /// </summary>
        public static void HCJGetBarcode()
        {
            try
            {
                VOLContext Context = new VOLContext();
                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
                Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context);
                var tasks = agvtaskService.Find(x => x.agv_taskstate == "Queue").OrderBy(x => x.agv_createtime).ToList();
                foreach (var task in tasks)
                {
                    if (task.agv_tasktype == "TaskType_EmptyPallet")//空托任务
                    {
                        if (task.agv_fromaddress == "")
                        {
                            var Pipeline_client = PLCClient.Clients.FirstOrDefault(t => t.PLCName == "链条机");
                            if (Pipeline_client == null) throw new Exception("链条机调度服务未开启!");
                            if (!Pipeline_client.IsConnected) throw new Exception("与链条机连接超时!");
                            var area = task.agv_Traytype == "SmallTray" ? "11" : "10";
                            #region æŸ¥æ‰¾ä¸€åº“区的空托盘库位
                            var EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.stationCode.Contains("A") && x.enable).OrderBy(x => x.column).OrderBy(x => x.line).FirstOrDefault();
                            if (EmptyStation == null) return;
                            if (EmptyStation == null)
                                EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.stationCode.Contains("A") && x.location_state == LocationStateEnum.Stroge.ToString() && x.enable).OrderBy(x => x.line).OrderBy(x => x.column).FirstOrDefault();
                            #endregion
                        }
                    }
                    else if (task.agv_tasktype == "TaskType_OutsourceOutbound" || task.agv_tasktype == "TaskType_Outbound")//外协库出库/AB库出库
                    {
                        if (task.agv_toaddress == "")
                        {
                            var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001") && x.location_state == "Empty" && x.enable).ToList();
                            foreach (var EmptyStation in EmptyStations)
                            {
                                if (agvtaskService.Find(x => x.agv_toaddress == EmptyStation.stationCode).Any()) continue;
                                task.agv_taskstate = "Create";
                                task.agv_toaddress = EmptyStation.stationCode;
                                EmptyStation.location_state = LocationStateEnum.Busy.ToString();
                                stationinfoRepository.Update(EmptyStation, true);
                                agvtaskService.Update(task, true);
                                WriteDBLog.Success("更新出库队列任务", $"任务编号:{task.agv_tasknum}", "PCS");
                                return;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                WriteDBLog.Error("更新队列任务", $"错误信息:{ex.Message}", "PCS");
            }
        }
    }
}
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Services/WCS/Partial/VV_DispatchService.cs
@@ -63,6 +63,8 @@
            {
                if (!scheduler.IsRun())
                {
                    WIDESEA.Helper.GetToken();
                    var cooRes = CoonPLC();
                    var startRes = SrartScheduler();
                    if (startRes.Status)