分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-05-12 3c1595797d13715cd745008f31fe6f1b601f0759
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/EmptyTrayIn.cs
@@ -27,19 +27,30 @@
            {
                VOLContext Context = new VOLContext();
                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
                Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
                var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity == 5 && x.enable).ToList();
                var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 5 && x.enable).ToList();
                foreach (var EmptyStation in EmptyStations)
                {
                    CreateEmptyTrayIn(stationinfoRepository, EmptyStation);
                }
            }
            catch (Exception ex)
            {
                WriteDBLog.Success("创建叠盘位空托入库任务", $"错误信息:{ex.Message}", "PCS");
            }
        }
        public static void CreateEmptyTrayIn(Idt_stationinfoRepository stationinfoRepository, dt_stationinfo EmptyStation)
        {
            VOLContext Context = new VOLContext();
            Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
                    try
                    {
                        if (agvtaskRepository.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any()) continue;
                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);
                        if (toEmptyStation != null)
                        {
                            #region åŒä¸€ä¸ªç©ºæ‰˜ä½åªèƒ½åŒæ—¶ç”Ÿæˆä¸€ä¸ªç©ºæ‰˜ä»»åŠ¡
                            if (agvtaskRepository.Find(x => x.agv_fromaddress == toEmptyStation.stationCode || x.agv_toaddress == toEmptyStation.stationCode).Any()) continue;
                    if (agvtaskRepository.Find(x => x.agv_fromaddress == toEmptyStation.stationCode || x.agv_toaddress == toEmptyStation.stationCode).Any()) return;
                            #endregion
                            dt_agvtask agvtask = new dt_agvtask()
@@ -70,14 +81,7 @@
                    }
                    catch (Exception ex)
                    {
                        WriteDBLog.Success("创建叠盘位空托入库任务", $"错误信息:{ex.Message}", "PCS");
                    }
                }
            }
            catch (Exception ex)
            {
                WriteDBLog.Success("创建叠盘位空托入库任务", $"错误信息:{ex.Message}", "PCS");
                WriteDBLog.Error("创建叠盘位空托入库任务", $"错误信息:{ex.Message}", "PCS");
            }
        }
    }