分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-04-27 25724888bc329401891bf1600a8a83d8aae338b3
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ÐÂÎļþ¼Ð/GetLocation.cs
@@ -24,7 +24,7 @@
        /// <param name="mesinfo"></param>
        /// <param name="stationinfo"></param>
        /// <returns></returns>
        public static dt_stationinfo GetEmptyLocation(Idt_stationinfoRepository stationinfoRepository, VV_Mes_Workinfo mesinfo, dt_stationinfo stationinfo)
        public static dt_stationinfo GetEmptyLocation(Idt_stationinfoRepository stationinfoRepository, VV_Mes_Workinfo mesinfo, dt_agvtask agvtask)
        {
            lock (GetEmptyLocationobj)
            {
@@ -33,12 +33,12 @@
                    VOLContext context = new VOLContext();
                    Idt_inventoryRepository inventoryRepository = new dt_inventoryRepository(context);
                    string area1 = "";
                    if (stationinfo.tray_type == "LargeTray")
                    if (agvtask.agv_Traytype == "LargeTray")
                        area1 = "4";
                    #region æŸ¥æ‰¾åº“å­˜
                    dt_inventory inventory = null;
                    inventory = inventoryRepository.Find(x => x.FigureNumber == stationinfo.stationType).OrderByDescending(x => x.OnlineTime).FirstOrDefault();
                    inventory = inventoryRepository.Find(x => x.FigureNumber == agvtask.agv_materielid).OrderByDescending(x => x.OnlineTime).FirstOrDefault();
                    #endregion
                    dt_stationinfo TargetLocation = null;
@@ -50,7 +50,7 @@
                        if (!string.IsNullOrEmpty(area1) && station.area != area1)//入大托盘库区
                        {
                            #region å¯»æ‰¾å·²åˆ†é…åŒå›¾å·å…¥åº“任务库位
                            TargetLocation = stationinfoRepository.Find(x => x.stationType == stationinfo.stationType && x.location_state == LocationStateEnum.InBusy.ToString() && x.area == area1).FirstOrDefault();
                            TargetLocation = stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && x.area == area1).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();
@@ -66,7 +66,7 @@
                            var TargetLocations1 = stationinfoRepository.Find(x => x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == area1).OrderBy(x => x.line).ThenBy(x => x.column).ToList();
                            foreach (var Location in TargetLocations1)
                            {
                                if (!stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.stationType == stationinfo.stationType && x.location_state == LocationStateEnum.OutBusy.ToString()).Any()) return Location;
                                if (!stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.OutBusy.ToString()).Any()) return Location;
                            }
                            #endregion
@@ -95,7 +95,7 @@
                    #endregion
                    #region å¯»æ‰¾å·²åˆ†é…åŒå›¾å·å…¥åº“任务库位
                    TargetLocation = stationinfoRepository.Find(x => x.stationType == stationinfo.stationType && x.location_state == LocationStateEnum.InBusy.ToString() && (x.area == "1" || x.area == "2" || x.area == "3" || x.area == "4")).FirstOrDefault();
                    TargetLocation = stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && (x.area == "1" || x.area == "2" || x.area == "3" || x.area == "4")).FirstOrDefault();
                    if (TargetLocation != null)
                    {
                        if (TargetLocation.area == "1")
@@ -126,17 +126,17 @@
                    {
                        if (Location.area == "1")
                        {
                            if (stationinfoRepository.Find(x => x.column == Location.column && x.area == Location.area && x.stationType == stationinfo.stationType && x.location_state != LocationStateEnum.OutBusy.ToString()).Any()) return Location;
                            if (stationinfoRepository.Find(x => x.column == Location.column && x.area == Location.area && x.stationType == agvtask.agv_materielid && x.location_state != LocationStateEnum.OutBusy.ToString()).Any()) return Location;
                        }
                        else
                        {
                            if (!stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.stationType == stationinfo.stationType && x.location_state == LocationStateEnum.OutBusy.ToString()).Any()) return Location;
                            if (!stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.OutBusy.ToString()).Any()) return Location;
                        }
                    }
                    #endregion
                    #region æœªæ‰¾åˆ°åº“存或当前库存行已满,寻找新的一行
                    var area = GetArea(mesinfo.quantity, stationinfo.tray_type);
                    var area = GetArea(mesinfo.quantity, agvtask.agv_Traytype);
                    TargetLocation = stationinfoRepository.Find(x => x.column == 1 && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault();
                    if (TargetLocation == null && area != "4")
                    {