分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-05-19 429bb4abbaea6fd6be33dcf62735d4ada5070b63
优化逻辑提高AGV任务效率
已修改18个文件
已添加4个文件
809 ■■■■ 文件已修改
代码管理/PCS/WCS_Server/WIDESEA_Comm/StateEnum/LocationStateEnum.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/EmptyTrayTask.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/新文件夹/GetLocation.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_Entity/ToAGV/RequestTask.cs 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/AGVServer.cs 71 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/EmptyPalletTask.cs 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/Request.cs 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendFromaddress.cs 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendToaddress.cs 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/UploadMesInfo/AGVAPIAddress.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyPalletStation.cs 104 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyTrayIn.cs 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/ToMes/shiftingparking.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobTask.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WebApi/appsettings.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_Comm/StateEnum/LocationStateEnum.cs
@@ -31,6 +31,10 @@
        /// <summary>
        /// å¼‚常
        /// </summary>
        Abnormal
        Abnormal,
        /// <summary>
        /// æ¡æž¶ä¸‹æ–™
        /// </summary>
        Load
    }
}
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs
@@ -12,6 +12,7 @@
using WIDESEA_Comm.LogInfo;
using WIDESEA_Comm.TaskNo;
using WIDESEA_Core.EFDbContext;
using WIDESEA_Core.Extensions;
using WIDESEA_Core.FreeDB;
using WIDESEA_Entity.DomainModels;
using WIDESEA_WCS.IRepositories;
@@ -544,7 +545,7 @@
                                    station.heatNumber = Mes_Work.heatID;
                                    station.tray_status = "StrogeTray";
                                }
                                station.remark = "";
                                var count = stationinfoRepository.Update(station, true);
                                if (count < 1)
                                    throw new Exception($"下料位信息更新失败!下料位编号:{station.stationCode}");
@@ -580,8 +581,6 @@
                        var Request = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Request_Load").First(), client);
                        if (!Request) continue;
                        //var Area = client.ReadByOrder<Int16>("W_AreaNr", name);//读取货位号信息
                        //if (Area != 0) continue;
                        #region è¯»å–桁架信息
                        var Wheel_Type = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_Type").First(), client);//车轮类型
@@ -599,6 +598,7 @@
                            client.WriteByOrder("W_Enabl_Load", false, name);//信号为false桁架停止进入
                            //WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN:{Wheel_id}\n\n未查询到工单信息", "PCS");
                            WriteLog.Write_Log(name + "申请放料异常", Wheel_id, "查询机加工工单", $"读取桁架信息:\n车轮SN号:{Wheel_id}未查询到工单信息\n写入桁架信息:\n是否允许下料:{false}");
                            continue;
                        }
@@ -615,6 +615,8 @@
                        #endregion
                        var wheel = Pipeline.QueryMateriel(Work.drawingNo);
                        var wheel1 = Pipeline.QueryMateriel1(Work.drawingNo);
                        if (wheel == null && wheel1 == null)
@@ -626,6 +628,17 @@
                            #endregion
                            continue;
                        }
                        #region æ¢å›¾å·,下料口其他图号托盘全部入库
                        var stations = Stations.Where(x => x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0 && x.stationType != Work.drawingNo).ToList();
                        foreach (var station in stations)
                        {
                            if (station.stationCode == NGStation || name == "3单元下料区")
                                agvtask(stationinfoRepository, station, Work, "TaskType_OutsourceInbound");
                            else
                                agvtask(stationinfoRepository, station, Work, "TaskType_Inbound");
                        }
                        #endregion
                        var PartStatus = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PartStatus").First(), client);//1:ok;2:nok
@@ -669,12 +682,9 @@
                            if (Stationinfo == null)
                            {
                                #region è§¦å‘NG任务
                                var NG = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault();
                                var NG = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.Number != Work.workOrder && x.quantity > 0).FirstOrDefault();
                                if (NG != null)
                                {
                                    if (NG.stationType != Work.drawingNo || NG.Number != Work.workOrder)
                                        agvtask(stationinfoRepository, NG, Work, "TaskType_OutsourceInbound");
                                }
                                    agvtask(stationinfoRepository, NG, Work, "TaskType_OutsourceInbound");
                                #endregion
                                Stationinfo = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 0).FirstOrDefault();
@@ -685,9 +695,9 @@
                            {
                                #region æ¢ç±»åž‹ç›´æŽ¥å…¥åº“
                                var stationinfo1 = Stations.Where(x => x.enable && x.stationCode != NGStation && x.stationCode != Stationinfo.stationCode && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0 && x.stationType != Work.drawingNo).FirstOrDefault();
                                if (stationinfo1 != null)
                                    agvtask(stationinfoRepository, stationinfo1, Work, name == "3单元下料区" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
                                //var stationinfo1 = Stations.Where(x => x.enable && x.stationCode != NGStation && x.stationCode != Stationinfo.stationCode && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0 && x.stationType != Work.drawingNo).FirstOrDefault();
                                //if (stationinfo1 != null)
                                //    agvtask(stationinfoRepository, stationinfo1, Work, name == "3单元下料区" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
                                #endregion
                                #region æ‰˜ç›˜è½¦è½®å †åž›ç¬¬å››ä¸ªæ—¶ä¸‹å‘另外一个炉号的入库任务
@@ -769,6 +779,8 @@
                                    client.WriteByOrder("W_IndexNr", (Int16)(Stationinfo.quantity + 1), name);//托盘上的第几个车轮
                                    client.WriteByOrder("W_Storage_Type", (Int16)1, name);//托盘类型1-横放;2-竖放(暂时只有横放托盘)
                                    client.WriteByOrder("W_Enabl_Load", true, name);//是否允许
                                    Stationinfo.remark = "桁架下料";
                                    stationinfoRepository.Update(Stationinfo, true);
                                    #region æ—¥å¿—记录
                                    //WriteDBLog.Success(name + "允许放料", $"读取桁架信息:\n车轮SN:{Wheel_id}\n轮型ID:{Wheel_Type}\n车轮状态:OK" +$"\n读取托盘光电信号:{PalletSignal}" +
                                    //    $"\n\n写入桁架信息:\n下料位号:{area}\n第几个车轮:{(Stationinfo.quantity + 1)}\n托盘类型:1\nW_Enabl_Load:true", "PCS");
@@ -785,7 +797,7 @@
                                #region æ²¡æ‰˜ç›˜å¯ç”¨,触发入库任务
                                if (!Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state != LocationStateEnum.Stroge.ToString()).Any())
                                {
                                    var station = Stations.Where(x => x.enable && x.stationCode != NGStation).OrderBy(x => x.lastUpdateTime).FirstOrDefault();
                                    var station = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString()).OrderBy(x => x.lastUpdateTime).FirstOrDefault();
                                    agvtask(stationinfoRepository, station, Work, name == "3单元下料区" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
                                }
                                #endregion
@@ -827,6 +839,7 @@
                                    Stationinfo.tray_type = Stationinfo.tray_type == "SmallTray" ? "SmallTray/LargeTray" : "LargeTray/SmallTray";
                                    Stationinfo.remark = "托盘类型不一致需更换托盘";
                                    stationinfoRepository.Update(Stationinfo, true);
                                    continue;
                                }
                                #endregion
                                var Pipelinedetails = plcRepository.Find(x => x.plcdetail_iotype == Pipelineplc.plcinfo_iotyep && x.plcdetail_number == Stationinfo.stationCode).ToList();
