Browse Source

优化 GroupsController.cs 及相关文件

在 `GroupsController.cs` 中移除冗余的 `using` 语句,调整方法参数格式,增强代码可读性。增加费用删除验证逻辑,确保删除团组前检查相关费用。修复 `AirHotelPrice` 中的房间费用计算逻辑,并在 `GoodsRepository.cs` 中修正 `GoodsId` 引用。最后,在 `OrderPreInfoView.cs` 中添加 `GroupName` 属性以支持视图模型。
LEIYI 3 weeks ago
parent
commit
1969a9a477

+ 128 - 95
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -1,20 +1,10 @@
 using Aspose.Cells;
-using Aspose.Cells.Drawing;
 using Aspose.Words;
 using Aspose.Words.Drawing;
 using Aspose.Words.Tables;
 using DiffMatchPatch;
-using EyeSoft.Runtime.InteropServices;
-using Google.Protobuf.WellKnownTypes;
-using Microsoft.AspNetCore.Mvc.RazorPages;
 using Microsoft.AspNetCore.SignalR;
-using Microsoft.EntityFrameworkCore.Metadata.Internal;
-using Microsoft.IdentityModel.Tokens;
-using Microsoft.VisualBasic;
-using MySqlX.XDevAPI.Relational;
-using NetTaste;
 using NPOI.HSSF.UserModel;
-using NPOI.SS.Formula.Functions;
 using NPOI.SS.UserModel;
 using NPOI.SS.Util;
 using NPOI.XSSF.UserModel;
@@ -38,32 +28,18 @@ using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.ViewModels.Financial;
 using OASystem.Domain.ViewModels.Groups;
-using OASystem.Domain.ViewModels.JuHeExchangeRate;
 using OASystem.Domain.ViewModels.OCR;
-using OASystem.Domain.ViewModels.QiYeWeChat;
-using OASystem.Domain.ViewModels.Statistics;
 using OASystem.Infrastructure.Repositories.CRM;
 using OASystem.Infrastructure.Repositories.Financial;
 using OASystem.Infrastructure.Repositories.Groups;
-using OASystem.Infrastructure.Tools;
-using OASystem.RedisRepository;
-using Org.BouncyCastle.Crypto;
-using Org.BouncyCastle.Utilities;
 using Quartz.Util;
 using SqlSugar.Extensions;
 using System.Collections;
-using System.Collections.Generic;
 using System.Data;
 using System.Diagnostics;
-using System.Drawing.Printing;
 using System.Globalization;
-using System.IO;
 using System.IO.Compression;
-using System.Reflection;
-using System.Text.Json;
 using System.Web;
-using System.Xml.Linq;
-using TencentCloud.Ocr.V20181119.Models;
 using static OASystem.API.OAMethodLib.JWTHelper;
 using static OASystem.Infrastructure.Repositories.Groups.AirTicketResRepository;
 using Bookmark = Aspose.Words.Bookmark;
