| | |
| | | /// <param name="areaList">区域集合</param> |
| | | /// <param name="roadwayNo">巷道号(可空)</param> |
| | | /// <returns></returns> |
| | | public SysStorageLocat GetSuiTableLocate(string houseNo, List<string> areaList,string roadwayNo = "") |
| | | public SysStorageLocat GetSuiTableLocate(string houseNo, List<string> areaList,string roadwayNo = "",string ceng = "") |
| | | { |
| | | try |
| | | { |
| | | if (string.IsNullOrWhiteSpace(ceng)) |
| | | { |
| | | throw new Exception($"申请货架库位层数不能为空"); |
| | | } |
| | | var db = DataContext.Db; |
| | | /* 1.先判断仓库(立库或者平库) |
| | | * 2.如果是立库 再判断是否指定巷道号 |
| | |
| | | |
| | | //查询该巷道并且标志为正常的的储位 |
| | | roadwayList.Add(roadway); |
| | | var locate = GetLocateByRoadways(roadwayList,areaList,true,houseNo); |
| | | var locate = GetLocateByRoadways(roadwayList,areaList,true,houseNo, ceng); |
| | | if (locate == null) |
| | | { |
| | | throw new Exception($"{roadwayNo}巷道没有合适的空储位"); |
| | |
| | | { |
| | | var roadwayList = db.Queryable<SysStorageRoadway>().Where(m => m.WareHouseNo == houseNo && m.Status == "0" && roadList.Contains(m.RoadwayNo)).OrderBy(m => new { m.Priority, m.RoadwayNo }).ToList(); |
| | | |
| | | var locate = GetLocateByRoadways(roadwayList,areaList,false, houseNo); |
| | | var locate = GetLocateByRoadways(roadwayList,areaList,false, houseNo,ceng); |
| | | if (locate == null) |
| | | { |
| | | throw new Exception($"{houseNo}仓库已启用的巷道中没有合适的空储位"); |
| | |
| | | /// <param name="areaList">区域集合</param> |
| | | /// <param name="isRoadway">是否指定巷道</param> |
| | | /// <returns></returns> |
| | | private SysStorageLocat GetLocateByRoadways(List<SysStorageRoadway> roadways,List<string> areaList,bool isRoadway = false ,string houseNo = "W02") |
| | | private SysStorageLocat GetLocateByRoadways(List<SysStorageRoadway> roadways,List<string> areaList,bool isRoadway = false ,string houseNo = "W02",string ceng = "") |
| | | { |
| | | try |
| | | { |
| | |
| | | var count = 0; |
| | | do |
| | | { |
| | | locate = GetLocateByRoadway(l.RoadwayNo, topOrBom, leftOrRight, areaList, list, ref count); |
| | | locate = GetLocateByRoadway(l.RoadwayNo, topOrBom, leftOrRight, areaList, list, ref count, ceng); |
| | | if (locate != null) |
| | | { |
| | | break; |
| | |
| | | var count = 0; |
| | | do |
| | | { |
| | | locate = GetLocateByRoadway(log.RoadwayNo, topOrBom, leftOrRight, areaList, list, ref count); |
| | | locate = GetLocateByRoadway(log.RoadwayNo, topOrBom, leftOrRight, areaList, list, ref count,ceng); |
| | | if (locate != null) |
| | | { |
| | | break; |
| | |
| | | var count = 0; |
| | | do |
| | | { |
| | | locate = GetLocateByRoadway(item.RoadwayNo, topOrBom, leftOrRight, areaList, list, ref count); |
| | | locate = GetLocateByRoadway(item.RoadwayNo, topOrBom, leftOrRight, areaList, list, ref count,ceng); |
| | | if (locate != null) |
| | | { |
| | | break; |
| | |
| | | /// <param name="areaList">区域集合</param> |
| | | /// <param name="locateNoStr">排除的储位集合</param> |
| | | /// <returns></returns> |
| | | private SysStorageLocat GetLocateByRoadway(string roadwayNo, int topOrBom, int leftOrRight,List<string> areaList,List<string> locateNoStr,ref int count) |
| | | private SysStorageLocat GetLocateByRoadway(string roadwayNo, int topOrBom, int leftOrRight,List<string> areaList,List<string> locateNoStr,ref int count,string ceng = "") |
| | | { |
| | | var db = DataContext.Db; |
| | | var str = ""; |
| | |
| | | |
| | | foreach (var area in areaList) |
| | | { |
| | | var sql = $@"select * from SysStorageLocat where IsDel = 0 and Flag = 0 and [Status] = 0 and RoadwayNo = '{roadwayNo}' and AreaNo = '{area}' and LocatNo not in({str}) "; |
| | | var sql = $@"select * from SysStorageLocat where IsDel = 0 and Layer!= '3' and Flag = 0 and [Status] = 0 and RoadwayNo = '{roadwayNo}' and AreaNo = '{area}' and LocatNo not in({str}) "; |
| | | if (!string.IsNullOrWhiteSpace(ceng)) |
| | | { |
| | | sql += $"and Layer = '{ceng}' "; |
| | | } |
| | | sql += "order by "; |
| | | sql += topOrBom == 0 ? "Layer desc, " : "Layer, "; |
| | | sql += leftOrRight == 0 ? "[Column], " : "[Column] desc, "; |