@@ -880,6 +893,8 @@
                                    client.WriteByOrder("W_IndexNr", (Int16)(Stationinfo.quantity + 1), name);//托盘上的第几个车轮
                                    client.WriteByOrder("W_Storage_Type", (Int16)1, name);//托盘类型1-横放;2-竖放(暂时只有横放托盘)
                                    client.WriteByOrder("W_Enabl_Load", true, name);//是否允许
                                    Stationinfo.remark = "桁架下料";
                                    stationinfoRepository.Update(Stationinfo, true);
                                    #region æ—¥å¿—记录
                                    //WriteDBLog.Success(name + "允许放料", $"读取桁架信息:\n车轮SN:{Wheel_id}\n轮型ID:{Wheel_Type}\n车轮状态:NG" +$"\n读取托盘光电信号:{PalletSignal}" +
                                    //    $"\n\n写入桁架信息:\n下料位号:{area}\n第几个车轮:{(Stationinfo.quantity + 1)}\n托盘类型:1\nW_Enabl_Load:true", "PCS");
@@ -914,6 +929,8 @@
        {
            VOLContext Context = new VOLContext();
            Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
            IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(Context);
            Work = workinfoRepository.Find(x => x.workOrder == stationinfo.Number && x.processCode == "17").FirstOrDefault();
            var task = agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).FirstOrDefault();
            if (task != null) return;
            if (!string.IsNullOrEmpty(Work.area))
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/EmptyTrayTask.cs
@@ -35,16 +35,19 @@
                Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context);
                List<string> strings = new List<string>() { };
                var stations = stationinfoRepository.Find(x => x.stationCode.Contains("X") || x.stationCode.Contains("W01001004") || x.stationCode.Contains("W01001005")).ToList();
                stations = stations.Where(x => x.location_state == "Empty" && x.enable).ToList();
                stations = stations.Where(x => x.location_state == LocationStateEnum.Empty.ToString() && x.enable).ToList();
                foreach (var station in stations)
                {
                    if (agvtaskRepository.Find(x => x.agv_toaddress == station.stationCode).Any())
                        continue;
                    var PalletSignal = Pipeline_client.ReadByOrder<Int16>("R_PalletSignal", station.stationCode);//读取托盘信号:1:有,2无
                    var MaterialSignal = Pipeline_client.ReadByOrder<Int16>("R_MaterialSignal", station.stationCode);//读取货物信号:1:有,2无
                    if (PalletSignal == 2 && MaterialSignal == 2)
                    {
                        var agv_task = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && string.IsNullOrEmpty(x.agv_toaddress)).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
                        if (station.remark == TrayTypeEnum.SmallTray.ToString() || station.remark == TrayTypeEnum.LargeTray.ToString()) station.tray_type = station.remark;
                        var agv_task = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && string.IsNullOrEmpty(x.agv_toaddress) && x.agv_Traytype == station.tray_type).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
                        if (agv_task != null)
                        {
                            agv_task.agv_taskstate = AGVTaskStateEnum.Create.ToString();
@@ -64,12 +67,12 @@
                                agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                                agv_grade = station.stationCode.Contains("W0100100") ? 3 : 2,
                                agv_createtime = DateTime.Now,
                                agv_taskstate = "Queue",
                                agv_taskstate = AGVTaskStateEnum.Queue.ToString(),
                                agv_qty = 1,
                                agv_tasktype = "TaskType_EmptyPallet",
                                agv_tasktype = AGVTaskTypeEnum.TaskType_EmptyPallet.ToString(),
                                agv_toaddress = station.stationCode,
                                agv_userid = "系统",
                                agv_TrayStatus = "EmptyTray",// station.tray_status,
                                agv_TrayStatus = TrayStateEnum.EmptyTray.ToString(),// station.tray_status,
                                agv_Traytype = station.tray_type
                            };
                            station.location_state = LocationStateEnum.Busy.ToString();