@@ -432,7 +408,7 @@ namespace OASystem.API.Controllers
                 {
                     Id = opi.Id,
                     Name = opi.Name,
-                    UnitName = SqlFunc.Subqueryable<Grp_OrderPreItem>().Where(x => x.ParentId == opi.Id && nameTempIds.Contains( x.FormTempId)).Select(x => x.Value),
+                    UnitName = SqlFunc.Subqueryable<Grp_OrderPreItem>().Where(x => x.ParentId == opi.Id && nameTempIds.Contains(x.FormTempId)).Select(x => x.Value),
                     VisitCountryVal = SqlFunc.Subqueryable<Grp_OrderPreItem>().Where(x => x.ParentId == opi.Id && countryTempIds.Contains(x.FormTempId)).Select(x => x.Value),
                     VisitDays = SqlFunc.Subqueryable<Grp_OrderPreItem>().Where(x => x.ParentId == opi.Id && daysTempIds.Contains(x.FormTempId)).Select(x => x.Value),
                     VisiPpNum = SqlFunc.Subqueryable<Grp_OrderPreItem>().Where(x => x.ParentId == opi.Id && ppNumTempIds.Contains(x.FormTempId)).Select(x => x.Value),
@@ -538,8 +514,8 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> CityByCountry(
             string countryLabel,
-            [FromQuery] int pageIndex, 
-            [FromQuery] int pageSize, 
+            [FromQuery] int pageIndex,
+            [FromQuery] int pageSize,
             [FromQuery] string search)
         {
             countryLabel = HttpUtility.UrlDecode(countryLabel);
@@ -595,7 +571,7 @@ namespace OASystem.API.Controllers
         /// <returns></returns>
         [HttpGet("{Id}/{TempId}")]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> GroupOrderPreInfo([FromRoute] GroupOrderPreInfoDto dto,int portType=1)
+        public async Task<IActionResult> GroupOrderPreInfo([FromRoute] GroupOrderPreInfoDto dto, int portType = 1)
         {
             return Ok(await _grpOrderPreInfoRep.InfoAsync(dto.Id, dto.TempId));
         }
@@ -1093,10 +1069,10 @@ namespace OASystem.API.Controllers
             di.VisitEndDate = endTime;
 
             var count = _sqlSugar.Updateable(di)
-                .UpdateColumns(x => new { x.VisitDate, x.VisitPNumber, x.VisitDays , x.VisitStartDate, x.VisitEndDate })
+                .UpdateColumns(x => new { x.VisitDate, x.VisitPNumber, x.VisitDays, x.VisitStartDate, x.VisitEndDate })
                 .ExecuteCommand();
 
-            return Ok( count > 0 ? JsonView(true, "操作成功") : jw);
+            return Ok(count > 0 ? JsonView(true, "操作成功") : jw);
         }
 
         /// <summary>
@@ -1698,11 +1674,67 @@ namespace OASystem.API.Controllers
         {
             var diId = dto.Id;
             if (diId < 1) return Ok(JsonView(false, MsgTips.Id));
-            #region 删除 验证 (费用录入、出入境费用、收款账单)
-            //var feeCount = _sqlSugar.Queryable<Grp_CreditCardPayment>().Where(x => x.IsDel == 0 && x.DIId == diId).Count();
-            //var eccCount = _sqlSugar.Queryable<Grp_EnterExitCost>().Where(x => x.IsDel == 0 && x.DiId == diId).Count();
-            //var frCount = _sqlSugar.Queryable<Fin_ForeignReceivables>().Where(x => x.IsDel == 0 && x.Diid == diId).Count();
-            //if (feeCount > 0 || feeCount > 0 || feeCount > 0) return Ok(JsonView(false, "该团组存在费用不可删除!"));
+            #region 删除 验证
+
+            /*
+             * 1、收款账单数据:0 条
+             * 2、收款退还数据:0 条
+             * 3、机票费用数据:0 条
+             * 4、签证费用数据:0 条
+             * 5、保险费用数据:0 条
+             * 6、酒店费用数据:0 条
+             * 7、公务出访数据:1 条
+             * 8、邀请公务活动费用数据:1 条
+             * 9、OP费用数据:5 条
+             * 10、其他费用数据:0 条
+             * 11、团组日付报销费用数据:0 条
+             * 
+             * 温馨提示:该团组已产生费用,不允许删除;如需删除,请先删除对应版块费用,谢谢!
+             */
+
+            //收款账单
+            int frCount = _sqlSugar.Queryable<Fin_ForeignReceivables>().Where(x => x.IsDel == 0 && x.Diid == diId).Count();
+            //收款退还
+            int fraomCount = _sqlSugar.Queryable<Fin_PaymentRefundAndOtherMoney>().Where(x => x.IsDel == 0 && x.DiId == diId).Count();
+            //机票费用
+            int arCount = _sqlSugar.Queryable<Grp_AirTicketReservations>().Where(x => x.IsDel == 0 && x.DIId == diId).Count();
+            //签证费用
+            int viCount = _sqlSugar.Queryable<Grp_VisaInfo>().Where(x => x.IsDel == 0 && x.DIId == diId).Count();
+            //保险费用
+            int cCount = _sqlSugar.Queryable<Grp_Customers>().Where(x => x.IsDel == 0 && x.DiId == diId).Count();
+            //酒店费用
+            int hrCount = _sqlSugar.Queryable<Grp_HotelReservations>().Where(x => x.IsDel == 0 && x.DiId == diId).Count();
+            //公务出访
+            int oaCount = _sqlSugar.Queryable<Res_OfficialActivities>().Where(x => x.IsDel == 0 && x.DiId == diId).Count();
+            //邀请公务活动费用
+            int ioaCount = _sqlSugar.Queryable<Grp_InvitationOfficialActivities>().Where(x => x.IsDel == 0 && x.DiId == diId).Count();
+            //OP费用
+            int ctggrCount = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().Where(x => x.IsDel == 0 && x.DiId == diId).Count();
+            //其他费用
+            int dpCount = _sqlSugar.Queryable<Grp_DecreasePayments>().Where(x => x.IsDel == 0 && x.DiId == diId).Count();
+            //团组日付报销费用
+            int dfpCount = _sqlSugar.Queryable<Fin_DailyFeePayment>().Where(x => x.IsDel == 0 && x.GroupId == diId).Count();
+
+            var feeCount = frCount + fraomCount + arCount + viCount + cCount + hrCount + oaCount + ioaCount + ctggrCount + dpCount + dfpCount;
+            if (feeCount > 0)
+            {
+                var delMsgTips = new StringBuilder();
+                delMsgTips.AppendLine($"1、收款账单数据:{frCount} 条");
+                delMsgTips.AppendLine($"2、收款退换数据:{fraomCount} 条");
+                delMsgTips.AppendLine($"3、机票费用数据:{arCount} 条");
+                delMsgTips.AppendLine($"4、签证费用数据:{viCount} 条");
+                delMsgTips.AppendLine($"5、保险费用数据:{cCount} 条");
+                delMsgTips.AppendLine($"6、酒店费用数据:{hrCount} 条");
+                delMsgTips.AppendLine($"7、公务出访数据:{oaCount} 条");
+                delMsgTips.AppendLine($"8、邀请公务活动费用数据:{ioaCount} 条");
+                delMsgTips.AppendLine($"9、OP费用数据:{ctggrCount} 条");
+                delMsgTips.AppendLine($"10、其他费用数据:{dpCount} 条");
+                delMsgTips.AppendLine($"11、团组日付报销费用数据:{dfpCount} 条");
+                delMsgTips.AppendLine($"");
+                delMsgTips.AppendLine($"温馨提示:该团组已产生费用,不允许删除;如需删除,请先删除对应版块费用,谢谢!");
+
+                return Ok(JsonView(false, delMsgTips.ToString()));
+            }
 
             #endregion
 
@@ -2102,7 +2134,7 @@ FROM
 
 
             var blackCodeList = await _sqlSugar.Queryable<Air_TicketBlackCode>()
-                                                .Where(x=>x.DiId == dto.GroupId && x.IsDel == 0)
+                                                .Where(x => x.DiId == dto.GroupId && x.IsDel == 0)
                                                 .ToListAsync();
 
             if (!blackCodeList.Any())
@@ -2172,14 +2204,14 @@ FROM
             var groupClints = await _sqlSugar.Queryable<Grp_TourClientList>()
                 .LeftJoin<Sys_SetData>((x, s) => s.Id == x.ShippingSpaceTypeId && s.IsDel == 0)
                 .LeftJoin<Crm_DeleClient>((x, s, dc) => x.ClientId == dc.Id && dc.IsDel == 0)
-                .LeftJoin<Crm_CustomerCompany>((x, s, dc,cc) => dc.CrmCompanyId == cc.Id && cc.IsDel == 0)
+                .LeftJoin<Crm_CustomerCompany>((x, s, dc, cc) => dc.CrmCompanyId == cc.Id && cc.IsDel == 0)
                 .Where((x, s, dc, cc) => x.DiId == dto.GroupId && x.IsDel == 0)
                 .Select((x, s, dc, cc) => new groupClints
                 {
-                    Id =x.Id,
-                    Name =s.Name,
-                    IsAccompany =x.IsAccompany,
-                    CompanyFullName =cc.CompanyFullName
+                    Id = x.Id,
+                    Name = s.Name,
+                    IsAccompany = x.IsAccompany,
+                    CompanyFullName = cc.CompanyFullName
                 })
                 .ToListAsync();
 
@@ -2208,14 +2240,14 @@ FROM
             }
 
             Dictionary<string, string> bookMarkDic = new Dictionary<string, string>();
-            bookMarkDic.Add("ClientUnit",di.ClientUnit);
+            bookMarkDic.Add("ClientUnit", di.ClientUnit);
             bookMarkDic.Add("VisitCountry", di.VisitCountry);
             bookMarkDic.Add("VisitDate", di.VisitDate.ToString("yyyy年MM月dd日"));
             bookMarkDic.Add("VisitPNumber", di.VisitPNumber.ToString());
             bookMarkDic.Add("CityPath", cityPath);
             bookMarkDic.Add("StartCity", startCity);
             bookMarkDic.Add("EndCity", endCity);
-            bookMarkDic.Add("StayDays", $"{di.VisitDays}天{di.VisitDays -1}晚");
+            bookMarkDic.Add("StayDays", $"{di.VisitDays}天{di.VisitDays - 1}晚");
 
             Document doc = null;
             var percentage = 0.8M;
@@ -2250,7 +2282,7 @@ FROM
                         var cell = row.Cells[i];
 
                         // 读取单元格内容
-                        string cellTextFirst = row.Cells[0].FirstParagraph.ToString(Aspose.Words.SaveFormat.Text).Trim(); 
+                        string cellTextFirst = row.Cells[0].FirstParagraph.ToString(Aspose.Words.SaveFormat.Text).Trim();
 
                         if (cellTextFirst.Contains("舱位"))
                         {
@@ -2321,11 +2353,11 @@ FROM
             bookMarkDic.Add("ClientUnit1", di.ClientUnit);
             bookMarkDic.Add("VisitCountry1", di.VisitCountry);
             bookMarkDic.Add("DayCount", di.VisitDays.ToString());
-            bookMarkDic.Add("VisitingArea", di.VisitDate.ToString("yyyy年MM月dd日")+"-"+di.VisitEndDate.ToString("yyyy年MM月dd日"));
+            bookMarkDic.Add("VisitingArea", di.VisitDate.ToString("yyyy年MM月dd日") + "-" + di.VisitEndDate.ToString("yyyy年MM月dd日"));
             bookMarkDic.Add("CityPath1", cityPath);
             bookMarkDic.Add("CityPath2", cityPath);
 
-            Table contractTable  = (Table)doc.GetChild(NodeType.Table, 1, true);
+            Table contractTable = (Table)doc.GetChild(NodeType.Table, 1, true);
 
             if (contractTable != null)
             {
@@ -2639,7 +2671,7 @@ FROM
 
             jw.Msg = "生成成功!";
             jw.Code = 200;
-            jw.Data = new { Url = AppSettingsHelper.Get("WordBaseUrl") + savePaht.Replace(AppSettingsHelper.Get("WordBasePath"), AppSettingsHelper.Get("WordFtpPath"))};
+            jw.Data = new { Url = AppSettingsHelper.Get("WordBaseUrl") + savePaht.Replace(AppSettingsHelper.Get("WordBasePath"), AppSettingsHelper.Get("WordFtpPath")) };
             return Ok(jw);
         }
 
@@ -3378,29 +3410,29 @@ FROM
                                 var roomTotal = 0.00M;
                                 if (hotelReservations.SingleRoomPrice > 0)
                                 {
-                                    var fee = hotelReservations.SingleRoomPrice * hotelReservations.SingleRoomCount * (int)hotel_days;
-                                    roomFeestr1 += $"<span style='width:70px;display: inline-block;'></span>单间:{hotelReservations.SingleRoomPrice:#0.00} * {hotelReservations.SingleRoomCount}间 * {(int)hotel_days}晚 = {fee:#0.00}<br/>";
+                                    var fee = hotelReservations.SingleRoomPrice * hotelReservations.SingleRoomCount * hotel_days;
+                                    roomFeestr1 += $"<span style='width:70px;display: inline-block;'></span>单间:{hotelReservations.SingleRoomPrice:#0.00} * {hotelReservations.SingleRoomCount}间 * {hotel_days}晚 = {fee:#0.00}<br/>";
                                     //__isSingle = true;
                                     roomTotal += fee;
                                 }
                                 if (hotelReservations.DoubleRoomPrice > 0)
                                 {
-                                    var fee = hotelReservations.DoubleRoomPrice * hotelReservations.DoubleRoomCount * (int)hotel_days;
-                                    roomFeestr1 += $"<span style='width:70px;display: inline-block;'></span>双人间:{hotelReservations.DoubleRoomPrice:#0.00} * {hotelReservations.DoubleRoomCount}间 * {(int)hotel_days}晚 = {fee:#0.00}<br/>";
+                                    var fee = hotelReservations.DoubleRoomPrice * hotelReservations.DoubleRoomCount * hotel_days;
+                                    roomFeestr1 += $"<span style='width:70px;display: inline-block;'></span>双人间:{hotelReservations.DoubleRoomPrice:#0.00} * {hotelReservations.DoubleRoomCount}间 * {hotel_days}晚 = {fee:#0.00}<br/>";
                                     // __isDouble = true;
                                     roomTotal += fee;
                                 }
                                 if (hotelReservations.SuiteRoomPrice > 0)
                                 {
-                                    var fee = hotelReservations.SuiteRoomPrice * hotelReservations.SuiteRoomCount * (int)hotel_days;
-                                    roomFeestr1 += $"<span style='width:70px;display: inline-block;'></span>套房:{hotelReservations.SuiteRoomPrice:#0.00} * {hotelReservations.SuiteRoomCount}间 * {(int)hotel_days}晚 = {fee:#0.00}<br/>";
+                                    var fee = hotelReservations.SuiteRoomPrice * hotelReservations.SuiteRoomCount * hotel_days;
+                                    roomFeestr1 += $"<span style='width:70px;display: inline-block;'></span>套房:{hotelReservations.SuiteRoomPrice:#0.00} * {hotelReservations.SuiteRoomCount}间 * {hotel_days}晚 = {fee:#0.00}<br/>";
                                     //__isSuite = true;
                                     roomTotal += fee;
                                 }
                                 if (hotelReservations.OtherRoomPrice > 0)
                                 {
-                                    var fee = hotelReservations.OtherRoomPrice * hotelReservations.OtherRoomCount * (int)hotel_days;
-                                    roomFeestr1 += $"<span style='width:70px;display: inline-block;'></span>其他:{hotelReservations.OtherRoomPrice:#0.00} * {hotelReservations.OtherRoomCount}间 * {(int)hotel_days}晚 = {fee:#0.00}<br/>";
+                                    var fee = hotelReservations.OtherRoomPrice * hotelReservations.OtherRoomCount * hotel_days;
+                                    roomFeestr1 += $"<span style='width:70px;display: inline-block;'></span>其他:{hotelReservations.OtherRoomPrice:#0.00} * {hotelReservations.OtherRoomCount}间 * {hotel_days}晚 = {fee:#0.00}<br/>";
                                     //__isOther = true;
                                     roomTotal += fee;
                                 }
@@ -4154,7 +4186,7 @@ FROM
                 throw;
             }
         }
