Browse Source

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

yuanrf 5 months ago
parent
commit
47fb07159b

+ 94 - 39
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -2533,9 +2533,9 @@ namespace OASystem.API.Controllers
                 int rowNumber = 1;
                 foreach (var subItem in item.childList)
                 {
-                    string remaksDescription = $"{rowNumber}、【{item.priceTypeStr}】{item.Instructions}({subItem.PriceName}) CNY:{subItem.ItemTotal.ToString("#0.00")}(单价:{subItem.Price.ToString("#0.00")} * {subItem.Quantity})";
+                    string remaksDescription = $"{rowNumber}、【{item.priceTypeStr}】{item.Instructions}({subItem.PriceName}) CNY:{subItem.ItemTotal.ToString("#0.0000")}(单价:{subItem.Price.ToString("#0.0000")} * {subItem.Quantity.ToString("#0.0000")})";
                     subItem.RemaksDescription = remaksDescription;
-                    string excelRemaksDescription = $"【{item.priceTypeStr}】{item.Instructions}({subItem.PriceName}) CNY:{subItem.ItemTotal.ToString("#0.00")}(单价:{subItem.Price.ToString("#0.00")} * {subItem.Quantity})【申请人:{item.CreateUser}  申请时间:{item.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")}】";
+                    string excelRemaksDescription = $"【{item.priceTypeStr}】{item.Instructions}({subItem.PriceName}) CNY:{subItem.ItemTotal.ToString("#0.0000")}(单价:{subItem.Price.ToString("#0.0000")} * {subItem.Quantity.ToString("#0.0000")})【申请人:{item.CreateUser}  申请时间:{item.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")}】";
                     subItem.ExcelRemaksDescription = excelRemaksDescription;
                     rowNumber++;
                 }
@@ -4242,7 +4242,21 @@ Group by PriceType ", dto.diId);
                         dt.Columns.Add(GetString(worksheet.Cells[i, j].Value));
                     //剩下的写入datatable
                     else
-                        dr[j - 1] = GetString(worksheet.Cells[i, j].Value);
+                    {
+                        var cell = worksheet.Cells[i, j];
+
+                        if (j == 1 || j == 2)
+                        {
+                            if (cell.Value is double)
+                            {
+                                dr[j - 1] = EPPlusConvertToDateTime((double)cell.Value).ToString("MM/dd");
+                            }
+                        }
+                        else
+                        {
+                            dr[j - 1] = GetString(cell.Value);
+                        }
+                    }
                 }
             }
             return dt;
@@ -4250,7 +4264,6 @@ Group by PriceType ", dto.diId);
 
         private string GetString(object obj)
         {
-
             if (obj == null)
                 return "";
 
@@ -4258,6 +4271,15 @@ Group by PriceType ", dto.diId);
 
         }
 
