yuyou_x
2024-02-21 1c2113e154faacedebfb1f00a29bb26127ed1b73
Wms/WMS.BLL/SysServer/StorageLocatServer.cs
@@ -17,11 +17,11 @@
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;
        }
@@ -42,7 +42,7 @@
        /// <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
            {
@@ -58,8 +58,8 @@
                    .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)
@@ -119,7 +119,7 @@
            }
        }
        public bool EditStorageLocat(EditLocateVm model, int userId)
        {
            try
@@ -129,7 +129,7 @@
                return bl;
            }
            catch (Exception e)
            {
            {
                throw new Exception(e.Message);
            }
        }
@@ -187,12 +187,12 @@
                                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,
@@ -205,11 +205,11 @@
                                    CreateUser = userId
                                });
                            }
                        }
                    }
                }
@@ -234,10 +234,10 @@
            {
                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()
                        {
@@ -271,7 +271,7 @@
        {
            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;
            }
@@ -364,14 +364,14 @@
            {
                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>
@@ -384,20 +384,20 @@
        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>
@@ -448,7 +448,7 @@
            return depthlist;
        }
        /// <summary>
        /// 获取库位占比(圆)
@@ -607,7 +607,7 @@
            {
                //根据仓库号以及巷道号获取储位各状态数据
                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, //仓库号
@@ -636,7 +636,7 @@
            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", //是否删除
@@ -678,7 +678,7 @@
                    model.LocatNo = locatNo;
                    model.Status = storageLocat.Status;
                    model.PalletNo = stockDetailList[0].PalletNo;
                    List<LocateGoodsInfoVm> goodsList = new List<LocateGoodsInfoVm>();
                    foreach (var item in stockDetailList)
                    {
@@ -755,5 +755,64 @@
                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
    }
}