@@ -77,7 +80,7 @@
                            agvtaskRepository.Add(taskPart, true);
                            WriteDBLog.Success("创建补空托任务", $"任务编号:{taskPart.agv_tasknum}", "PCS");
                        }
                    }
                }
            }
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs
@@ -76,7 +76,15 @@
                VOLContext Context = new VOLContext();
                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
                var station = stationinfoRepository.Find(x => x.stationCode == StationCode).FirstOrDefault();
                OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column > station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any();
                if (station.area == "10" || station.area == "11")
                {
                    OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column < station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any();
                }
                else
                {
                    OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column > station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any();
                }
            }
            catch (Exception ex)
            {
@@ -124,25 +132,40 @@
                var area = task.agv_Traytype == "SmallTray" ? "11" : "10";
                #region ä¼˜å…ˆå‡º3库区内空托盘
                //if (area == "11")
                //{
                //    EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01004002" /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault();
                //    if (EmptyStation == null)
                //        EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01005002"/* && x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault();
                //    if (EmptyStation != null)
                //        EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.area == EmptyStation.area && x.line == EmptyStation.line /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
                //    if (EmptyStation != null)//空托货位不为空判断是否存在其他任务
                //        if (stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) EmptyStation = null;
                //    //if (EmptyStation.location_state == LocationStateEnum.Busy.ToString()) EmptyStation = null;
                //}
                #endregion
                #region æŸ¥æ‰¾AB库区可出库空托货位
                if (area == "11")
                {
                    EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01004002" /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault();
                    if (EmptyStation == null)
                        EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01005002"/* && x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault();
                    if (EmptyStation != null)
                        EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.area == EmptyStation.area && x.line == EmptyStation.line /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
                    if (EmptyStation != null)//空托货位不为空判断是否存在其他任务
                        if (stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) EmptyStation = null;
                    //if (EmptyStation.location_state == LocationStateEnum.Busy.ToString()) EmptyStation = null;
                    //EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && (x.area == "2" || x.area == "3") && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderByDescending(x => x.lastUpdateTime).FirstOrDefault();
                    EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && (x.area == "2" || x.area == "3") && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderBy(x => x.area).ThenBy(x => x.line).ThenByDescending(x => x.column).FirstOrDefault();
                    if (EmptyStation != null)//必须出完AB库空托才能出空托区
                        if (QueueStation(EmptyStation.stationCode) || stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) return;// EmptyStation = null;
                }
                #endregion
                #region æŸ¥æ‰¾ç©ºæ‰˜åº“区
                if (EmptyStation == null)
                    EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.area == area /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).OrderBy(x => x.column).FirstOrDefault();
                    EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.area == area && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault();
                #endregion
                #region ç©ºæ‰˜è´§ä½ä¸ä¸ºç©ºåˆ¤æ–­æ˜¯å¦å­˜åœ¨å…¶ä»–任务
                if (EmptyStation != null)
                    if (stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) EmptyStation = null;
                //if (EmptyStation.location_state == LocationStateEnum.Busy.ToString()) EmptyStation = null;
                    if (QueueStation(EmptyStation.stationCode) || stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) EmptyStation = null;
                #endregion
                #region æ›´æ–°è¡¥ç©ºæ‰˜é˜Ÿåˆ—任务
                if (EmptyStation != null)
                {
                    var PalletSignal = Pipeline_client.ReadByOrder<Int16>("R_PalletSignal", task.agv_toaddress);//读取托盘信号:1:有,2无
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs
@@ -34,7 +34,7 @@
                Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context);
                IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(context);
                var Mes_Works = workinfoRepository.Find(x => x.processCode == "28").OrderBy(x => x.CreateTime).ToList();
                var Mes_Works = workinfoRepository.Find(x => x.processCode == "28").OrderByDescending(x => x.CreateTime).ToList();
                foreach (var Mes_Work in Mes_Works)
                {
                    var inventory = inventoryRepository.Find(x => x.SN == Mes_Work.SN).FirstOrDefault();
@@ -53,6 +53,8 @@
                            stationinfo = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.column).FirstOrDefault();
                            if (stationinfo != null)
                            {
                                if (agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).Any()) continue;
                                if (stationinfoRepository.Find(x => x.line == stationinfo.line && x.area == stationinfo.area && x.column > stationinfo.column && !x.enable).Any())
                                    continue;
                                if (string.IsNullOrEmpty(stationinfo.bindSN))
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs
@@ -49,7 +49,7 @@
        #endregion
        /// <summary>
        /// åˆ›å»ºæ›´æ¢æ‰˜ç›˜ä»»åŠ¡
        /// åˆ›å»ºæ›´æ¢æ‰˜ç›˜ä»»åŠ¡,需修改
        /// </summary>
        public static void ReplaceTrayTask()
        {
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs
@@ -172,7 +172,6 @@
                        else
                            GetStation.EmptyPalletStation(agvtask);
                    }
                    WriteDBLog.Success("更新空托队列任务", $"任务编号:{agvtask.agv_tasknum}", "PCS");
                }
                else if (agvtask.agv_tasktype == AGVTaskTypeEnum.TaskType_OutsourceInbound.ToString() || agvtask.agv_tasktype == AGVTaskTypeEnum.TaskType_Inbound.ToString())//外协库入库/AB库入库
                {
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ÐÂÎļþ¼Ð/GetLocation.cs
@@ -39,7 +39,7 @@
                    dt_stationinfo TargetLocation = null;
                    #region å¯»æ‰¾å·²åˆ†é…åŒå›¾å·å…¥åº“任务库位
                    TargetLocation = area1 == "4" ? stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && x.area == area1).FirstOrDefault() : stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && (x.area == "2" || x.area == "3")).FirstOrDefault();
                    TargetLocation = area1 == "4" ? stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && x.enable && x.area == area1).FirstOrDefault() : stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && (x.area == "2" || x.area == "3") && x.enable).FirstOrDefault();
                    if (TargetLocation != null)
                    {
                        TargetLocation = stationinfoRepository.Find(x => x.line == TargetLocation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == TargetLocation.area).OrderBy(x => x.column).FirstOrDefault();
@@ -132,11 +132,11 @@
                    #region æœªæ‰¾åˆ°åº“存或当前库存行已满,寻找新的一行
                    var area = GetArea(mesinfo.quantity, agvtask.agv_Traytype);
                    TargetLocation = stationinfoRepository.Find(x => x.column == (area == "2" ? 1 : 2) && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault();
                    TargetLocation = stationinfoRepository.Find(x => x.column == (area == "2" ? 1 : 2) && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).FirstOrDefault();
                    if (TargetLocation == null && area != "4")
                    {
                        area = area == "2" ? "3" : "2";
                        TargetLocation = stationinfoRepository.Find(x => x.column == (area == "2" ? 1 : 2) && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault();
                        TargetLocation = stationinfoRepository.Find(x => x.column == (area == "2" ? 1 : 2) && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).FirstOrDefault();
                    }
                    #region æŸ¥çœ‹å½“前空货位后是否存在有料
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json
@@ -16,8 +16,8 @@
  "Connection": {
    "DBType": "MsSql", //MySql/MsSql/PgSql  //数据库类型,如果使用的是sqlserver此处应设置为MsSql
    //sqlserver连接字符串P@ssw0rd
    "DbConnectionString": "Data Source=192.168.12.101;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=123456;Connect Timeout=500;",
    //"DbConnectionString": "Data Source=.;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;Connect Timeout=500;",
    //"DbConnectionString": "Data Source=192.168.12.101;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=123456;Connect Timeout=500;",
    "DbConnectionString": "Data Source=.;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;Connect Timeout=500;",
    //mysql连接字符串(升级EFCore3.1到时已将mysql连接字符串修改,2019-12-20)
    // "DbConnectionString": " Data Source=127.0.0.1;Database=netcoredev;AllowLoadLocalInfile=true;User ID=root;Password=123456;allowPublicKeyRetrieval=true;pooling=true;CharSet=utf8;port=3306;sslmode=none;",
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_Entity/ToAGV/RequestTask.cs
@@ -65,6 +65,122 @@
        #endregion
    }
    /// <summary>
    /// èµ·ç‚¹ä»»åŠ¡ä¸‹å‘ä¿¡æ¯
    /// </summary>
    public class RequestFromTask
    {
        /// <summary>
        /// ä½œä¸šä»»åŠ¡å·
        /// </summary>
        public string TASK_NO { get; set; }
        /// <summary>
        /// èµ·ç‚¹
        /// </summary>
        public string FROM_POSITION { get; set; }
        /// <summary>
        /// ç»ˆç‚¹
        /// </summary>
        //public string TO_POSITION { get; set; }
        /// <summary>
        /// ä»»åŠ¡ç­‰çº§
        /// </summary>
        public int? Grade { get; set; } = 0;
        /// <summary>
        /// æ•°é‡
        /// </summary>
        public int Quantity { get; set; }
        ///<summary>
        /// è½¬è¿æ‰˜ç›˜æ—¶ï¼Œèµ·ç‚¹åº•部几个托盘,入堆叠完全部转运则为0,如果转运五层上的一个则为4,上面数量则为1
        ///</summary>
        public int StarQuantity { get; set; }
        ///<summary>
        /// è½¬è¿æ‰˜ç›˜æ—¶ï¼Œç»ˆç‚¹åº•部几个托盘,入堆叠完全部转运则为0,如果转运五层上的一个则为4,上面数量则为1
        ///</summary>
        public int EndQuantity { get; set; }
        /// <summary>
        /// æ‰˜ç›˜ç±»åž‹ 1小托盘,2大托盘
        /// </summary>
        public int TrayType { get; set; }
        /// <summary>
        /// ä»»åŠ¡ç±»åž‹ 1转运车轮任务,2转运空托盘任务
        /// </summary>
        public int TaskType { get; set; }
        /// <summary>
        /// ç‰©æ–™ä¿¡æ¯
        /// </summary>
        public string Material { get; set; }
        #region è½¦è½®æ•°æ®
        public float A { get; set; }
        public float B { get; set; }
        public float C { get; set; }
        public float D { get; set; }
        public float E { get; set; }
        public float F { get; set; }
        public float G { get; set; }
        public float H { get; set; }
        #endregion
    }
    /// <summary>
    /// ç»ˆç‚¹ä»»åŠ¡ä¸‹å‘ä¿¡æ¯
    /// </summary>
    public class RequestToaddTask
    {
        /// <summary>
        /// ä½œä¸šä»»åŠ¡å·
        /// </summary>
        public string TASK_NO { get; set; }
        /// <summary>
        /// èµ·ç‚¹
        /// </summary>
        //public string FROM_POSITION { get; set; }
        /// <summary>
        /// ç»ˆç‚¹
        /// </summary>
        public string TO_POSITION { get; set; }
        /// <summary>
        /// ä»»åŠ¡ç­‰çº§
        /// </summary>
        public int? Grade { get; set; } = 0;
        /// <summary>
        /// æ•°é‡
        /// </summary>
        public int Quantity { get; set; }
        ///<summary>
        /// è½¬è¿æ‰˜ç›˜æ—¶ï¼Œèµ·ç‚¹åº•部几个托盘,入堆叠完全部转运则为0,如果转运五层上的一个则为4,上面数量则为1
        ///</summary>
        public int StarQuantity { get; set; }
        ///<summary>
        /// è½¬è¿æ‰˜ç›˜æ—¶ï¼Œç»ˆç‚¹åº•部几个托盘,入堆叠完全部转运则为0,如果转运五层上的一个则为4,上面数量则为1
        ///</summary>
        public int EndQuantity { get; set; }
        /// <summary>
        /// æ‰˜ç›˜ç±»åž‹ 1小托盘,2大托盘
        /// </summary>
        public int TrayType { get; set; }
        /// <summary>
        /// ä»»åŠ¡ç±»åž‹ 1转运车轮任务,2转运空托盘任务
        /// </summary>
        public int TaskType { get; set; }
        /// <summary>
        /// ç‰©æ–™ä¿¡æ¯
        /// </summary>
        public string Material { get; set; }
        #region è½¦è½®æ•°æ®
        public float A { get; set; }
        public float B { get; set; }
        public float C { get; set; }
        public float D { get; set; }
        public float E { get; set; }
        public float F { get; set; }
        public float G { get; set; }
        public float H { get; set; }
        #endregion
    }
    /// <summary>
    /// AGV反馈信息
    /// </summary>
    public class Respone
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/AGVServer.cs
@@ -25,23 +25,24 @@
        /// </summary>
        public static void SendAgvTask()
        {
            WriteLog.Write_Log("自动下发任务", "SendAgvTask","");
            WriteLog.Write_Log("自动下发任务", "SendAgvTask", "");
            Respone respone = new Respone();
            RequestTask requestTask = new RequestTask();
            string postJson = string.Empty;
            string report = string.Empty;
            try
            VOLContext Context = new VOLContext();
            Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
            var agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == "Create" && string.IsNullOrEmpty(x.agv_remark)).OrderByDescending(x => x.agv_grade)
                    .ThenBy(x => x.agv_createtime).ToList();
            if (agv_tasks.Count < 1)
                agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == "Create" && !string.IsNullOrEmpty(x.agv_remark)).OrderByDescending(x => x.agv_grade)
                    .ThenBy(x => x.agv_createtime).ToList();
            if (agv_tasks.Count > 0)
            {
                VOLContext Context = new VOLContext();
                Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
                var agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == "Create" && string.IsNullOrEmpty(x.agv_remark)).OrderByDescending(x => x.agv_grade)
                        .ThenBy(x => x.agv_createtime).ToList();
                if (agv_tasks.Count < 1)
                    agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == "Create" && !string.IsNullOrEmpty(x.agv_remark)).OrderByDescending(x => x.agv_grade)
                        .ThenBy(x => x.agv_createtime).ToList();
                if (agv_tasks.Count > 0)
                foreach (var agv_task in agv_tasks)
                {
                    foreach (var agv_task in agv_tasks)
                    try
                    {
                        var Materiel = QueryData.QueryMateriel(agv_task.agv_materielid);//查找车轮数据
                        var Materiel1 = QueryData.QueryMateriel1(agv_task.agv_materielid);//查找车轮数据
@@ -75,32 +76,34 @@
                            requestTask.H = Materiel == null ? Materiel1.h : Materiel.h;
                        }
                        postJson = JsonConvert.SerializeObject(requestTask);
                        report = Request.RequestData(postJson, "http://192.168.12.204:5000/api/TaskCreat/CreatTask");
                        respone = JsonConvert.DeserializeObject<Respone>(report);
                        if (respone.Success)
                        {
                            agv_task.agv_taskstate = AGVTaskStateEnum.SendOut.ToString();
                            agv_task.agv_realesstime = DateTime.Now;
                            agvtaskRepository.Update(agv_task, true);
                            WriteWMSLog.LogAdd(requestTask.TASK_NO, "成功 ", "AGV", "WMS", postJson, report, "下发AGV任务", "SendAGVTask", respone.Msg);
                        }
                        else
                        {
                            agv_task.agv_remark = respone.Msg;
                            var task = agvtaskRepository.Find(x => x.agv_tasknum == agv_task.agv_tasknum && x.agv_remark == agv_task.agv_remark).FirstOrDefault();//.Exists
                            if (task == null)
                                agvtaskRepository.Update(agv_task, true);
                            WriteWMSLog.LogAdd(requestTask.TASK_NO, "失败 ", "AGV", "WMS", postJson, report, "下发AGV任务", "SendAGVTask", respone.Msg);
                        }
                        //report = Request.RequestData(postJson, AGVAPIAddress.IPAddress_AGVTask);//"http://192.168.12.204:5000/api/TaskCreat/CreatTask"
                        RequestAGV(agvtaskRepository, agv_task, postJson, AGVAPIAddress.IPAddress_AGVTask);
                        //respone = JsonConvert.DeserializeObject<Respone>(report);
                        //if (respone.Success)
                        //{
                        //    agv_task.agv_taskstate = AGVTaskStateEnum.SendOut.ToString();
                        //    agv_task.agv_realesstime = DateTime.Now;
                        //    agvtaskRepository.Update(agv_task, true);
                        //    WriteWMSLog.LogAdd(requestTask.TASK_NO, "成功 ", "AGV", "WMS", postJson, report, "下发AGV任务", "SendAGVTask", respone.Msg);
                        //}
                        //else
                        //{
                        //    agv_task.agv_remark = respone.Msg;
                        //    var task = agvtaskRepository.Find(x => x.agv_tasknum == agv_task.agv_tasknum && x.agv_remark == agv_task.agv_remark).FirstOrDefault();//.Exists
                        //    if (task == null)
                        //        agvtaskRepository.Update(agv_task, true);
                        //    WriteWMSLog.LogAdd(requestTask.TASK_NO, "失败 ", "AGV", "WMS", postJson, report, "下发AGV任务", "SendAGVTask", respone.Msg);
                        //}
                    }
                    catch (Exception ex)
                    {
                        respone.Success = false;
                        respone.Msg = ex.Message;
                        WriteWMSLog.LogAdd(requestTask.TASK_NO, "失败", "AGV", "WMS", postJson, report, "下发AGV任务", "SendAGVTask", respone.Msg);
                    }
                }
            }
            catch (Exception ex)
            {
                respone.Success = false;
                respone.Msg = ex.Message;
                WriteWMSLog.LogAdd(requestTask.TASK_NO, "失败", "AGV", "WMS", postJson, report, "下发AGV任务", "SendAGVTask", respone.Msg);
            }
        }
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/EmptyPalletTask.cs
@@ -29,61 +29,75 @@
                Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
                #region å ç›˜åŒºæ»¡5个入库
                #region å ç›˜åŒºæ»¡5个入库 éœ€ä¼˜åŒ–
                var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.enable).ToList();
                var EmptyD = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 5).FirstOrDefault();
                if (EmptyD != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyD);
                //EmptyD = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0&&x.lastUpdateTime.).FirstOrDefault();//时间超过6小时入库
                #endregion
                var agv_task = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && string.IsNullOrEmpty(x.agv_toaddress)).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
                if (agv_task != null)
                var agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && string.IsNullOrEmpty(x.agv_toaddress)).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).ToList();
                foreach (var agv_task in agv_tasks)
                {
                    tasknum = agv_task.agv_tasknum;
                    #region MyRegion
                    //var task = agvtaskRepository.Find(x => (x.agv_toaddress.Contains("W") || x.agv_toaddress.Contains("X")) && x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && x.agv_Traytype == agv_task.agv_Traytype).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
                    //if (task != null)
                    //{
                    //    task.agv_fromaddress = station.stationCode;
                    //    task.StarQuantity = 0;
                    //    task.agv_taskstate = "Create";
                    //    if (station.stationCode.Contains("S0100100"))
                    //        task.agv_grade = 3;
                    //    agvtaskService.Update(task, true);
                    //    station.location_state = LocationStateEnum.Busy.ToString();
                    //    stationinfoRepository.Update(station, true);
                    //    WriteDBLog.Success("更新补空托队列任务", $"任务编号:{task.agv_tasknum},托盘信号:{PalletSignal},货物信号:{MaterialSignal}", "WMS");
                    //    return;
                    //}
                    #endregion
                    dt_stationinfo EmptyStation = null;
                    #region æ£€æµ‹ä¸Šæ–™çš„空托叠盘
                    if (agv_task.agv_fromaddress.Contains("S"))
                    try
                    {
                        //var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList();
                        EmptyStation = EmptyStations.Where(x => x.tray_type == agv_task.agv_Traytype && x.quantity < 5 && x.location_state == LocationStateEnum.Stroge.ToString()).FirstOrDefault();
                        if (EmptyStation == null)
                            EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Empty.ToString() && x.quantity == 0).FirstOrDefault();
                        if (EmptyStation == null)
                        tasknum = agv_task.agv_tasknum;
                        #region MyRegion
                        //var task = agvtaskRepository.Find(x => (x.agv_toaddress.Contains("W") || x.agv_toaddress.Contains("X")) && x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && x.agv_Traytype == agv_task.agv_Traytype).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
                        //if (task != null)
                        //{
                        //    task.agv_fromaddress = station.stationCode;
                        //    task.StarQuantity = 0;
                        //    task.agv_taskstate = "Create";
                        //    if (station.stationCode.Contains("S0100100"))
                        //        task.agv_grade = 3;
                        //    agvtaskService.Update(task, true);
                        //    station.location_state = LocationStateEnum.Busy.ToString();
                        //    stationinfoRepository.Update(station, true);
                        //    WriteDBLog.Success("更新补空托队列任务", $"任务编号:{task.agv_tasknum},托盘信号:{PalletSignal},货物信号:{MaterialSignal}", "WMS");
                        //    return;
                        //}
                        #endregion
                        #region MyRegion
                        //dt_stationinfo EmptyStation = null;
                        //#region æ£€æµ‹ä¸Šæ–™çš„空托叠盘
                        //if (agv_task.agv_fromaddress.Contains("S"))
                        //{
                        //    //var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList();
                        //    EmptyStation = EmptyStations.Where(x => x.tray_type == agv_task.agv_Traytype && x.quantity < 5 && x.location_state == LocationStateEnum.Stroge.ToString()).FirstOrDefault();
                        //    if (EmptyStation == null)
                        //        EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Empty.ToString() && x.quantity == 0).FirstOrDefault();
                        //    if (EmptyStation == null)
                        //    {
                        //        EmptyD = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.quantity).FirstOrDefault();
                        //        if (EmptyD != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyD);
                        //    }
                        //}
                        //#endregion
                        //else
                        //{
                        //    EmptyStation = GetStation.EmptyPalletStation1(agv_task.agv_Traytype == "SmallTray" ? "11" : "10");
                        //}
                        #endregion
                        var EmptyStation = EmptyTray.GetEmptyTrayStation(stationinfoRepository, agv_task);
                        if (EmptyStation != null)
                        {
                            EmptyD = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.quantity).FirstOrDefault();
                            if (EmptyD != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyD);
                            agv_task.agv_taskstate = AGVTaskStateEnum.Create.ToString();
                            agv_task.EndQuantity = EmptyStation.quantity;
                            agv_task.agv_toaddress = EmptyStation.stationCode;
                            agvtaskRepository.Update(agv_task, true);
                            EmptyStation.location_state = LocationStateEnum.Busy.ToString();
                            stationinfoRepository.Update(EmptyStation, true);
                            WriteDBLog.Success("更新自动取空托队列任务", $"任务编号:{agv_task.agv_tasknum}", "WMS");
                        }
                    }
                    #endregion
                    else
                    catch (Exception ex)
                    {
                        EmptyStation = GetStation.EmptyPalletStation(agv_task.agv_Traytype == "SmallTray" ? "11" : "10");
                        WriteLog.Write_Log("报错日志", "更新自动取空托队列任务", "错误信息!", $"{tasknum};错误信息:{ex.Message}");
                    }
                    if (EmptyStation != null)
                    {
                        agv_task.agv_taskstate = AGVTaskStateEnum.Create.ToString();
                        agv_task.EndQuantity = EmptyStation.quantity;
                        agv_task.agv_toaddress = EmptyStation.stationCode;
                        agvtaskRepository.Update(agv_task, true);
                        EmptyStation.location_state = LocationStateEnum.Busy.ToString();
                        stationinfoRepository.Update(EmptyStation, true);
                        WriteDBLog.Success("更新自动取空托队列任务", $"任务编号:{agv_task.agv_tasknum}", "WMS");
                    }
                }
            }
            catch (Exception ex)
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs
@@ -164,11 +164,10 @@
        {
            VOLContext context = new VOLContext();
            Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
            var station1 = stationinfoRepository.FindFirst(t => t.stationCode == task.agv_fromaddress);
            var station2 = stationinfoRepository.FindFirst(t => t.stationCode == task.agv_toaddress);
            if (task.agv_taskstate == AGVTaskStateEnum.Complete1.ToString())
            {
            var station2 = stationinfoRepository.FindFirst(t => t.stationCode == task.agv_toaddress);
                ////空托任务需修改逻辑
                if (station2.stationCode.Contains("X"))
                    station2.quantity = 0;// task.agv_tasktype.Contains("TaskType_EmptyPallet") ? 0 : task.agv_qty; //task.agv_qty;
@@ -188,6 +187,7 @@
            }
            else if (task.agv_taskstate == AGVTaskStateEnum.Complete.ToString())
            {
            var station1 = stationinfoRepository.FindFirst(t => t.stationCode == task.agv_fromaddress);
                #region MyRegion
                //if (station1.stationCode.Contains("S"))
                //    station1.quantity = 0;
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/Request.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,46 @@
using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Comm.LogInfo;
using WIDESEA_Common;
using WIDESEA_Entity.DomainModels;
using WIDESEA_Entity.ToAGV;
using WIDESEA_WMS.IRepositories;
namespace WIDESEA_WMS.Common
{
    public partial class AGVServer
    {
        /// <summary>
        /// å‘AGV请求
        /// </summary>
        public static Respone RequestAGV(Idt_agvtaskRepository agvtaskRepository, dt_agvtask agv_task, string postJson, string IP)
        {
            var report = Request.RequestData(postJson, IP);
            var respone = JsonConvert.DeserializeObject<Respone>(report);
            if (respone.Success)
            {
                if (agv_task.agv_taskstate != AGVTaskStateEnum.Complete.ToString())
                    agv_task.agv_taskstate = AGVTaskStateEnum.SendOut.ToString();
                if (agv_task.agv_taskstate == AGVTaskStateEnum.Complete.ToString())
                    agv_task.agv_completeBeginTime = DateTime.Now;
                else
                    agv_task.agv_realesstime = DateTime.Now;
                agvtaskRepository.Update(agv_task, true);
                WriteWMSLog.LogAdd(agv_task.agv_tasknum, "成功 ", "AGV", "WMS", postJson, report, "下发AGV任务", "SendAGVTask", respone.Msg);
            }
            else
            {
                if (agv_task.agv_remark != respone.Msg)
                    agv_task.agv_remark = respone.Msg;
                agvtaskRepository.Update(agv_task, true);
                WriteWMSLog.LogAdd(agv_task.agv_tasknum, "失败 ", "AGV", "WMS", postJson, report, "下发AGV任务", "SendAGVTask", respone.Msg);
            }
            return respone;
        }
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendFromaddress.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,60 @@
using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Comm.LogInfo;
using WIDESEA_Common;
using WIDESEA_Core.EFDbContext;
using WIDESEA_Entity.ToAGV;
using WIDESEA_WMS.IRepositories;
using WIDESEA_WMS.Repositories;
namespace WIDESEA_WMS.Common
{
    public partial class AGVServer
    {
        /// <summary>
        /// ä¸‹å‘起点任务
        /// </summary>
        public static void SendFromaddress()
        {
            try
            {
                VOLContext Context = new VOLContext();
                Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
                RequestFromTask requestFromTask = new RequestFromTask();
                var agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && string.IsNullOrEmpty(x.agv_toaddress)).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).ToList();
                foreach (var agv_task in agv_tasks)
                {
                    try
                    {
                        requestFromTask.TASK_NO = agv_task.agv_tasknum;
                        requestFromTask.FROM_POSITION = agv_task.agv_fromaddress;
                        requestFromTask.Material = agv_task.agv_materielid;
                        requestFromTask.Grade = agv_task.agv_grade;
                        requestFromTask.Quantity = agv_task.agv_qty;
                        requestFromTask.TrayType = agv_task.agv_Traytype.Contains("Small") ? 1 : 2;
                        requestFromTask.TaskType = agv_task.agv_tasktype.Contains("TaskType_EmptyPallet") ? 2 : 1;
                        #region ç»„/拆空盘任务需处理
                        requestFromTask.StarQuantity = agv_task.StarQuantity;
                        requestFromTask.EndQuantity = agv_task.EndQuantity;
                        #endregion
                        var postJson = JsonConvert.SerializeObject(requestFromTask);
                        RequestAGV(agvtaskRepository, agv_task, postJson, AGVAPIAddress.IPAddress_AGVFromaddTask);
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendToaddress.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,108 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Comm.LogInfo;
using WIDESEA_Comm;
using WIDESEA_Common;
using WIDESEA_Core.EFDbContext;
using WIDESEA_Entity.ToAGV;
using WIDESEA_WCS.JobsPart.Common;
using WIDESEA_WMS.IRepositories;
using WIDESEA_WMS.Repositories;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
namespace WIDESEA_WMS.Common
{
    public partial class AGVServer
    {
        /// <summary>
        /// ä¸‹å‘终点任务
        /// </summary>
        public static void SendToaddress()
        {
            VOLContext Context = new VOLContext();
            Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
            Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
            RequestToaddTask requestFromTask = new RequestToaddTask();
            var agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Complete.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && string.IsNullOrEmpty(x.agv_toaddress)).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).ToList();
            foreach (var agv_task in agv_tasks)
            {
                try
                {
                    #region æŸ¥æ‰¾æ»¡è¶³æ¡ä»¶çš„补空托任务
                    var task = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && x.agv_Traytype == agv_task.agv_Traytype && string.IsNullOrEmpty(x.agv_fromaddress)).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
                    if (task != null)
                    {
                        requestFromTask.TASK_NO = agv_task.agv_tasknum;
                        requestFromTask.TO_POSITION = task.agv_toaddress;
                        requestFromTask.Material = agv_task.agv_materielid;
                        requestFromTask.Grade = agv_task.agv_grade;
                        requestFromTask.Quantity = agv_task.agv_qty;
                        requestFromTask.TrayType = agv_task.agv_Traytype.Contains("Small") ? 1 : 2;
                        requestFromTask.TaskType = agv_task.agv_tasktype.Contains("TaskType_EmptyPallet") ? 2 : 1;
                        #region ç»„/拆空盘任务需处理
                        requestFromTask.StarQuantity = agv_task.StarQuantity;
                        requestFromTask.EndQuantity = task.EndQuantity;
                        #endregion
                        var postJson = JsonConvert.SerializeObject(requestFromTask);
                        var respone = RequestAGV(agvtaskRepository, agv_task, postJson, AGVAPIAddress.IPAddress_AGVToaddTask);
                        if (respone.Success)
                        {
                            agv_task.EndQuantity = task.EndQuantity;
                            agv_task.agv_toaddress = task.agv_toaddress;
                            agvtaskRepository.Update(agv_task, true);
                            agvtaskRepository.Delete(task, true);
                        }
                        else
                            throw new Exception(respone.Msg);
                        WriteDBLog.Success("更新自动取空托队列任务", $"任务编号:{agv_task.agv_tasknum}", "WMS");
                    }
                    #endregion
                    else
                    {
                        #region æŸ¥æ‰¾æ»¡è¶³ä»»åŠ¡æ¡ä»¶çš„åœ°å€
                        var EmptyStation = EmptyTray.GetEmptyTrayStation(stationinfoRepository, agv_task);
                        if (EmptyStation != null)
                        {
                            //agv_task.agv_taskstate = AGVTaskStateEnum.Create.ToString();
                            //agvtaskRepository.Update(agv_task, true);//查看AGV任务数据是否在另一个方法内进行了数据更新
                            requestFromTask.TASK_NO = agv_task.agv_tasknum;
                            requestFromTask.TO_POSITION = EmptyStation.stationCode;
                            requestFromTask.Material = agv_task.agv_materielid;
                            requestFromTask.Grade = agv_task.agv_grade;
                            requestFromTask.Quantity = agv_task.agv_qty;
                            requestFromTask.TrayType = agv_task.agv_Traytype.Contains("Small") ? 1 : 2;
                            requestFromTask.TaskType = agv_task.agv_tasktype.Contains("TaskType_EmptyPallet") ? 2 : 1;
                            #region ç»„/拆空盘任务需处理
                            requestFromTask.StarQuantity = agv_task.StarQuantity;
                            requestFromTask.EndQuantity = EmptyStation.quantity;
                            #endregion
                            var postJson = JsonConvert.SerializeObject(requestFromTask);
                            var respone = RequestAGV(agvtaskRepository, agv_task, postJson, AGVAPIAddress.IPAddress_AGVToaddTask);
                            if (respone.Success)
                            {
                                agv_task.EndQuantity = EmptyStation.quantity;
                                agv_task.agv_toaddress = EmptyStation.stationCode;
                                agvtaskRepository.Update(agv_task, true);
                                EmptyStation.location_state = LocationStateEnum.Busy.ToString();
                                stationinfoRepository.Update(EmptyStation, true);
                            }
                            else
                                throw new Exception(respone.Msg);
                            WriteDBLog.Success("更新自动取空托队列任务", $"任务编号:{agv_task.agv_tasknum}", "WMS");
                        }
                        #endregion
                    }
                }
                catch (Exception ex)
                {
                    WriteDBLog.Error("更新自动取空托队列任务", $"任务编号:{agv_task.agv_tasknum};错误信息:{ex.Message}", "WMS");
                }
            }
        }
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/UploadMesInfo/AGVAPIAddress.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WIDESEA_WMS.Common
{
    public class AGVAPIAddress
    {
        /// <summary>
        /// å®Œæ•´AGV任务下发地址
        /// </summary>
        public const string IPAddress_AGVTask = "http://192.168.12.204:5000/api/TaskCreat/CreatTask";
        /// <summary>
        /// AGV起点任务下发地址
        /// </summary>
        public const string IPAddress_AGVFromaddTask = "http://192.168.12.204:5000/api/TaskCreat/CreatGetPalletTask";
        /// <summary>
        /// AGV终点任务下发地址
        /// </summary>
        public const string IPAddress_AGVToaddTask = "http://192.168.12.204:5000/api/TaskCreat/CreatPutPalletTask";
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyPalletStation.cs
@@ -73,7 +73,14 @@
                VOLContext Context = new VOLContext();
                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
                var station = stationinfoRepository.Find(x => x.stationCode == StationCode).FirstOrDefault();
                OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column > station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any();
                if (station.area == "10" || station.area == "11")
                {
                    OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column < station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any();
                }
                else
                {
                    OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column > station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any();
                }
            }
            catch (Exception ex)
            {
@@ -102,7 +109,12 @@
            }
        }
        /// <summary>
        /// æŸ¥æ‰¾å½“前行可入库空货位
        /// </summary>
        /// <param name="EmptyStation"></param>
        /// <param name="stationinfoRepository"></param>
        /// <returns></returns>
        public static dt_stationinfo Station(dt_stationinfo EmptyStation, Idt_stationinfoRepository stationinfoRepository)
        {
            dt_stationinfo stationinfo = null;
@@ -113,21 +125,88 @@
                stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.quantity > 0 && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
                if (stationinfo != null)
                {
                    if (stationinfo.quantity < 5) return stationinfo;
                    else
                        stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault();
                }
                else
                {
                    stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault();
                }
                //if (stationinfo == null)
                stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault();
            }
            catch (Exception ex)
            {
            }
            return stationinfo;
        }
        /// <summary>
        /// ç©ºæ‰˜å¯å…¥åº“货位
        /// </summary>
        /// <param name="area"></param>
        /// <returns></returns>
        public static dt_stationinfo EmptyPalletStation1(string area)
        {
            dt_stationinfo stationinfo = null;
            try
            {
                VOLContext Context = new VOLContext();
                Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context);
                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
                #region æŸ¥æ‰¾AB库可入空托空货位
                if (area == "11" && stationinfoRepository.Find(x => x.stationCode == "A01001001" && x.quantity == 5 && x.location_state == LocationStateEnum.Stroge.ToString()).Any())
                {
                    #region MyRegion
                    var EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && (x.area == "2" || x.area == "3") && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderByDescending(x => x.area).ThenByDescending(x => x.line).ThenByDescending(x => x.column).FirstOrDefault();
                    #endregion
                    #region æŸ¥æ‰¾åº“区2和库区3的空托货位
                    //var EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && (x.area == "2" || x.area == "3")
                    //   && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderByDescending(x => x.lastUpdateTime).FirstOrDefault();
                    if (EmptyStation != null)
                    {
                        stationinfo = Station(EmptyStation, stationinfoRepository);
                        if (stationinfo != null)
                            if (!QueueStation(stationinfo.stationCode)) return stationinfo;
                        EmptyStation = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
                        if (EmptyStation.quantity != 5) return null;
                    }
                    #endregion
                    #region æœªæ‰¾åˆ°ç©ºæ‰˜è´§ä½æˆ–当前行已满,寻找新的一行
                    stationinfo = stationinfoRepository.Find(x => x.column == 2 && x.area == "3" && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderByDescending(x => x.line).FirstOrDefault();
                    if (stationinfo == null)
                        stationinfo = stationinfoRepository.Find(x => x.column == 1 && x.area == "2" && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderByDescending(x => x.line).FirstOrDefault();
                    #endregion
                }
                #endregion
                #region æŸ¥æ‰¾ç©ºæ‰˜åº“区
                else
                {
                    if (stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Busy.ToString()).Any()) return stationinfo;
                    stationinfo = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.enable).OrderBy(x => x.column).FirstOrDefault();
                    if (stationinfo != null)
                        if (!QueueStation(stationinfo.stationCode) && stationinfo.quantity < 5) return stationinfo;
                    stationinfo = stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
                }
                #endregion
                #region æŸ¥çœ‹å½“前空货位后是否存在有料
                if (stationinfo != null)
                    if (GetStation.QueueStation(stationinfo.stationCode)) stationinfo = null;
                #endregion
                #region åˆ¤æ–­å½“前货位是否存在任务
                if (stationinfo != null)
                    if (agvtaskService.Find(x => x.agv_toaddress == stationinfo.stationCode).Any()) stationinfo = null;
                #endregion
            }
            catch (Exception ex)
            {
                throw;
            }
            return stationinfo;
        }
@@ -146,7 +225,6 @@
                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
                #region æŸ¥æ‰¾ç©ºæ‰˜ç›˜åº“区
                //if (stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Busy.ToString()).Any() && area != "10")
                if (stationinfoRepository.Find(x => x.stationCode == "A01001001" && x.quantity == 5 && x.location_state == LocationStateEnum.Stroge.ToString()).Any())
                {
                    var EmptyStation = stationinfoRepository.Find(x => x.stationCode == "C01005002" && x.location_state == LocationStateEnum.Empty.ToString()).FirstOrDefault();
@@ -190,7 +268,7 @@
                #region åˆ¤æ–­å½“前货位是否存在任务
                if (stationinfo != null)
                    if (agvtaskService.Find(x => /*x.agv_fromaddress == stationinfo.stationCode ||*/ x.agv_toaddress == stationinfo.stationCode).Any()) stationinfo = null;
                    if (agvtaskService.Find(x => /*x.agv_fromaddress == stationinfo.stationCode ||*/ x.agv_toaddress == stationinfo.stationCode).Any()) stationinfo = null;
                #endregion
            }
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyTrayIn.cs
@@ -36,6 +36,32 @@
            }
        }
        /// <summary>
        /// èŽ·å–å¯å…¥ç©ºæ‰˜è´§ä½
        /// </summary>
        public static dt_stationinfo GetEmptyTrayStation(Idt_stationinfoRepository stationinfoRepository,dt_agvtask agv_task)
        {
            dt_stationinfo EmptyStation = null;
            #region æ£€æµ‹ä¸Šæ–™çš„空托叠盘
            if (agv_task.agv_fromaddress.Contains("S"))
            {
                var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList();
                EmptyStation = EmptyStations.Where(x => x.tray_type == agv_task.agv_Traytype && x.quantity < 5 && x.location_state == LocationStateEnum.Stroge.ToString()).FirstOrDefault();
                if (EmptyStation == null)
                    EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Empty.ToString() && x.quantity == 0).FirstOrDefault();
                if (EmptyStation == null)
                {
                    var EmptyD = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.quantity).FirstOrDefault();
                    if (EmptyD != null) CreateEmptyTrayIn(stationinfoRepository, EmptyD);
                }
            }
            #endregion
            else
            {
                EmptyStation = GetStation.EmptyPalletStation1(agv_task.agv_Traytype == "SmallTray" ? "11" : "10");
            }
            return EmptyStation;
        }
        /// <summary>
        /// åˆ›å»ºç©ºæ‰˜å ç›˜å…¥åº“任务
        /// </summary>
        /// <param name="stationinfoRepository"></param>
@@ -48,7 +74,7 @@
            {
                if (agvtaskRepository.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any()) return;
                var area = EmptyStation.tray_type == "SmallTray" ? "11" : "10";
                var toEmptyStation = GetStation.EmptyPalletStation(area);
                var toEmptyStation = GetStation.EmptyPalletStation1(area);
                if (toEmptyStation != null)
                {
                    #region åŒä¸€ä¸ªç©ºæ‰˜ä½åªèƒ½åŒæ—¶ç”Ÿæˆä¸€ä¸ªç©ºæ‰˜ä»»åŠ¡
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/ToMes/shiftingparking.cs
@@ -42,6 +42,8 @@
                if (station2 == null) return content.Error("请输入正确的起点地址!");
                if (!station1.tray_type.Contains("Small") && station2.area != "4")
                    throw new Exception($"大托盘只能存放在库区4!");
                if (station1.tray_type.Contains("Small") && station2.area != "3" && station2.area != "2")
                    throw new Exception($"小托盘只能存放在库区2/库区3!");
                if (agvtaskRepository.Find(x => x.agv_fromaddress.Contains(from_address) || x.agv_toaddress.Contains(from_address)).Any())
                    throw new Exception($"起点{from_address}已存在任务!");
                if (agvtaskRepository.Find(x => x.agv_fromaddress.Contains(to_address) || x.agv_toaddress.Contains(to_address)).Any())
@@ -52,17 +54,9 @@
                    throw new Exception($"终点{to_address}不是空货位!");
                if (string.IsNullOrEmpty(station1.stationType))
                    throw new Exception($"起点{from_address}未绑定物料类型!");
                if (station2.area == "1")
                {
                    if (stationinfoRepository.Find(x => x.area == station2.area && x.column == station2.column && x.location_state != LocationStateEnum.Empty.ToString() && x.stationType != station1.stationType).Any())
                        throw new Exception($"终点{to_address}同列存在与起点物料类型不匹配!");
                }
                else
                {
                    if (stationinfoRepository.Find(x => x.area == station2.area && x.line == station2.line && x.location_state != LocationStateEnum.Empty.ToString() && x.stationType != station1.stationType).Any())
                        throw new Exception($"终点{to_address}同行存在与起点物料类型不匹配!");
                }
                if (stationinfoRepository.Find(x => x.area == station2.area && x.line == station2.line && x.enable && x.location_state != LocationStateEnum.Empty.ToString() && x.stationType != station1.stationType).Any())
                    throw new Exception($"终点{to_address}同行存在与起点物料类型不匹配!");
                var inventory = inventoryRepository.Find(x => x.stationCode == station1.stationCode).FirstOrDefault();
                if (inventory == null) throw new Exception($"起点{from_address}未找到库存信息!");
@@ -92,6 +86,7 @@
                station2.location_state = LocationStateEnum.InBusy.ToString();
                station2.heatNumber = station1.heatNumber;
                station2.Number = station1.Number;
                station2.billetID = station1.billetID;
                station2.stationType = station1.stationType;
                stationinfoRepository.Update(station2, true);
                content.OK();
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobTask.cs
@@ -14,6 +14,8 @@
        {
            AGVServer.UpdateEmptyPalletTask();
            AGVServer.SendAgvTask();
            AGVServer.SendFromaddress();
            AGVServer.SendToaddress();
        }
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WebApi/appsettings.json
@@ -16,7 +16,8 @@
  "Connection": {
    "DBType": "MsSql", //MySql/MsSql/PgSql  //数据库类型,如果使用的是sqlserver此处应设置为MsSql
    //sqlserver连接字符串
    "DbConnectionString": "Data Source=.;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;Connect Timeout=500;",
    "DbConnectionString": "Data Source=192.168.12.101;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=123456;Connect Timeout=500;",
    //"DbConnectionString": "Data Source=.;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;Connect Timeout=500;",
    //mysql连接字符串(升级EFCore3.1到时已将mysql连接字符串修改,2019-12-20)
    // "DbConnectionString": " Data Source=127.0.0.1;Database=netcoredev;AllowLoadLocalInfile=true;User ID=root;Password=123456;allowPublicKeyRetrieval=true;pooling=true;CharSet=utf8;port=3306;sslmode=none;",