From 5b909ae151855d0fc04cd1215a48ba1c9251dc11 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期二, 14 五月 2024 08:16:17 +0800 Subject: [PATCH] 优化入库逻辑 --- 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs | 2 +- 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs | 2 +- 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/新文件夹/GetLocation.cs | 9 +++------ 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs | 45 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 8 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs" index 1af8221..e1bb7ba 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs" @@ -19,7 +19,52 @@ public class GetStation { /// <summary> + /// 褰撳墠搴撲綅鍚屼竴琛屾槸鍚﹀瓨鍦ㄥ叆搴撳崰鐢� + /// true锛氭槸 false锛氬惁 + /// </summary> + /// <param name="StationCode"></param> + /// <returns></returns> + public static bool InBusyStation(string StationCode) + { + bool OK = false; + try + { + 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.location_state == LocationStateEnum.InBusy.ToString()).Any(); + } + catch (Exception ex) + { + + } + return OK; + } + /// <summary> + /// 褰撳墠搴撲綅鍚屼竴琛屾槸鍚﹀瓨鍦ㄥ嚭搴撳崰鐢� + /// true锛氭槸 false锛氬惁 + /// </summary> + /// <param name="StationCode"></param> + /// <returns></returns> + public static bool OutBusyStation(string StationCode) + { + bool OK = false; + try + { + 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.location_state == LocationStateEnum.OutBusy.ToString()).Any(); + } + catch (Exception ex) + { + + } + return OK; + } + /// <summary> /// 褰撳墠搴撲綅澶栬竟鐨勮揣浣嶆槸鍚﹂兘涓虹┖ + /// true锛氬惁 false锛氭槸 /// </summary> /// <param name="StationCode"></param> /// <returns></returns> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs" index 3220d46..02427d5 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs" @@ -48,7 +48,7 @@ dt_stationinfo stationinfo = null; //鏌ユ壘褰撳墠璐т綅鍚岃鏄惁瀛樺湪鍏ュ簱浠诲姟 - if (stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.location_state == LocationStateEnum.InBusy.ToString()).Any()) continue; + if (GetStation.InBusyStation(Station.stationCode)) continue; 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) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs" index 908a517..5d521e3 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs" @@ -176,7 +176,7 @@ } else if (agvtask.agv_tasktype == AGVTaskTypeEnum.TaskType_OutsourceInbound.ToString() || agvtask.agv_tasktype == AGVTaskTypeEnum.TaskType_Inbound.ToString())//澶栧崗搴撳叆搴�/AB搴撳叆搴� { - if (agvtask.agv_toaddress == "") + if (string.IsNullOrEmpty(agvtask.agv_toaddress)) { var stationinfo = stationinfoRepository.Find(x => x.stationCode == agvtask.agv_fromaddress).FirstOrDefault(); var work = workinfoRepository.Find(x => x.workOrder == stationinfo.Number && x.drawingNo == stationinfo.stationType && x.heatID == stationinfo.heatNumber && x.processCode == "17").FirstOrDefault(); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs" index aac5042..7c0a658 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs" @@ -44,10 +44,7 @@ { 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(); if (TargetLocation != null) - { - if (!stationinfoRepository.Find(x => x.line == TargetLocation.line && x.area == TargetLocation.area && x.location_state == LocationStateEnum.OutBusy.ToString()).Any()) - return TargetLocation; - } + if (!GetStation.OutBusyStation(TargetLocation.stationCode) && !GetStation.QueueStation(TargetLocation.stationCode)) return TargetLocation; } #endregion @@ -80,7 +77,7 @@ TargetLocation = stationinfoRepository.Find(x => x.line == station.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == station.area).OrderBy(x => x.column).FirstOrDefault(); if (TargetLocation != null) { - if (!stationinfoRepository.Find(x => x.line == TargetLocation.line && x.area == TargetLocation.area && x.location_state == LocationStateEnum.OutBusy.ToString()).Any()) + if (!GetStation.OutBusyStation(TargetLocation.stationCode) && !GetStation.QueueStation(TargetLocation.stationCode)) return TargetLocation; } #endregion @@ -144,7 +141,7 @@ #region 鏌ョ湅褰撳墠绌鸿揣浣嶅悗鏄惁瀛樺湪鏈夋枡 if (TargetLocation != null) - if (stationinfoRepository.Find(x => x.line == TargetLocation.line && x.area == TargetLocation.area && x.location_state != LocationStateEnum.Empty.ToString()).Any()) TargetLocation = null; + if (GetStation.QueueStation(TargetLocation.stationCode)) TargetLocation = null; #endregion #endregion -- Gitblit v1.9.3