+        public static DateTime EPPlusConvertToDateTime(double numericDate)
+        {
+            // Excel起始日期
+            DateTime startDate = new DateTime(1899, 12, 30);
+            // 将数字日期转换为时间间隔,并加上起始日期
+            TimeSpan duration = new TimeSpan((long)(numericDate * TimeSpan.TicksPerDay));
+            return startDate.Add(duration);
+        }
+
         private DataTable ExcelFileToDataTable(IFormFile file)
         {
             DataTable dtTest = null;
@@ -4302,7 +4324,7 @@ Group by PriceType ", dto.diId);
         /// <returns></returns>
         [HttpPost]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> PostCreditCardBill(IFormFile file, int cardType, string beginDt, string endDt)
+        public async Task<IActionResult> PostCreditCardBill(IFormFile file, int cardType,  string beginDt,  string endDt)
         {
             if (file == null || file.Length < 1)
             {
@@ -4319,8 +4341,8 @@ Group by PriceType ", dto.diId);
 
             if (string.IsNullOrEmpty(beginDt) || string.IsNullOrEmpty(endDt)) return Ok(JsonView(false, "请输入开始/结束日期!"));
 
-            var beginValid = DateTime.TryParse(beginDt, out _);
-            var endValid = DateTime.TryParse(endDt, out _);
+            var beginValid = DateTime.TryParse(beginDt, out DateTime _beginDt);
+            var endValid = DateTime.TryParse(endDt, out DateTime _endDt);
             if (!beginValid || !endValid) return Ok(JsonView(false, "请输入正确的日期格式"));
 
             //读取ExcelFile
@@ -4339,6 +4361,41 @@ Group by PriceType ", dto.diId);
                 return Ok(JsonView(false, $"未查询到 {beginDt} 至 {endDt} 信用卡账单信息!!!!"));
             }
 
+            //酒店刷卡信息
+            var hotelData = await _sqlSugar.Queryable<Grp_HotelReservations>()
+                .LeftJoin<Grp_HotelReservationsContent>((hr, hrc) => hr.Id == hrc.HrId)
+                .Where((hr, hrc) => hr.IsDel == 0 && hrc.Price > 0 && hrc.IsPay == 1)
+                .Select((hr, hrc) => new
+                {
+                    hrc.DiId,
+                    hrc.HrId,
+                    hrc.Id,
+                    hrc.PriceType,
+                    hrc.Price,
+                    hrc.Currency,
+                    hrc.Rate,
+                    hrc.IsOppay,
+                    hrc.PayDId,
+                    hrc.ConsumptionPatterns,
+                    hrc.ConsumptionDate,
+                    ConsumptionDt = string.IsNullOrEmpty(hrc.ConsumptionDate) ? new DateTime(1990, 12, 30) : Convert.ToDateTime(hrc.ConsumptionDate),
+                    hrc.CTDId,
+                    hrc.BankNo,
+                    hrc.CardholderName,
+                    hrc.CompanyBankNo,
+                    hrc.OtherBankName,
+                    hrc.OtherSideNo,
+                    hrc.IsPay,
+                    hrc.Payee,
+                    hrc.OrbitalPrivateTransfer
+                })
+                .ToListAsync();
+
+            if (hotelData.Count > 0)
+            {
+                hotelData = hotelData.Where(x => x.ConsumptionDt >= _beginDt && x.ConsumptionDt <= _endDt).ToList();
+            }
+
             //资源信息
             var delegationInfos = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0).ToList();
             var users = _sqlSugar.Queryable<Sys_Users>().Where(it => it.IsDel == 0).ToList();
@@ -4601,22 +4658,23 @@ Group by PriceType ", dto.diId);
                         }
                     }
 
-                    var HotelGroupReuslt = List_ccp.Where(x => x.CTable == 76).GroupBy(x => x.DIId).ToList();
-                    if (HotelGroupReuslt != null && HotelGroupReuslt.Count > 0)
+                    //机票刷卡记录
+                    var hotelGroupReuslt = hotelData.Where(x => x.CTDId == 86).GroupBy(x => x.DiId).ToList();
+                    if (hotelGroupReuslt != null && hotelGroupReuslt.Count > 0)
                     {
-                        foreach (var item in HotelGroupReuslt)
+                        foreach (var item in hotelGroupReuslt)
                         {
-                            if (item.Count() > 1)
+                            if (item.Count() > 0)
                             {
-                                var di = delegationInfos.Find(it => it.Id == item.Key);
-                                var obj = item.FirstOrDefault();
-                                obj.Remark = "团组酒店总价";
-                                if (di != null)
+                                var hotelInfo = new Grp_CreditCardPayment()
                                 {
-                                    obj.Remark = "团组酒店总价(" + di.TeamName + ")";
-                                }
-                                obj.RMBPrice = item.Sum(x => x.RMBPrice);//合计人民币
-                                List_ccp.Add(obj);
+                                    Remark = $"团组酒店总价(" + delegationInfos.Find(it => it.Id == item.Key)?.TeamName ?? "" + ")",
+                                    RMBPrice = item.Sum(x => x.Price * x.Rate),
+                                    ConsumptionDate = item.FirstOrDefault()?.ConsumptionDate ?? ""
+                                };
+
+                                
+                                List_ccp.Add(hotelInfo);
                             }
                         }
                     }
