Administrator
2024-03-06 b2e1c1b263d0cbf6018585b2113cc90abfcf3ed6
Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
@@ -551,10 +551,19 @@
        #region 指定储位
        //指定储位数据源(正常的空储位)
        public List<LocatDto> GetLocateList(string houseNo, string roadwayNo, string row, string column, string layer, string locateNo, int page, int limit, out int count)
        public List<LocatDto> GetLocateList(string houseNo, string roadwayNo, string row, string column, string layer, string locateNo, string BindId, int page, int limit, out int count)
        {
            try
            {
                //获取托盘绑定
                var bindASNDetailNo = Db.Queryable<BllPalletBind>().Where(a => a.IsDel == "0" && a.Status == "0" && a.Id == int.Parse(BindId)).Select(a => a.ASNDetailNo).First();
                //获取单据明细
                var noticeDetailSkuNo = Db.Queryable<BllArrivalNoticeDetail>().Where(a => a.Id == bindASNDetailNo && a.IsDel == "0").Select(a => a.SkuNo).First();
                //获取物料
                var skuCategoryNo = Db.Queryable<SysMaterials>().Where(a => a.IsDel == "0" && a.SkuNo == noticeDetailSkuNo).Select(a => a.CategoryNo).First();
                //获取物料对应区域
                var categoryAreaNo = Db.Queryable<SysMaterialCategory>().Where(a => a.IsDel == "0" && a.CategoryNo == skuCategoryNo).Select(a => a.AreaNo).First();
                Expression<Func<SysStorageLocat, bool>> item = Expressionable.Create<SysStorageLocat>()
                   .AndIF(!string.IsNullOrWhiteSpace(roadwayNo), m => m.RoadwayNo == roadwayNo)
                   .AndIF(!string.IsNullOrWhiteSpace(row), m => m.Row == int.Parse(row))
@@ -562,6 +571,7 @@
                   .AndIF(!string.IsNullOrWhiteSpace(layer), m => m.Layer == int.Parse(layer))
                   .AndIF(!string.IsNullOrWhiteSpace(locateNo), m => m.LocatNo.Contains(locateNo))
                   .And(m => m.IsDel == "0" && m.Status == "0" && m.Flag == "0" && m.WareHouseNo == houseNo)
                   .And(m => m.AreaNo.Contains(categoryAreaNo))
                   .ToExpression();//注意 这一句 不能少
                var total = 0;
                var list = Db.Queryable<SysStorageLocat>().Where(item)
@@ -611,6 +621,59 @@
                {
                    throw new Exception("该储位状态不是空储位或标志不是正常的");
                }
                //判断当前托盘是否存在绑定信息
                if (bind.LocatNo != null)
                {
                    //分割已绑储位与新储位
                    //已绑储位
                    var bindRow = bind.LocatNo.Substring(0, 2);
                    var bindColumn = bind.LocatNo.Substring(2, 2);
                    var bindLayer = bind.LocatNo.Substring(4, 2);
                    var bindDepth = bind.LocatNo.Substring(6, 2);
                    //新储位
                    var Row = locate.LocatNo.Substring(0, 2);
                    var Column = locate.LocatNo.Substring(2, 2);
                    var Layer = locate.LocatNo.Substring(4, 2);
                    var Depth = locate.LocatNo.Substring(6, 2);
                    if (bindDepth == "02")
                    {
                        //判断排列层是否相同
                        if (bindRow == Row && bindColumn == Column && bindLayer == Layer)
                        {
                            throw new Exception("同储位深度2不可向深度1切换!");
                        }
                    }
                }
                else
                {
                    //若是深度1的 则判断深度2是否为空储位
                    if (locate.Depth == "01")
                    {
                        var locateDepth = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.Row == locate.Row && a.Column == locate.Column && a.Layer == locate.Layer && a.Depth == "02");
                        if (locateDepth != null)
                        {
                            if (locateDepth.Status != "1")
                            {
                                throw new Exception("该储位深度2不是有物品,不可绑定");
                            }
                        }
                    }
                    //判断是否为深度2的 若为深度2 则获取深度1储位 判断是否为空储位
                    if (locate.Depth == "02")
                    {
                        var locateDepth = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.Row == locate.Row && a.Column == locate.Column && a.Layer == locate.Layer && a.Depth == "01");
                        if (locateDepth.Status != "0" || locateDepth.Flag == "2")
                        {
                            throw new Exception("该储位深度1不是空储位或标志不是正常的");
                        }
                    }
                }
                var bindIdList = Db.Queryable<BllPalletBind>().Where(m => m.IsDel == "0" && m.PalletNo == bind.PalletNo && m.Status != "2").Select(m => m.Id).ToList();
                //判断是否有零箱
                foreach (var item in bindIdList)