yyk
2024-08-29 2a9bf520f65e85777fff0f20f4c84ba9a810eef5
Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
@@ -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;
@@ -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($"托盘绑定明细中,含有箱码物料或批次不一致");
@@ -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) => e.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,
@@ -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(",");