@@ -4641,8 +4699,11 @@ Group by PriceType ", dto.diId);
                     for (int j = 0; j < dt.Rows.Count; j++)//遍历行
                     {
                         DataRow dr = dt1.NewRow(); //获取每一行的数据
-                        dr["TradingDay"] = dt.Rows[j][0].ToString();
-                        dr["TallyDay"] = dt.Rows[j][1].ToString();
+                        var tradingDay = dt.Rows[j][0].ToString();
+
+                        dr["TradingDay"] = tradingDay;
+                        var tallyDay = dt.Rows[j][1].ToString();
+                        dr["TallyDay"] = tallyDay;
                         dr["TransactionDesc"] = dt.Rows[j][2].ToString();
                         dr["RMBMoney"] = dt.Rows[j][3].ToString();
                         dr["CardNo"] = dt.Rows[j][4].ToString();
@@ -4683,7 +4744,9 @@ Group by PriceType ", dto.diId);
 
                         if (item["TradingDay"] != null)
                         {
-                            ExcelDt = DateTime.Parse(item["TradingDay"].ToString()).ToString("MMdd");
+                            
+                            ExcelDt = item["TradingDay"].ToString();
+                            
                         }
 
                         //加一获取金额区间
@@ -4691,7 +4754,7 @@ Group by PriceType ", dto.diId);
                         decimal MinTradingMoney = TradingMoney - 1;
 
                         //匹配C表金额相等的值
-                        var CList = List_ccp.FindAll(x => x.PayMoney < MaxTradingMoney && x.PayMoney > MinTradingMoney);
+                        var CList = List_ccp.FindAll(x => x.PayMoney <= MaxTradingMoney && x.PayMoney >= MinTradingMoney);
 
                         if (CList != null && CList.Count > 0)
                         {
@@ -4700,9 +4763,9 @@ Group by PriceType ", dto.diId);
                             {
                                 if (!string.IsNullOrWhiteSpace(Citem.ConsumptionDate))
                                 {
-                                    DBDt = DateTime.Parse(Citem.ConsumptionDate).ToString("MMdd");
+                                    DBDt = DateTime.Parse(Citem.ConsumptionDate).ToString("MM/dd");
 
-                                    if (DBDt == ExcelDt)
+                                    if (DBDt.Equals(ExcelDt))
                                     {
                                         item["TeamRemark"] = delegationInfos.Find(it => it.Id == Citem.DIId)?.TeamName;
                                         item["Handlers"] = users.Find(it => it.Id == Citem.CreateUserId)?.CnName;
@@ -4714,20 +4777,12 @@ Group by PriceType ", dto.diId);
                             #endregion
                         }
 
-                        if (item["TransactionDesc"].ToString().Contains("财付通"))
-                            item["State"] = "2";
-                        else if (item["TransactionDesc"].ToString().Contains("京东支付"))
-                            item["State"] = "2";
-                        else if (item["TransactionDesc"].ToString().Contains("微信支付"))
-                            item["State"] = "2";
-                        else if (item["TransactionDesc"].ToString().Contains("淘宝"))
-                            item["State"] = "2";
-                        else if (item["TransactionDesc"].ToString().Contains("支付宝"))
-                            item["State"] = "2";
-                        else if (item["TransactionDesc"].ToString().Contains("拼多多"))
-                            item["State"] = "2";
-                        else
-                            item["State"] = "0";
+                        var whereRange = new List<string>() { "财付通", "京东", "微信", "淘宝", "支付宝", "拼多多" };
+                        foreach (var where in whereRange)
+                        {
+                            if (item["TransactionDesc"].ToString().Contains(where)) item["State"] = "2";
+                            else item["State"] = "0";
+                        }
 
                         if (!string.IsNullOrEmpty(item["TeamRemark"].ToString()) && !string.IsNullOrEmpty(item["Handlers"].ToString()))
                             item["State"] = "1";

+ 19 - 0
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -24,6 +24,7 @@ using OASystem.Domain.Entities.Customer;
 using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.ViewModels.Groups;
+using OASystem.Domain.ViewModels.Statistics;
 using OASystem.Infrastructure.Repositories.Financial;
 using OASystem.Infrastructure.Repositories.Groups;
 using Quartz.Util;
@@ -801,6 +802,24 @@ namespace OASystem.API.Controllers
                         await GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.GroupBusinessOperations, title, content, userIds, diId);
                     }
 
+                    #region 应用推送
+                    try
+                    {
+                        await AppNoticeLibrary.SendChatMsg_GroupStatus_Create(diId, QiyeWeChatEnum.CompanyCRMChat);
+                        Sys_Users users = _airTicketResRep.Query<Sys_Users>(s => s.Id == dto.UserId).First();
+                        Sys_Department department = _airTicketResRep.Query<Sys_Department>(s => s.Id == users.DepId).First();
+                        if (department.Id == 6 && !string.IsNullOrEmpty(users.QiyeChatUserId))
+                        {
+                            List<string> userList = new List<string>() { users.QiyeChatUserId };
+                            await AppNoticeLibrary.SendUserMsg_GroupStatus_Create(diId, userList);
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                    }
+                    #endregion
+
+
                     //默认创建倒推表
                     await _invertedListRep._Create(dto.UserId, diId);
                 }

+ 1 - 1
OASystem/OASystem.Domain/Entities/Financial/Fin_DailyFeePayment.cs

@@ -21,7 +21,7 @@ namespace OASystem.Domain.Entities.Financial
         /// <summary>
         /// 合计
         /// </summary>
-        [SugarColumn(IsNullable = true,ColumnDataType = "decimal(10,2)")]
+        [SugarColumn(IsNullable = true,ColumnDataType = "decimal(18,4)")]
         public decimal SumPrice { get; set; }
 
         /// <summary>

+ 2 - 2
OASystem/OASystem.Domain/Entities/Financial/Fin_DailyFeePaymentContent.cs

@@ -33,13 +33,13 @@ namespace OASystem.Domain.Entities.Financial
         /// <summary>
         /// 单价
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(18,4)")]
         public decimal Price { get; set; }
 
         /// <summary>
         /// 单项费用合计
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(18,4)")]
         public decimal ItemTotal { get; set; }
 
         

+ 1 - 1
OASystem/OASystem.Domain/ViewModels/Groups/FeeAuditView.cs

@@ -18,7 +18,7 @@ namespace OASystem.Domain.ViewModels.Groups
     {
         #region OP 自动审核相关
 
-       
+        public DateTime CurrTime { get; set; }
 
         /// <summary>
         /// 自动审核 - 车费用

+ 121 - 0
OASystem/OASystem.Domain/ViewModels/PersonnelModule/GoodsInfoView.cs

@@ -15,6 +15,127 @@ namespace OASystem.Domain.ViewModels.PersonnelModule
     {
     }
 
+    #region 物品领用List
+
+
+    [SugarTable(tableName: "Pm_GoodsInfo", tableDescription: "物品信息表")]
+    public class GoodsListView
+    {
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+        public int Id { get; set; }
+
+        public string Name { get; set; }
+
+        public int Type { get; set; }
+
+        [SugarColumn(IsIgnore = true)]
+        public string TypeName { get; set; }
+
+        public decimal StockQuantity { get; set; }
+
+        //SugarColumn(IsIgnore = true),
+
+        [Navigate(NavigateType.OneToMany, nameof(GoodsListReceiveView.GoodsId))]
+        //[Navigate(NavigateType.OneToMany, nameof(GoodsListReceiveView.GoodsId), nameof(Id))]
+        public List<GoodsListReceiveView> Receives { get; set; }//注意禁止给books手动赋值
+
+
+        [SugarColumn(IsIgnore = true)]
+        public decimal WaitAuditQuantity
+        {
+            get
+            {
+                var quantity = 0.00M;
+                if (Receives.Count > 0)
+                {
+                    quantity = Receives.Sum(x => x.Quantity);
+                }
+                return quantity;
+            }
+        }
+
+
+        [SugarColumn(IsIgnore = true)]
+        public string StockQuantityLabel
+        {
+            get
+            {
+                var str = "";
+                if (WaitAuditQuantity > 0)
+                {
+                    str = $"物品待审核数量合计:{WaitAuditQuantity.ToString("#0.00")}";
+                }
+
+                return str;
+            }
+        }
+
+        public int LastUpdateUserId { get; set; }
+
+        [Navigate(NavigateType.OneToOne, nameof(Type))]
+        public GoodsListSetDataView TypeData { get; set; }
+
+        [Navigate(NavigateType.OneToOne, nameof(LastUpdateUserId))]
+        public GoodsListUsersView UserData { get; set; }
+
+        public DateTime LastUpdateTime { get; set; }
+
+        public string Remark { get; set; }
+
+        public int IsDel { get; set; }
+    }
+
+
+    [SugarTable(tableName: "Pm_GoodsReceive", tableDescription: "物品领用表")]
+    public class GoodsListReceiveView
+    {
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+        public int Id { get; set; }
+        /// <summary>
+        /// 商品Id
+        /// Pm_GoodsInfo Id
+        /// </summary>
+        public int GoodsId { get; set; }
+
+        /// <summary>
+        /// 领用数量
+        /// </summary>
+        public decimal Quantity { get; set; }
+
+        /// <summary>
+        /// 审核状态
+        /// </summary>
+        public GoodsAuditEnum AuditStatus { get; set; } = GoodsAuditEnum.Pending;
+
+        public int IsDel { get; set; }
+
+    }
+
+    [SugarTable(tableName: "Sys_SetData", tableDescription: "")]
+    public class GoodsListSetDataView
+    {
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string Name { get; set; }
+    }
+    [SugarTable(tableName: "Sys_Users", tableDescription: "")]
+    public class GoodsListUsersView
+    {
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string CnName { get; set; }
+    }
+    #endregion
+
+
     /// <summary>
     /// 物品类型View
     /// </summary>

+ 26 - 13
OASystem/OASystem.Infrastructure/Repositories/Groups/FeeAuditRepository.cs

@@ -62,6 +62,19 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     if (index >= 0)
                     {
                         costContents[i].Date = costContents[index].Date;
+                        var dtBool = DateTime.TryParse(costContents[i].Date, out DateTime _dateTime);
+                        if (dtBool)
+                        {
+                            costContents[i].CurrTime = _dateTime;
+                        }
+                    }
+                }
+                else
+                {
+                    var dtBool = DateTime.TryParse(costContents[i].Date, out DateTime _dateTime);
+                    if (dtBool)
+                    {
+                        costContents[i].CurrTime = _dateTime;
                     }
                 }
             }
@@ -101,7 +114,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 DateTime checkIn = Convert.ToDateTime(hotelCostInfo.CheckInDate),
                          checkOut = Convert.ToDateTime(hotelCostInfo.CheckOutDate);
                 if (checkOut > checkIn) checkOut = checkOut.AddDays(-1); //房费计算,结束日期为前一天
-                var hotelCostInfos = costContents.Where(x => Convert.ToDateTime(x.Date) >= checkIn && Convert.ToDateTime(x.Date) <= checkOut).ToList();
+                var hotelCostInfos = costContents.Where(x =>  x.CurrTime >= checkIn && x.CurrTime <= checkOut).ToList();
                 if (hotelCostInfos.Count < 1) isAutoAudit = false;
 
                 decimal otherFee = hotelCostDetails.Where(x => x.PriceType != 1).Sum(x => x.Price * (x.Rate == 0.0000M ? 1.0000M : x.Rate));
@@ -109,26 +122,26 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 var hotelCostInfosGroup = hotelCostInfos.GroupBy(x => x.Date);
                 foreach (var item in hotelCostInfosGroup)
                 {
-                    decimal hotelSingleRoomFee = item.Sum(x => x.HotelSingleRoomFee);
-                    decimal hotelDoubleRoomFee = item.Sum(x => x.HotelDoubleRoomFee);
-                    decimal hotelSuiteFee = item.Sum(x => x.HotelSuiteFee);
-                    decimal hotelSuiteRoomFee = item.Sum(x => x.HotelSuiteRoomFee);
+                    var hotelSingleRoomFee = item.Sum(x => x.HotelSingleRoomFee) * _teamRate; //成本单间费用
+                    var hotelDoubleRoomFee = item.Sum(x => x.HotelDoubleRoomFee) * _teamRate; //成本双人间费用
+                    var hotelSuiteFee = item.Sum(x => x.HotelSuiteFee) * _teamRate;           //成本套房费用
+                    var hotelSuiteRoomFee = item.Sum(x => x.HotelSuiteRoomFee) * _teamRate;   //成本其他房型间费用
                     //1.判断费用是否 <= 成本费用
                     //1.1 判断单间费用
-                    decimal singleRoomPrice = (hotelCostInfo.SingleRoomPrice + otherFee) * _rate;
-                    if (singleRoomPrice > 0) if (singleRoomPrice > hotelSingleRoomFee * _rate) isAutoAudit = false;
+                    decimal singleRoomPrice = (hotelCostInfo.SingleRoomPrice + otherFee) * _rate; //酒店录入费用
+                    if (singleRoomPrice > 0) if (singleRoomPrice > hotelSingleRoomFee) isAutoAudit = false;
 
                     //1.2 判断双人间费用
-                    decimal doubleRoomPrice = (hotelCostInfo.DoubleRoomPrice + otherFee) * _rate;
-                    if (doubleRoomPrice > 0) if (doubleRoomPrice > hotelDoubleRoomFee * _rate) isAutoAudit = false;
+                    decimal doubleRoomPrice = (hotelCostInfo.DoubleRoomPrice + otherFee) * _rate;//酒店录入费用
+                    if (doubleRoomPrice > 0) if (doubleRoomPrice > hotelDoubleRoomFee) isAutoAudit = false;
 
                     //1.3 判断套房费用
-                    decimal suiteRoomPrice = (hotelCostInfo.SuiteRoomPrice + otherFee) * _rate;
-                    if (suiteRoomPrice > 0) if (suiteRoomPrice > hotelSuiteFee * _rate) isAutoAudit = false;
+                    decimal suiteRoomPrice = (hotelCostInfo.SuiteRoomPrice + otherFee) * _rate;//酒店录入费用
+                    if (suiteRoomPrice > 0) if (suiteRoomPrice > hotelSuiteFee) isAutoAudit = false;
 
                     //1.4 判断其他房型费用
-                    decimal otherRoomPrice = (hotelCostInfo.OtherRoomPrice + otherFee) * _rate;
-                    if (otherRoomPrice > 0) if (otherRoomPrice > hotelSuiteRoomFee * _rate) isAutoAudit = false;
+                    decimal otherRoomPrice = (hotelCostInfo.OtherRoomPrice + otherFee) * _rate;//酒店录入费用
+                    if (otherRoomPrice > 0) if (otherRoomPrice > hotelSuiteRoomFee) isAutoAudit = false;
                 }
 
                 //2.判断是否自动审核

+ 27 - 20
OASystem/OASystem.Infrastructure/Repositories/PersonnelModule/GoodsRepository.cs

@@ -1,4 +1,5 @@
 using AutoMapper;
+using EyeSoft.Reflection;
 using Newtonsoft.Json;
 using OASystem.Domain.Dtos.PersonnelModule;
 using OASystem.Domain.Entities.Groups;
@@ -93,28 +94,34 @@ namespace OASystem.Infrastructure.Repositories.PersonnelModule
             }
 
             RefAsync<int> total = 0;