-        
+
         /// <summary>
         /// 机票费用录入列表
         /// </summary>
@@ -4179,7 +4211,7 @@ FROM
                 throw;
             }
         }
-        
+
         /// <summary>
         /// 根据id查询费用录入信息
         /// </summary>
@@ -4196,7 +4228,7 @@ FROM
             }
             return Ok(JsonView(true, groupData.Msg, groupData.Data));
         }
-        
+
         /// <summary>
         /// 机票费用录入操作(Status:1.新增,2.修改)
         /// </summary>
@@ -4403,7 +4435,7 @@ FROM
                 throw;
             }
         }
-        
+
         /// <summary>
         /// 导出机票录入报表
         /// </summary>
@@ -6163,12 +6195,12 @@ FROM
         /// </summary>
         /// <returns></returns>
         [HttpGet]
-        public async Task<IActionResult> SharedFileInit(int userid ,int portType)
+        public async Task<IActionResult> SharedFileInit(int userid, int portType)
         {
 
-            var marketingDepartmentIds = new List<int> { 6, 26 , 27 , 28 };
+            var marketingDepartmentIds = new List<int> { 6, 26, 27, 28 };
 
-            var isMarketingDepartment  = _sqlSugar.Queryable<Sys_Users>()
+            var isMarketingDepartment = _sqlSugar.Queryable<Sys_Users>()
                 .Where(x => x.IsDel == 0 && marketingDepartmentIds.Contains(x.DepId))
                 .Select(x => x.Id)
                 .ToList()
@@ -6193,7 +6225,7 @@ FROM
 
                 var dropDownGroupList = _sqlSugar.Queryable<Grp_DelegationInfo>()
                     .Where(x => x.IsDel == 0)
-                    .OrderByDescending(x=> x.VisitDate )
+                    .OrderByDescending(x => x.VisitDate)
                     .Select(x => new
                     {
                         x.TeamName,
@@ -6201,7 +6233,7 @@ FROM
                         x.CityId,
                     })
                     .ToList()
-                    .Select(x=>
+                    .Select(x =>
                     {
                         var provinceId = x.CityId;
                         var isDefualtVal = true;
@@ -6784,7 +6816,7 @@ FROM
             var groupNamFirst = groupNameData.FirstOrDefault();
 
             //SetDataInfoView
-            var dataSource = await _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && x.STid == 66) .ToListAsync();
+            var dataSource = await _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && x.STid == 66).ToListAsync();
 
             var currencyData = dataSource.Where(it => it.STid == 66).ToList(); //所有币种
             List<SetDataInfoView> _CurrencyData = _mapper.Map<List<SetDataInfoView>>(currencyData);
@@ -10511,7 +10543,7 @@ FROM
 
             var dataSource = await _sqlSugar
                 .Queryable<Sys_SetData>()
-                .Where(x => x.IsDel == 0 && (x.STid == 72 || x.STid == 73) && x.Remark.Contains(provinceId.ToString())) 
+                .Where(x => x.IsDel == 0 && (x.STid == 72 || x.STid == 73) && x.Remark.Contains(provinceId.ToString()))
                 .ToListAsync();
 
             var fileTypes = new List<EecSetDataInfoView>();
@@ -11242,7 +11274,7 @@ FROM
             if (id <= 0) //add 
             {
                 //int provinceId = dto.ProvinceId;
-                  int  groupId = dto.DiId;
+                int groupId = dto.DiId;
 
                 //if (provinceId < 1) provinceId = 122;
                 var info = new Grp_EnterExitCost() { DiId = groupId, CurrencyRemark = currencyStr, CreateUserId = dto.CurrUserId };
@@ -11415,7 +11447,7 @@ FROM
         public async Task<IActionResult> EnterExitCostMobileOpSingleCheckbox(EnterExitCostMobileOpSingleCheckboxDto dto)
         {
             int itemTypeId = dto.ItemType, id = dto.Id, currUserId = dto.CurrUserId, diId = dto.DiId, isSelected = dto.IsSelected;
-           // if (provinceId < 1) provinceId = 122;
+            // if (provinceId < 1) provinceId = 122;
             var itemTypes = new List<int>() { 3, 4, 5, 6, 7 };
 
             if (!_portTypeData.Contains(dto.PortType)) return Ok(JsonView(false, MsgTips.Port));
@@ -13766,7 +13798,7 @@ FROM
                     else
                     {
                         var rates = await GeneralMethod.EnterExitCostInitRate();
-                        rates.Insert(0,new CurrencyInfo() { CurrencyCode = "CNY", CurrencyName = "人民币", Rate = 1.00000M });
+                        rates.Insert(0, new CurrencyInfo() { CurrencyCode = "CNY", CurrencyName = "人民币", Rate = 1.00000M });
                         result.Rates = rates.ToArray();
                     }
                 }
@@ -13897,7 +13929,7 @@ FROM
 
             #region 住宿费 
             designer.SetDataSource("AccomTitle", accomCosts?.ItemWrapName ?? "住宿费\r\n(请备注明酒店星级)");
-            if (accomCosts!=null && accomCosts.Infos.Any())
+            if (accomCosts != null && accomCosts.Infos.Any())
             {
                 string currencyName = string.Empty,
                        countryName = string.Empty;
@@ -13990,7 +14022,7 @@ FROM
 
             #region 车辆安排 
             designer.SetDataSource("VehArrangeTitle", vehArranges?.ItemWrapName ?? "车辆安排\r\n(司兼导分开的情况下,车辆品牌、座位及费用)");
-            if (vehArranges!=null&&vehArranges.Infos.Any())
+            if (vehArranges != null && vehArranges.Infos.Any())
             {
                 string currencyName = string.Empty;
                 //decimal rate = 1.0000M;
@@ -14015,7 +14047,7 @@ FROM
             #region 邀请函费
             designer.SetDataSource("InviteCostTitle", inviteCosts?.ItemWrapName ?? "邀请函费用");
             StringBuilder is_label = new StringBuilder();
-            if (inviteCosts != null&&inviteCosts.Infos.Any())
+            if (inviteCosts != null && inviteCosts.Infos.Any())
             {
                 string currencyName = string.Empty;
                 decimal rate = 1.0000M;
@@ -14031,7 +14063,7 @@ FROM
                 if (is_label.HasValue())
                 {
                     //以上小计:28500元(美金汇率:7.5)
-                    string label = string.Format("以上小计:{0}{1}({2}汇率:{3})", inviteCosts.TotalAmt.TruncDecimals(2),"元", currencyName, rate.TruncDecimals(4));
+                    string label = string.Format("以上小计:{0}{1}({2}汇率:{3})", inviteCosts.TotalAmt.TruncDecimals(2), "元", currencyName, rate.TruncDecimals(4));
                     is_label.AppendLine(label);
                 }
             }
@@ -14076,7 +14108,7 @@ FROM
             designer.SetDataSource("VisaInsTitle", visaIns?.ItemWrapName ?? "签证+保险\r\n(单位:元)");
 
             StringBuilder vi_label = new StringBuilder();
-            if (visaIns  != null &&  visaIns.Infos.Any())
+            if (visaIns != null && visaIns.Infos.Any())
             {
                 foreach (var item in visaIns.Infos)
                 {
@@ -14198,7 +14230,7 @@ FROM
             return Ok(JsonView(true, groupData.Msg, groupData.Data));
 
         }
-        
+
         /// <summary>
         /// 根据签证费用Id查询单条数据及c表数据
         /// </summary>
@@ -14215,7 +14247,7 @@ FROM
             }
             return Ok(JsonView(true, groupData.Msg, groupData.Data));
         }
-        
+
         /// <summary>
         /// 签证费用删除
         /// </summary>
@@ -14253,7 +14285,7 @@ FROM
             return Ok(JsonView(true, "删除成功!"));
 
         }
-        
+
         /// <summary>
         /// 签证费用录入下拉框初始化
         /// </summary>
@@ -16058,7 +16090,7 @@ FROM
                     x.Id,
                 }).ToList(),
                 baoPi = _GroupCostParameterRepository.GetBaoPi(diid),
-                blackCodeIsTrue = _sqlSugar.Queryable<Air_TicketBlackCode>().Where(x=>x.IsDel == 0 && x.DiId == diid).Any() , //create.Code == 0 ? true : false,
+                blackCodeIsTrue = _sqlSugar.Queryable<Air_TicketBlackCode>().Where(x => x.IsDel == 0 && x.DiId == diid).Any(), //create.Code == 0 ? true : false,
                 hotelIsTrue = hotelIsTrue,
             }));
         }
