/// <summary> /// 全库查找 /// </summary> /// <returns></returns> private CLocation AllocateLocation(int region) { CWICCard cwiccd = new CWICCard(); List <CLocation> locationList = new List <CLocation>(); var lcta = from lct in locations where lct.Type == CLocation.EnmLocationType.Normal && lct.Status == CLocation.EnmLocationStatus.Space && string.Compare(lct.Size, carsize) == 0 && cwiccd.FindFixICCard(lct.Address) == null && lct.ICCardCode == "" orderby Math.Abs(lct.Region - region), lct.Index ascending select lct; locationList.AddRange(lcta); var lctb = from lct in locations where lct.Type == CLocation.EnmLocationType.Normal && lct.Status == CLocation.EnmLocationStatus.Space && string.Compare(lct.Size, carsize) > 0 && cwiccd.FindFixICCard(lct.Address) == null && lct.ICCardCode == "" orderby Math.Abs(lct.Region - region), lct.Index ascending select lct; locationList.AddRange(lctb); if (locationList.Count > 0) { return(locationList[0]); } return(null); }