bklLiudl
2024-09-02 9885a8a2f98104f5ee63dd5ab8023095a1d8b9f6
Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
@@ -33,7 +33,7 @@
        #region 接口方法
        //JC23绑定物料托盘即增加库存
        //JC26绑定物料托盘即增加库存
        public void BindPalletStock(BoxPalletBindVm model, int userId)
        {
            try
@@ -227,7 +227,9 @@
                BllQualityInspect quality = new BllQualityInspect();
                if (model.Type == "0")
                {
                    quality = Db.Queryable<BllQualityInspect>().Where(a => a.IsDel == "0" && a.SkuNo == detail.SkuNo && a.LotNo == detail.LotNo).OrderByDescending(a => a.CreateTime).First();
                    quality = Db.Queryable<BllQualityInspect>()
                        .Where(a => a.IsDel == "0" && a.SkuNo == detail.SkuNo && a.LotNo == detail.LotNo)
                        .OrderByDescending(a => a.CreateTime).First();
                }
                DataStockDetail sd1 = null;
@@ -265,7 +267,7 @@
                        InspectQty = 0,
                        ASNNo = bind.ASNNo,
                        ASNDetailNo = bind.ASNDetailNo,
                        WareHouseNo = "",//所属仓库
                        WareHouseNo = "W01",//所属仓库
                        RoadwayNo = "",//所属巷道
                        AreaNo = "",//所属区域
                        LocatNo = "",//储位地址
@@ -399,10 +401,11 @@
                }
                else if (model.Type == "0")//物料托
                {
                    if (model.Detail.Count(m => m.OrderCode != detail.OrderDetailCode) > 0)
                    {
                        throw new Exception($"托盘绑定明细中,含有箱码生产工单不一致");
                    }
                    // 使用场景不明确
                    //if (model.Detail.Count(m => m.OrderCode != detail.OrderDetailCode) > 0)
                    //{
                    //    throw new Exception($"托盘绑定明细中,含有箱码生产工单不一致");
                    //}
                    if (model.Detail.Count(m => m.SkuNo != model.SkuNo || m.LotNo != model.LotNo) > 0)
                    {
                        throw new Exception($"托盘绑定明细中,含有箱码物料或批次不一致");
@@ -443,8 +446,8 @@
                                Standard = box.Standard,
                                PackageStandard = box.PackageStandard,
                                StoreTime = box.StoreTime,
                                QtyCount = (int)box.QtyCount,
                                QtyOrd = (int)box.QtyOrd,
                                QtyCount = box.QtyCount,
                                QtyOrd = box.QtyOrd,
                                CreateUser = userId,
                                CreateTime = comTime,
                            };
@@ -592,7 +595,7 @@
        #endregion
        #region 托盘绑定
        #region 组托收货
        public List<PalletBindDto> GetPalletBindList(PalletBindVm model, out int count)
        {
            try
@@ -601,8 +604,17 @@
                if (!string.IsNullOrWhiteSpace(model.SkuNo) || !string.IsNullOrWhiteSpace(model.SkuName))
                {
                    var detailList = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.IsDel == "0" && m.SkuNo.Contains(model.SkuNo.Trim()) && m.SkuName.Contains(model.SkuName.Trim())).Select(m => m.Id).Distinct().ToList();
                    var detailList = Db.Queryable<BllArrivalNoticeDetail>()
                        .Where(m => m.IsDel == "0" && m.SkuNo.Contains(model.SkuNo.Trim()) && m.SkuName.Contains(model.SkuName.Trim()))
                        .Select(m => m.Id).Distinct().ToList();
                    strList = detailList;
                    if (strList.Count <= 0)
                    {
                        // 物料编码、名称检索失败直接返回null
                        count = 0;
                        return null;
                    }
                }
                Expression<Func<BllPalletBind, bool>> item = Expressionable.Create<BllPalletBind>()
                  .AndIF(!string.IsNullOrWhiteSpace(model.ASNNo), it => it.ASNNo.Contains(model.ASNNo.Trim()))
@@ -614,7 +626,7 @@
                  .AndIF(!string.IsNullOrWhiteSpace(model.LotNo), it => it.LotNo.Contains(model.LotNo.Trim()))
                  .AndIF(!string.IsNullOrWhiteSpace(model.LotText), it => it.LotText.Contains(model.LotText.Trim()))
                  .AndIF(!string.IsNullOrWhiteSpace(model.StartTime), it => it.CreateTime >= Convert.ToDateTime(model.StartTime))
                  .AndIF(!string.IsNullOrWhiteSpace(model.EndTime), it => it.CreateTime <= Convert.ToDateTime(model.EndTime))
                  .AndIF(!string.IsNullOrWhiteSpace(model.EndTime), it => it.CreateTime <= Convert.ToDateTime(model.EndTime).AddDays(1))
                  .AndIF(!string.IsNullOrWhiteSpace(model.Status), it => it.Status == model.Status)
                  .And(m => m.IsDel == "0")
                  .ToExpression();//注意 这一句 不能少
@@ -624,9 +636,10 @@
                    .LeftJoin<BllArrivalNoticeDetail>((a, b) => a.ASNDetailNo == b.Id)
                    .LeftJoin<SysUserInfor>((a, b, c) => a.CreateUser == c.Id)
                    .LeftJoin<SysUserInfor>((a, b, c, d) => a.UpdateUser == d.Id)
                    //.LeftJoin<SysStorageLocat>((a, b, c, d, e) => a.LocatNo == e.LocatNo)
                    .LeftJoin<SysStorageLocat>((a, b, c, d, e) => a.LocatNo == e.LocatNo)
                    .LeftJoin<SysWareHouse>((a, b, c, d, e,f) => a.WareHouseNo == f.WareHouseNo)
                    //.LeftJoin<BllBoxInfo>((a, b, c, d, e, f) => a.Id == e.BindNo)
                    .Select((a, b, c, d) => new PalletBindDto()
                    .Select((a, b, c, d,e,f) => new PalletBindDto()
                    {
                        Id = a.Id,
                        ASNNo = a.ASNNo,
@@ -638,6 +651,7 @@
                        LocatNo = a.LocatNo,
                        RoadwayNo = a.RoadwayNo,
                        WareHouseNo = a.WareHouseNo,
                        WareHouseName = a.WareHouseNo+"-"+f.WareHouseName,
                        Qty = a.Qty,
                        FullQty = a.FullQty,
                        SamplingQty = a.SamplingQty,
@@ -1361,7 +1375,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 == categoryAreaNo)
                   .And(m => categoryAreaNo.Contains(m.AreaNo))
                   .ToExpression();//注意 这一句 不能少
                var total = 0;
                var list = Db.Queryable<SysStorageLocat>().Where(item).OrderByDescending(a => a.Depth).OrderBy(a => a.Column)
@@ -1719,18 +1733,18 @@
                var sku = skuList.FirstOrDefault(m => m.SkuNo == skuNo);
                if (sku == null)
                {
                    throw new Exception("物料信息中未查询到入库单明细包含的物料信息,不可入库");
                    throw new Exception("物料编码不存在,不可入库");
                }
                //判断物料是否含有类别信息
                if (string.IsNullOrWhiteSpace(sku.CategoryNo))
                {
                    throw new Exception($"物料:{sku.SkuNo}未查询到类别信息");
                    throw new Exception($"物料:{sku.SkuNo}未设置类别,不可入库");
                }
                var skuCategory = skuCategoryList.FirstOrDefault(m => m.CategoryNo == sku.CategoryNo);
                if (skuCategory == null)
                {
                    throw new Exception($"未在类别信息中查询到物料:{sku.SkuNo}包含的类别");
                    throw new Exception($"{sku.SkuNo}物料类别不存在,不可入库");
                }
                var areaStr = skuCategory.AreaNo.Split(",");
@@ -1935,6 +1949,8 @@
                                Db.Updateable(bindModel).ExecuteCommand();
                                asnNo = stockModel.ASNNo;
                            }
                        }
                    }
                    foreach (DataStockDetail stockModel in stockDetail)