分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-06-26 6f6277d4f5b469a738fd3b665ecdc9a81f2d8a3e
优化入库逻辑
已修改1个文件
26 ■■■■ 文件已修改
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/新文件夹/GetLocation.cs 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ÐÂÎļþ¼Ð/GetLocation.cs
@@ -123,18 +123,6 @@
                    //}
                    #endregion
                    #region å¯»æ‰¾å¯¹åº”库区空货位
                    var TargetLocations = area1 == "4" ? stationinfoRepository.Find(x => x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == "4").OrderBy(x => x.line).ThenBy(x => x.column).ToList()
                        : stationinfoRepository.Find(x => x.location_state == LocationStateEnum.Empty.ToString() && x.enable && (x.area == "2" || x.area == "3")).OrderBy(x => x.line).ThenBy(x => x.column).ToList();
                    foreach (var Location in TargetLocations)
                    {
                        //if (stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.stationType == agvtask.agv_materielid).Any())
                        if (stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.Number == agvtask.jobID).Any())
                            if (!stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.location_state == LocationStateEnum.OutBusy.ToString()).Any()) return Location;
                    }
                    #endregion
                    #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).FirstOrDefault();
@@ -146,11 +134,23 @@
                    #region æŸ¥çœ‹å½“前空货位后是否存在有料
                    if (TargetLocation != null)
                        if (GetStation.QueueStation(TargetLocation.stationCode)) TargetLocation = null;
                        //if (GetStation.QueueStation(TargetLocation.stationCode)) TargetLocation = null;
                        if (!GetStation.QueueStation(TargetLocation.stationCode)) return TargetLocation;
                    #endregion
                    #endregion
                    #region å¯»æ‰¾å¯¹åº”库区空货位
                    var TargetLocations = area1 == "4" ? stationinfoRepository.Find(x => x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == "4").OrderBy(x => x.line).ThenBy(x => x.column).ToList()
                        : stationinfoRepository.Find(x => x.location_state == LocationStateEnum.Empty.ToString() && x.enable && (x.area == "2" || x.area == "3")).OrderBy(x => x.line).ThenBy(x => x.column).ToList();
                    foreach (var Location in TargetLocations)
                    {
                        if (stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.Number == agvtask.jobID).Any())
                            if (!stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.location_state == LocationStateEnum.OutBusy.ToString()).Any() && !GetStation.QueueStation(Location.stationCode)) return Location;
                    }
                    #endregion
                    if (TargetLocation == null) throw new Exception("库位已满");
                    return TargetLocation;
                }