@@ -16143,7 +16175,7 @@ FROM
         {
             if (dto.Diid <= 0 || dto.Userid <= 0 || dto.ToGroupId <= 0)
             {
-                return Ok(JsonView(false,"参数有误!"));
+                return Ok(JsonView(false, "参数有误!"));
             }
 
             #region 复制团组成本
@@ -18112,10 +18144,10 @@ FROM
         [HttpPost]
         public IActionResult CraeteGroupCostTravel(GroupCostInItDto dto)
         {
-            var jw = JsonView(false,"Error");
+            var jw = JsonView(false, "Error");
             var Create = _sqlSugar.Queryable<Air_TicketBlackCode>()
                                    .Where(x => x.IsDel == 0 && x.DiId == dto.Diid)
-                                   .Select(x=> new
+                                   .Select(x => new
                                    {
                                        x.Id,
                                        x.Title
@@ -18528,9 +18560,9 @@ ORDER by  gctggrc.id DESC
                 airHotelPriceList.Add(new
                      AirHotelPrice
                 {
-                     Name = "经济舱TBR",
-                     Price = rightSum + air + hotel,
-                     Count = result["经济舱TBR"] * 2
+                    Name = "经济舱TBR",
+                    Price = rightSum + air + hotel,
+                    Count = result["经济舱TBR"] * 2
                 });
                 allPrice += (rightSum + air + hotel) * result["经济舱TBR"] * 2;
             }
@@ -18652,7 +18684,7 @@ AirHotelPrice
             foreach (var item in airSouer.Keys)
             {
                 var find = airHotelPriceList.FirstOrDefault(x => x.Name == item);
-                if (find !=  null && find.Count > 0)
+                if (find != null && find.Count > 0)
                 {
                     if (item.Contains("TBR"))
                     {
@@ -18722,7 +18754,7 @@ AirHotelPrice
             }
 
             var costTypeHotelNumbers = await _sqlSugar.Queryable<Grp_CostTypeHotelNumber>()
-                                                        .FirstAsync(x=>x.Type == "Default" && x.Diid == dto.Diid && x.IsDel == 0);
+                                                        .FirstAsync(x => x.Type == "Default" && x.Diid == dto.Diid && x.IsDel == 0);
             if (costTypeHotelNumbers == null)
             {
                 return Ok(JsonView(false, "团组成本不存在!"));
@@ -18807,7 +18839,7 @@ AirHotelPrice
             {
                 { "经济舱", new[] { "TBR", "SGR", "JSES", "SUITE" } },
                 { "公务舱", new[] { "SUITE", "JSES", "SGR" } },
-                { "头等舱", new[] { "SUITE", "JSES" } } 
+                { "头等舱", new[] { "SUITE", "JSES" } }
             };
 
             var result = new Dictionary<string, int>();
@@ -18817,7 +18849,7 @@ AirHotelPrice
                 // 获取当前舱位的匹配规则
                 if (flightRoomMatchingRules.TryGetValue(flight, out string[] roomTypes))
                 {
-                    MatchRooms(ref hotelRooms,ref flights, roomTypes, flight,ref result);
+                    MatchRooms(ref hotelRooms, ref flights, roomTypes, flight, ref result);
                 }
             }
 
@@ -18971,8 +19003,8 @@ AirHotelPrice
 
             #endregion
 
-            designer.SetDataSource("AllPrice","总金额:" + allPrice.ToString("#0.00"));
-            string savePaht = AppSettingsHelper.Get("ExcelBasePath") + "GroupCostQuotations/" + di.TeamName +"_详细报批费用.xls";
+            designer.SetDataSource("AllPrice", "总金额:" + allPrice.ToString("#0.00"));
+            string savePaht = AppSettingsHelper.Get("ExcelBasePath") + "GroupCostQuotations/" + di.TeamName + "_详细报批费用.xls";
             var ws = designer.Workbook.Worksheets[0];
             foreach (var Rowindex in hideRowsList)
             {
@@ -18988,7 +19020,7 @@ AirHotelPrice
 
         }
 
-        private void MatchRooms(ref Dictionary<string, int> hotelRooms,ref Dictionary<string, int> flights, string[] roomTypes, string flightType,ref Dictionary<string, int> result)
+        private void MatchRooms(ref Dictionary<string, int> hotelRooms, ref Dictionary<string, int> flights, string[] roomTypes, string flightType, ref Dictionary<string, int> result)
         {
             foreach (var roomType in roomTypes)
             {
@@ -20032,7 +20064,7 @@ AirHotelPrice
                     builder.Writeln(@$"VOUCHER No:{item.CheckNumber}   DATE: {item.CreateTime.ToString("yyyy-MM-dd")}");
 
 
-                     builder.StartTable();
+                    builder.StartTable();
 
                     // 设置边框颜色
                     builder.CellFormat.Borders.Top.Color = System.Drawing.Color.Black;
@@ -22230,7 +22262,7 @@ AirHotelPrice
                 string clients = kimiApiResult_JObject["content"].ToString();
 
                 string startStr = "```json", endStr = "```";
-                
+
                 // 判断并清除开头部分
                 if (clients.StartsWith(startStr))
                 {
@@ -22269,7 +22301,7 @@ AirHotelPrice
                     company = dc.CompanyFullName;
                     job = dc.Job;
 
-                    if (dc1 != null && !string.IsNullOrEmpty(dc1.CompanyFullName)  )
+                    if (dc1 != null && !string.IsNullOrEmpty(dc1.CompanyFullName))
                     {
                         //查询对照表
                         Res_CompanyEnglishComparison tempCec = listCEC.FirstOrDefault(s => s.zhName.Contains(dc1.CompanyFullName.ToString().Trim()));
@@ -23921,7 +23953,8 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
                     item.Title = "未设置名称数据" + count;
                 }
                 count++;
-            };
+            }
+            ;
 
             if (group == null)
             {

+ 43 - 31
OASystem/OASystem.Api/Controllers/PersonnelModuleController.cs

@@ -2394,9 +2394,9 @@ WHERE
 
             //TODO:出库成功 并且是团组相关物资 向团组其他款项添加信息
             #region 出库成功并且是团组相关物资 向团组其他款项添加信息
-
+            receiveInfo = await _sqlSugar.Queryable<Pm_GoodsReceive>().FirstAsync(x => x.IsDel == 0 && x.Id == receiveId);
             var auditEnums = new List<GoodsAuditEnum>() { GoodsAuditEnum.OutConfirmed, GoodsAuditEnum.OutRejected };
-            if (!auditEnums.Contains(receiveInfo.AuditStatus)) return Ok(view);
+            //if (!auditEnums.Contains(receiveInfo.AuditStatus)) return Ok(view);
 
             var groupInfo = await _sqlSugar.Queryable<Grp_DelegationInfo>().FirstAsync(x => x.IsDel == 0 && x.Id == receiveInfo.GroupId);
             if (groupInfo == null) return Ok(view);
@@ -2412,7 +2412,7 @@ WHERE
             var goodsInfos = await _sqlSugar.Queryable<Pm_GoodsInfo>()
                 .Where(x => x.IsDel == 0 && goodsIds.Contains(x.Id))
                 .ToListAsync();
-            if (goodsInfos.Any()) return Ok(view);
+            if (!goodsInfos.Any()) return Ok(view);
 
             string priceName = string.Join("、", goodsInfos.Select(x => x.Name).ToList());
             //物品价格 按照物品批次单价计算
@@ -2422,13 +2422,25 @@ WHERE
             var goodsStorages = await _sqlSugar.Queryable<Pm_GoodsStorage>().Where(x => x.IsDel == 0 && goodsIds.Contains(x.GoodsId)).ToListAsync();
             foreach (var item in receiveDetails)
             {
+                List<GoodsReceiveLinkStorageView> storageFlows = new();
+                if (!string.IsNullOrEmpty(item.GoodsStorageInfo))
+                {
+                    storageFlows = JsonConvert.DeserializeObject<List<GoodsReceiveLinkStorageView>>(item.GoodsStorageInfo);
+                }
 
-
-
+                if (storageFlows.Any())
+                {
+                    storageFlows.ForEach(storage =>
+                    {
+                        price += goodsStorages.FirstOrDefault(x => x.Id == storage.StorageId)?.UnitPrice ?? 0m * storage.Quantity;
+                    });
+                }
             }
 
+            decimal quantity = 1m;
+            var total = price * quantity;
 
-            var total = 0.00M;
+            string remark = $"物资领用模块添加!需核对领用物品价格!!!";
 
             var requestData = new DecreasePaymentsOpDto()
             {
@@ -2436,7 +2448,7 @@ WHERE
                 DiId = groupInfo.Id,
                 PriceName = priceName,
                 Price = price,
-                Quantity = receiveInfo.Quantity,
+                Quantity = quantity,
                 FeeTotal = total,
                 Currency = 836,
                 FilePath = "",
@@ -2455,45 +2467,45 @@ WHERE
                 SupplierSocialAccount = "-",
                 SupplierTypeId = 0,
                 CreateUserId = currUserInfo.UserId,
-                Remark = $"物资领用模块添加"
+                Remark = remark
             };
 
             //其他费用
 
             #region 调用方法
-            //JsonView groupData = await _otherPaymentRep.OpDecreasePayments(requestData);
-            //if (groupData.Code != 200)
-            //{
-            //    view.Msg += groupData.Msg;
-            //    return Ok(view);
-            //}
+            JsonView groupData = await _otherPaymentRep.OpDecreasePayments(requestData);
+            if (groupData.Code != 200)
+            {
+                view.Msg += groupData.Msg;
+                return Ok(view);
+            }
 
             #region 应用推送
 
-            //int diId = requestData.DiId, status = requestData.Status;
+            int diId = requestData.DiId, status = requestData.Status;
 
-            //int otherId = Convert.ToInt32(groupData.Data.GetType().GetProperty("dataId").GetValue(groupData.Data, null) ?? 0);
-            //int ccpId = Convert.ToInt32(groupData.Data.GetType().GetProperty("ccpId").GetValue(groupData.Data, null) ?? 0);
-            //int sign = Convert.ToInt32(groupData.Data.GetType().GetProperty("sign").GetValue(groupData.Data, null) ?? 0);
+            int otherId = Convert.ToInt32(groupData.Data.GetType().GetProperty("dataId").GetValue(groupData.Data, null) ?? 0);
+            int ccpId = Convert.ToInt32(groupData.Data.GetType().GetProperty("ccpId").GetValue(groupData.Data, null) ?? 0);
+            int sign = Convert.ToInt32(groupData.Data.GetType().GetProperty("sign").GetValue(groupData.Data, null) ?? 0);
 
-            ////自动审核
-            //var autoAdit = await _feeAuditRep.FeeAutomaticAudit(3, diId, otherId);
+            //自动审核
+            var autoAdit = await _feeAuditRep.FeeAutomaticAudit(3, diId, otherId);
 
-            //await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
+            await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
 
-            ////2024-10-21 新增LZ UID
-            //var userIds = new List<int>() { 208 };
-            ////var userIds = new List<int>() { 21 };
-            //string title = $"系统通知";
-            //string content = "";
+            //2024-10-21 新增LZ UID
+            var userIds = new List<int>() { 208 };
+            //var userIds = new List<int>() { 21 };
+            string title = $"系统通知";
+            string content = "";
 
-            //var ccpInfo = await _sqlSugar.Queryable<Grp_CreditCardPayment>().Where(x => x.Id == ccpId).FirstAsync();
-            //if (status == 1) content = $"[新增-其他款项({groupInfo?.TeamName ?? "-"})]一项费用:{(ccpInfo.PayMoney * ccpInfo.DayRate).ToString("#0.00")} CNY;";
-            //else if (status == 2) content = $"[更新-其他款项({groupInfo?.TeamName ?? "-"})]一项费用:{(ccpInfo.PayMoney * ccpInfo.DayRate).ToString("#0.00")} CNY;";
+            var ccpInfo = await _sqlSugar.Queryable<Grp_CreditCardPayment>().Where(x => x.Id == ccpId).FirstAsync();
+            if (status == 1) content = $"[新增-其他款项({groupInfo?.TeamName ?? "-"})]一项费用:{(ccpInfo.PayMoney * ccpInfo.DayRate).ToString("#0.00")} CNY;";
+            else if (status == 2) content = $"[更新-其他款项({groupInfo?.TeamName ?? "-"})]一项费用:{(ccpInfo.PayMoney * ccpInfo.DayRate).ToString("#0.00")} CNY;";
 
-            //await GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.GroupBusinessOperations, title, content, userIds, diId);
+            await GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.GroupBusinessOperations, title, content, userIds, diId);
 
-            ////await APNsTools.iOS_PushNotifications1("051", $"其他款项费用审核", "", content);
+            //await APNsTools.iOS_PushNotifications1("051", $"其他款项费用审核", "", content);
 
             #endregion
             #endregion

+ 1 - 0
OASystem/OASystem.Domain/ViewModels/Groups/OrderPreInfoView.cs

@@ -65,6 +65,7 @@ namespace OASystem.Domain.ViewModels.Groups
 
     public class GrpOrderPreInfoMobileView : GrpOrderPreInfoBasicView
     {
+        public string GroupName { get; set; } = "";
         public GrpOrderPreItemMobileView[] Items { get; set; }
     }
 

+ 8 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/GroupOrderPreInfoRepository.cs

@@ -213,6 +213,14 @@ namespace OASystem.Infrastructure.Repositories.Groups
             view.Id = id;
             view.Name = info.Name;
             view.GroupId = info.GroupId;
+            if (info.GroupId > 0)
+            {
+                var groupInfo = await _sqlSugar.Queryable<Grp_DelegationInfo>().FirstAsync(x => x.IsDel == 0 && x.Id == info.GroupId);
+                if (groupInfo != null)
+                {
+                    view.GroupId = groupInfo.Id;
+                }
+            }
             var items = await _sqlSugar.Queryable<Sys_FormTemp, Grp_OrderPreItem, Sys_SetData, Sys_SetData>((ft, opi, sd1, sd2) =>
                 new JoinQueryInfos(
                     JoinType.Inner, ft.Id == opi.FormTempId,

+ 1 - 1
OASystem/OASystem.Infrastructure/Repositories/PersonnelModule/GoodsRepository.cs

@@ -1241,7 +1241,7 @@ namespace OASystem.Infrastructure.Repositories.PersonnelModule
                     Id = gr.Id,
                     GroupId = gr.GroupId,
                     GroupName = di.TeamName,
-                    GoodsId = gr.GoodsId,
+                    GoodsId = grd.GoodsId,
                     GoodsName = gi.Name,
                     GoodsTypeId = gi.Type,
                     GoodsType = sd.Name,