-            var data = await _sqlSugar.Queryable<Pm_GoodsInfo>()
-                                      .LeftJoin<Sys_SetData>((gi, sd) => gi.Type == sd.Id)
-                                      .LeftJoin<Sys_Users>((gi, sd, u) => gi.LastUpdateUserId == u.Id)
-                                      .Where((gi, sd, u) => gi.IsDel == 0)
-                                      .WhereIF(ids.Count > 0, (gi, sd, u) => ids.Contains(gi.Type))
-                                      .WhereIF(!string.IsNullOrEmpty(dto.GoodsName), (gi, sd, u) => gi.Name.Contains(dto.GoodsName))
-                                      .Select((gi, sd, u) => new
-                                      {
-                                          gi.Id,
-                                          gi.Name,
-                                          gi.Type,
-                                          TypeName = sd.Name,
-                                          gi.StockQuantity,
-                                          LastUpdateUserName = u.CnName,
-                                          gi.LastUpdateTime,
-                                          gi.Remark,
-                                      })
-                                      .OrderByDescending(gi => gi.LastUpdateTime)
-                                      .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
+
+            var data = await _sqlSugar.Queryable<GoodsListView>()
+                .Includes(glv => glv.Receives.Where(z1 => z1.IsDel == 0 && z1.AuditStatus == GoodsAuditEnum.Pending).ToList())
+                .Includes(glv => glv.TypeData)
+                .Includes(glv => glv.UserData)
+                .LeftJoin<Sys_SetData>((glv, sd) => glv.Type == sd.Id)
+                .LeftJoin<Sys_Users>((glv, sd, u) => glv.LastUpdateUserId == u.Id)
+                .Where(glv => glv.IsDel == 0)
+                .WhereIF(ids.Count > 0, glv => ids.Contains(glv.Type))
+                .WhereIF(!string.IsNullOrEmpty(dto.GoodsName), glv => glv.Name.Contains(dto.GoodsName))
+                .OrderByDescending(glv => glv.LastUpdateTime)
+                .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
+
+
+            var view = data.Select(x => new
+            {
+                x.Id,
+                x.Name,
+                x.Type,
+                TypeName = x.TypeData?.Name ?? string.Empty,
+                LastUpdateUserName = x.UserData?.CnName ?? string.Empty,
+                x.LastUpdateTime,
+                StockQuantity = x.StockQuantity - x.WaitAuditQuantity,
+                x.StockQuantityLabel,
+            }).ToList();
 
             _jv.Code = StatusCodes.Status200OK;
-            _jv.Data = data;
+            _jv.Data = view;
             _jv.Count = total;
             _jv.Msg = $"操作成功";
             return _jv;