From 25be6fbad7853391a52d3a56752cd1c308c2dfd0 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期二, 14 五月 2024 15:40:30 +0800 Subject: [PATCH] 添加AGV任务删除功能 --- 代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs | 33 +++++++++++++++++++++++---------- 1 files changed, 23 insertions(+), 10 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs" index 4da1a3d..22961fb 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs" @@ -377,6 +377,7 @@ Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context); var plc = repository.FindFirst(x => x.plcinfo_name == client.PLCName); List<string> stationCodes = new List<string>() { "S01001001", "S01001002", "W01001001", "W01001002", "W01001003" }; + dt_stationinfo EmptyStation = null; string remark = ""; foreach (var stationCode in stationCodes) { @@ -415,22 +416,34 @@ } remark = "鏌ヨ绌烘墭鍙犵洏浣�"; #region 绌烘墭鍙犵洏 - var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList(); - var EmptyStation = EmptyStations.Where(x => x.tray_type == station.tray_type && 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 (stationCode.Contains("S")) + { + var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList(); + EmptyStation = EmptyStations.Where(x => x.tray_type == station.tray_type && x.location_state == LocationStateEnum.Stroge.ToString()).FirstOrDefault(); + if (EmptyStation == null) + EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Empty.ToString() && x.quantity == 0 && x.enable).FirstOrDefault(); + if (EmptyStation == null) + { + EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0 && x.enable).OrderByDescending(x => x.quantity).FirstOrDefault(); + if (EmptyStation != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyStation); + } + } #endregion - remark = "鏌ユ壘搴撳唴绌烘墭浣�"; - if (EmptyStation == null)//鏌ユ壘搴撳唴绌烘墭鐩� + else + { + remark = "鏌ユ壘搴撳唴绌烘墭浣�"; EmptyStation = GetStation.EmptyPalletStation(area); + if (EmptyStation != null) + if (agvtaskService.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any()) return; + } if (EmptyStation != null) { #region 鍚屼竴涓┖鎵樹綅鍙兘鍚屾椂鐢熸垚涓�涓┖鎵樹换鍔� - remark = "鏌ヨ绌烘墭浣嶆槸鍚﹀瓨鍦ㄤ换鍔�"; - if (agvtaskService.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any()) - return; + //remark = "鏌ヨ绌烘墭浣嶆槸鍚﹀瓨鍦ㄤ换鍔�"; + //if (agvtaskService.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any()) + // return; #endregion dt_agvtask agvtask = new dt_agvtask() { @@ -595,7 +608,7 @@ if (mes_Head != null) { mes_Head.finishNum = mes_Head.finishNum + 1; - //freeDB.DataBase.Update<dt_mes_head>().SetSource(mes_Head).UpdateColumns(x => new { x.finishNum }).ExecuteAffrows(); + if (mes_Head.finishNum == mes_Head.quantity) mes_Head.FinishTime = DateTime.Now; mes_HeadRepository.Update(mes_Head, true); } } -- Gitblit v1.9.3