| | |
| | | |
| | | namespace WMS.BLL.SysServer |
| | | { |
| | | public class StorageLocatServer:DbHelper<SysStorageLocat>,IStorageLocatServer |
| | | public class StorageLocatServer : DbHelper<SysStorageLocat>, IStorageLocatServer |
| | | { |
| | | private static readonly SqlSugarScope Db = DataContext.Db; |
| | | public IStorageLocatRepository LocatRst { get; set; } |
| | | public StorageLocatServer(IStorageLocatRepository locatRst):base(Db) |
| | | public StorageLocatServer(IStorageLocatRepository locatRst) : base(Db) |
| | | { |
| | | LocatRst = locatRst; |
| | | } |
| | |
| | | /// <param name="limit"></param> |
| | | /// <param name="count"></param> |
| | | /// <returns></returns> |
| | | public List<LocatDto> GetStorageLocatList(string houseNo, string roadwayNo, string areaNo, string status, string flag,string locat, int? row, int? col, int? layer, int page, int limit,out int count) |
| | | public List<LocatDto> GetStorageLocatList(string houseNo, string roadwayNo, string areaNo, string status, string flag, string locat, int? row, int? col, int? layer, int page, int limit, out int count) |
| | | { |
| | | try |
| | | { |
| | |
| | | .AndIF(layer != null, it => it.Layer == layer) |
| | | .ToExpression();//注意 这一句 不能少 |
| | | |
| | | |
| | | var data = LocatRst.GetAllByOrderPageAsync(item, limit, page,out int counts) |
| | | |
| | | var data = LocatRst.GetAllByOrderPageAsync(item, limit, page, out int counts) |
| | | .Includes(x => x.WareHouseInfo) |
| | | .Includes(x => x.AreaInfo) |
| | | .Includes(x => x.RoadwayInfo) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public bool EditStorageLocat(EditLocateVm model, int userId) |
| | | { |
| | | try |
| | |
| | | return bl; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | |
| | | c1 = c.ToString(); |
| | | } |
| | | var area = l <= 7 ? "A12" : "A11";//区域 |
| | | for (int d = 1; d<= int.Parse(dept); d++) //深度 |
| | | for (int d = 1; d <= int.Parse(dept); d++) //深度 |
| | | { |
| | | var s = "0" + d;//深度 |
| | | q += await LocatRst.AddAsync(new SysStorageLocat() |
| | | { |
| | | LocatNo = r1 + c1 + l1+s, |
| | | LocatNo = r1 + c1 + l1 + s, |
| | | WareHouseNo = houseNo, |
| | | RoadwayNo = roadwayNo, |
| | | AreaNo = area, |
| | |
| | | CreateUser = userId |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | var q = 0; |
| | | // 排(组)循环 |
| | | for(int i=1;i<=model.Row;i++) |
| | | for (int i = 1; i <= model.Row; i++) |
| | | { |
| | | // 列循环 |
| | | for (int z = 1; z <= model.Col; z++) |
| | | for (int z = 1; z <= model.Col; z++) |
| | | { |
| | | q += await LocatRst.AddAsync(new SysStorageLocat() |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | var bl = LocatRst.EditStorageLocatList(model.Id, model.Status, model.Flag,model.Temperature ,userId); |
| | | var bl = LocatRst.EditStorageLocatList(model.Id, model.Status, model.Flag, model.Temperature, userId); |
| | | |
| | | return bl; |
| | | } |
| | |
| | | { |
| | | var list = Db.Queryable<SysStorageLocat>().Where(m => |
| | | m.IsDel == "0" && m.WareHouseNo == wareHouseNo && m.RoadwayNo == roadway && m.Row == int.Parse(row) && m.Depth == depth).ToList(); |
| | | |
| | | |
| | | return list; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public int GetMaxLayer(string wareHouseNo, string roadway, string row) |
| | | { |
| | | try |
| | | { |
| | | { |
| | | var road = roadway.Substring(1, roadway.Length - 1); |
| | | var num = int.Parse(road); |
| | | var rows = (num - 1) * 2 + int.Parse(row);//排 |
| | | |
| | | var maxLayer = Db.Queryable<SysStorageLocat>().Where(m => |
| | | m.IsDel == "0" && m.WareHouseNo == wareHouseNo && m.RoadwayNo == roadway && m.Row == int.Parse(row)).Max(m=>m.Layer); |
| | | m.IsDel == "0" && m.WareHouseNo == wareHouseNo && m.RoadwayNo == roadway && m.Row == int.Parse(row)).Max(m => m.Layer); |
| | | |
| | | return maxLayer; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | return depthlist; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取库位占比(圆) |
| | |
| | | { |
| | | //根据仓库号以及巷道号获取储位各状态数据 |
| | | string str = "select Row,Status,COUNT(Status) StatusNum from SysStorageLocat where WareHouseNo = @warehouseno and RoadwayNo = @roadwayno group by Row,Status order by Row,Status"; |
| | | |
| | | |
| | | List<GetLocateVm> getLocateVms = Db.Ado.SqlQuery<GetLocateVm>(str, new |
| | | { |
| | | warehouseno = wareHouseNo, //仓库号 |
| | |
| | | try |
| | | { |
| | | string str = "select RoadwayNo,RoadwayName,WareHouseNo from SysStorageRoadway where IsDel = @isdel and WareHouseNo = @warehouseno"; |
| | | |
| | | |
| | | List<RoadwayDto> roadway = Db.Ado.SqlQuery<RoadwayDto>(str, new |
| | | { |
| | | isdel = "0", //是否删除 |
| | |
| | | model.LocatNo = locatNo; |
| | | model.Status = storageLocat.Status; |
| | | model.PalletNo = stockDetailList[0].PalletNo; |
| | | |
| | | |
| | | List<LocateGoodsInfoVm> goodsList = new List<LocateGoodsInfoVm>(); |
| | | foreach (var item in stockDetailList) |
| | | { |
| | |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | |
| | | #region 平库图例 |
| | | |
| | | /// <summary> |
| | | /// 获取储位信息(平库图例) |
| | | /// </summary> |
| | | /// <param name="wareHouseNo">仓库</param> |
| | | /// <param name="row">排</param> |
| | | /// <returns></returns> |
| | | public List<SysStorageLocat> GetFlatLibraryLegend(string wareHouseNo, string row) |
| | | { |
| | | try |
| | | { |
| | | //一楼区域 |
| | | //List<string> row1 = new List<string>() |
| | | //{ |
| | | // "B01", |
| | | // "B02", |
| | | // "B03", |
| | | // "B04", |
| | | // "B05", |
| | | // "B06", |
| | | // "B07", |
| | | //}; |
| | | ////二楼区域 |
| | | //List<string> row3 = new List<string>() |
| | | //{ |
| | | // "B11", |
| | | // "B12", |
| | | // "B13", |
| | | // "B14", |
| | | // "B15", |
| | | //}; |
| | | string row1 = "'B01','B02','B03','B04','B05','B06','B07'"; |
| | | string row3 = "'B11','B12','B13','B14','B15'"; |
| | | string str = $"select * from SysStorageLocat where IsDel = '0' and WareHouseNo = '{wareHouseNo}' and "; |
| | | if (row == "1") |
| | | { |
| | | str += $" AreaNo in ({row1})"; |
| | | } |
| | | else if (row == "3") |
| | | { |
| | | str += $" AreaNo in ({row3})"; |
| | | } |
| | | |
| | | var list = Db.Ado.SqlQuery<SysStorageLocat>(str); |
| | | |
| | | //var list = Db.Queryable<SysStorageLocat>().Where(m => m.IsDel == "0" && m.WareHouseNo == wareHouseNo && row == "1" ? row1.Contains(m.AreaNo) : row3.Contains(m.AreaNo)).ToList(); |
| | | |
| | | return list; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |