Browse Source

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

jiangjc 10 months ago
parent
commit
82eefa9e8d

+ 130 - 27
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -1707,21 +1707,12 @@ namespace OASystem.API.Controllers
                     //2.已收
                     string sql_pr = string.Format(@" Select * From Fin_ProceedsReceived Where IsDel=0 And Diid={0} ", diId);
                     List<Fin_ProceedsReceived> list_pr = _sqlSugar.SqlQueryable<Fin_ProceedsReceived>(sql_pr).ToList();
-                    List<ProceedsReceivedInfoView> prDatas = new List<ProceedsReceivedInfoView>();
                     foreach (var item_pr in list_pr)
                     {
                         sum_pr += item_pr.Price;
                         str_client += string.Format(@"{0};", item_pr.Client);
                         str_schedule += string.Format(@"{0};", item_pr.Remark);
 
-                        prDatas.Add(new ProceedsReceivedInfoView
-                        {
-                            time = item_pr.SectionTime,
-                            client = item_pr.Client,
-                            money = item_pr.Price.ToString("#0.00"),
-                            currency = setData.Find(it => it.Id == item_pr.Currency)?.Name ?? "",
-                            receivablesType = setData.Find(it => it.Id == item_pr.ReceivablesType)?.Name ?? ""
-                        });
                     }
                     if (str_schedule.Length > 0)
                     {
@@ -1755,7 +1746,6 @@ namespace OASystem.API.Controllers
                     item_rst.balPrice = ((sum_fr + sum_extra) - (sum_pr - sum_refund)).ToString("#0.00");
                     item_rst.prClient = str_client;
                     item_rst.schedule = str_schedule;
-                    item_rst.prItem = prDatas;
 
                     string tempVisitDate = Convert.ToDateTime(item_rst.visitDate).ToString("yyyy-MM-dd");
 
@@ -1763,6 +1753,58 @@ namespace OASystem.API.Controllers
                     sumAll_pr += (sum_pr - sum_refund);
                     sumAll_balance += ((sum_fr + sum_extra) - (sum_pr - sum_refund));
 
+                    #region 单位应收已收细项(以应收费用名称为主去(已收费用)匹配) 新增 雷怡 2024-35-08 16:35:28
+
+                    List<ClientFeeInfoView> feeDatas = new List<ClientFeeInfoView>();
+
+                    //匹配上的数据
+                    foreach (var item in list_fr)
+                    {
+                        var prInfo = list_pr.Find(it => item.PriceName.Contains(it.Client) || item.PriceName.Equals(it.Client));
+
+                        decimal _balancePayment = 0.00M;
+                        if (item.Currency == prInfo?.Currency)
+                        {
+                            _balancePayment = item.ItemSumPrice - prInfo?.Price ?? 0.00M;
+                        }
+
+                        feeDatas.Add(new ClientFeeInfoView
+                        {
+                            client = item.PriceName,
+                            frMoney = item.ItemSumPrice.ToString("#0.00"),
+                            frCurrency = setData.Find(it => it.Id == item.Currency)?.Name ?? "-",
+                            frRate = item.Rate.ToString("#0.0000"),
+                            prReceivablesType = setData.Find(it => it.Id == prInfo?.ReceivablesType)?.Name ?? "",
+                            prTime = prInfo?.SectionTime ?? "-",
+                            prMoney = prInfo?.Price.ToString("#0.00") ?? "-",
+                            prCurrency = setData.Find(it => it.Id == prInfo?.Currency)?.Name ?? "",
+                            balPayment = _balancePayment.ToString("#0.00")
+                        });
+                    }
+                    //未匹配上的数据
+                    foreach (var item in list_pr)
+                    {
+                        var frInfo = list_fr.Find(it => it.PriceName.Contains(item.Client) || it.PriceName.Equals(item.Client));
+                        if (frInfo == null)
+                        {
+                            feeDatas.Add(new ClientFeeInfoView
+                            {
+                                client = item.Client+ "[未匹配上的已收数据(应收已收公司名称不一致)]",
+                                frMoney = "0.00",
+                                frCurrency =  "-",
+                                frRate ="0.0000",
+                                prReceivablesType = setData.Find(it => it.Id == item?.ReceivablesType)?.Name ?? "",
+                                prTime = item?.SectionTime ?? "-",
+                                prMoney = item?.Price.ToString("#0.00") ?? "0.00",
+                                prCurrency = setData.Find(it => it.Id == item?.Currency)?.Name ?? "",
+                                balPayment = "0.00"
+                            });
+                        }
+                    }
+
+
+                    item_rst.feeItem = feeDatas;
+                    #endregion
                 }
 
                 PostSyntheticalReceivableByDateRangeResultView result = new PostSyntheticalReceivableByDateRangeResultView();
@@ -2002,21 +2044,24 @@ namespace OASystem.API.Controllers
 
             #region 相关基础数据源
             var userDatas = _sqlSugar.Queryable<Sys_Users>().ToList();
-            var setDatas = _sqlSugar.Queryable<Sys_SetData>().ToList();
-
+            var setDatas = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0).ToList();
+            var countryFeeDatas = _sqlSugar.Queryable<Grp_NationalTravelFee>().Where(it => it.IsDel == 0).ToList();
+           
             var hotelDatas = _sqlSugar.Queryable<Grp_HotelReservations>().Where(it => it.IsDel == 0 && groupIds.Contains(it.DiId)).ToList();
             var opDatas = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().Where(it => it.IsDel == 0 && groupIds.Contains(it.DiId)).ToList();
             var visaDatas = _sqlSugar.Queryable<Grp_VisaInfo>().Where(it => it.IsDel == 0 && groupIds.Contains(it.DIId)).ToList();
             var ioaDatas = _sqlSugar.Queryable<Grp_InvitationOfficialActivities>().Where(it => it.IsDel == 0 && groupIds.Contains(it.DiId)).ToList();
             var insureDatas = _sqlSugar.Queryable<Grp_Customers>().Where(it => it.IsDel == 0 && groupIds.Contains(it.DiId)).ToList();
             var airDatas = _sqlSugar.Queryable<Grp_AirTicketReservations>().Where(it => it.IsDel == 0 && groupIds.Contains(it.DIId)).ToList();
-            var otherMoneyDatas = _sqlSugar.Queryable<Fin_OtherPrice>().Where(it => it.IsDel == 0 && groupIds.Contains(it.Diid)).ToList();
+            //var otherMoneyDatas = _sqlSugar.Queryable<Fin_OtherPrice>().Where(it => it.IsDel == 0 && groupIds.Contains(it.Diid)).ToList();
+            var otherMoneyDatas = _sqlSugar.Queryable<Grp_DecreasePayments>().Where(it => it.IsDel == 0 && groupIds.Contains(it.DiId)).ToList();
             var refundPaymentDatas = _sqlSugar.Queryable<Fin_PaymentRefundAndOtherMoney>().Where(it => it.IsDel == 0 && groupIds.Contains(it.DiId)).ToList();
             var ExtraCostDatas = _sqlSugar.Queryable<Fin_GroupExtraCost>().Where(it => it.IsDel == 0 && groupIds.Contains(it.DiId)).ToList();
             #endregion
             //Expense company
             foreach (var groupInfo in _groupDatas)
             {
+
                 List<Group_DailyFeePaymentContentInfolView> childList = new List<Group_DailyFeePaymentContentInfolView>();
 
                 var groupPaymentDatas = _paymentDatas.Where(it => groupInfo.Id == it.DIId).ToList();
@@ -2029,30 +2074,79 @@ namespace OASystem.API.Controllers
                     switch (payInfo.CTable)
                     {
                         case 76:  //76	酒店预订
-                            priName = hotelDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.HotelName ?? "";
+                            priName = $"[费用名称:{hotelDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.HotelName ?? ""}]";
                             break;
                         case 79:  //79	车/导游地接
                             var opData = opDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id);
                             if (opData != null)
                             {
+                                string area = "";
+                                bool b = int.TryParse(opData.Area, out int areaId);
+                                if (b)
+                                {
+                                    string area1 = countryFeeDatas.Find(it => it.Id == areaId)?.Country ?? "-";
+                                    area = $"{area1}({setDatas.Find(it => it.Id == opData.PriceType)?.Name ?? "-"})";
+                                }
+                                else area = opData.Area;
+
+                                string opPriName = "-";
+                                if (!string.IsNullOrEmpty(opData.PriceName)) opPriName = opData.PriceName;
+
+                                area += $"({opPriName})";
+
                                 if (payInfo.OrbitalPrivateTransfer == 0) //公转
                                 {
-                                    priName = $"【{orbitalPrivateTransfer}】【导游: {opData.ServiceGuide} 】{opData.Area}";
+                                    priName = $"【{orbitalPrivateTransfer}】【导游: {opData.ServiceGuide} 】[费用名称:{area}]";
                                 }
                                 else if (payInfo.OrbitalPrivateTransfer == 1) //私转
                                 {
-                                    priName = $"【{orbitalPrivateTransfer}】【导游:{opData.ServiceGuide}】{opData.Area}";
+                                    priName = $"【{orbitalPrivateTransfer}】【导游:{opData.ServiceGuide}】[费用名称:{area}]";
                                 }
                             }
                             break;
                         case 80:  // 80   签证
-                            priName = visaDatas.Find(it => payInfo.DIId == it.DIId && payInfo.CId == it.Id)?.VisaClient ?? "-";
+
+                            string sql = string.Format("select b.Id,b.Pinyin,b.lastName,b.firstName,b.phone from  Grp_TourClientList a, Crm_DeleClient b where a.clientid = b.id and a.isdel = 0 and a.diid = {0}", groupInfo.Id);
+                            List<SimplClientInfo> arr = _sqlSugar.SqlQueryable<SimplClientInfo>(sql).ToList();
+
+                            string visaClientName = visaDatas.Find(it => payInfo.DIId == it.DIId && payInfo.CId == it.Id)?.VisaClient ?? "";
+                            string clientName = "-";
+                            if (Regex.Match(visaClientName, @"\d+,?").Value.Length > 0)
+                            {
+                                string[] temparr = visaClientName.Split(',');
+                                string fistrStr = temparr[0];
+                                int count = temparr.Count();
+
+                                int tempId;
+                                bool success = int.TryParse(fistrStr, out tempId);
+                                if (success)
+                                {
+                                    SimplClientInfo tempInfo = arr.FirstOrDefault(s => s.Id == tempId);
+                                    if (tempInfo != null)
+                                    {
+                                        if (count > 1)
+                                        {
+                                            clientName = string.Format(@"{0}{1}等{2}人", tempInfo.LastName, tempInfo.FirstName, count);
+                                        }
+                                        else
+                                        {
+                                            clientName = string.Format(@"{0}{1}", tempInfo.LastName, tempInfo.FirstName);
+                                        }
+                                    }
+                                }
+                                else
+                                {
+                                    clientName = fistrStr;
+                                }
+                            }
+
+                            priName = $"[费用名称:{clientName}]";
                             break;
                         case 81:  // 81	邀请/公务活动
-                            priName = ioaDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.Inviter ?? "-";
+                            priName = $"[费用名称:{ioaDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.Inviter ?? " -"}]";
                             break;
                         case 82:  // 82	团组客户保险
-                            priName = insureDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.ClientName ?? "-";
+                            priName = $"[费用名称:{insureDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.ClientName ?? " -"}]";
                             break;
                         case 85:  // 85	机票预订
                             string flightsCode = airDatas.Find(it => payInfo.DIId == it.DIId && payInfo.CId == it.Id)?.FlightsCode ?? "-";
@@ -2060,19 +2154,20 @@ namespace OASystem.API.Controllers
                             priName = $"{flightsCode}【{airPayType}】";
                             break;
                         case 98:  //  98	其他款项
-                            priName = otherMoneyDatas.Find(it => payInfo.DIId == it.Diid && payInfo.CId == it.Id)?.PriceName ?? "-";
+                            priName = $"[费用名称:{otherMoneyDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.PriceName ?? " -"}]";
                             break;
                         case 285:  //  285 收款退还
-                            priName = refundPaymentDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.PriceName ?? "-";
+                            priName = $"[费用名称:{refundPaymentDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.PriceName ?? " -"}]";
                             break;
                         case 1015:  //  1015	超支费用
-                            priName = ExtraCostDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.PriceName ?? "-";
+                            priName = $"[费用名称:{ExtraCostDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.PriceName ?? " -"}]";
                             break;
                         default:
                             priName = "";
                             break;
                     }
 
+                    //
                     bool status1 = false;
                     if (_groupIds != null)
                     {
@@ -2083,6 +2178,10 @@ namespace OASystem.API.Controllers
                         string.IsNullOrEmpty(payInfo.OtherBankName) ? "-" : payInfo.OtherBankName,
                         string.IsNullOrEmpty(payInfo.OtherSideNo) ? "-" : payInfo.OtherSideNo);
 
+
+                    decimal _PaymentAmount = (payInfo.PayMoney / 100) * payInfo.PayPercentage;//此次付款金额
+                    decimal _CNYSubTotalAmount = _PaymentAmount * payInfo.DayRate;//此次付款金额
+                    _CNYSubTotalAmount = Convert.ToDecimal(_CNYSubTotalAmount.ToString("#0.00"));
                     var childInfo = new Group_DailyFeePaymentContentInfolView()
                     {
                         IsChecked = status1,
@@ -2096,12 +2195,14 @@ namespace OASystem.API.Controllers
                         PriceName = priName,
                         ModuleName = setDatas.Find(it => it.Id == payInfo.CTable)?.Name ?? "",
                         PayCurrCode = setDatas.Find(it => it.Id == payInfo.PaymentCurrency)?.Name ?? "",
-                        PaymentAmount = payInfo.PayMoney,
+                        PaymentAmount = _PaymentAmount,
                         PayRate = payInfo.DayRate,
-                        CNYSubTotalAmount = ((payInfo.DayRate * payInfo.PayMoney) / 100) * payInfo.PayPercentage //此次付款金额
+                        CNYSubTotalAmount = _CNYSubTotalAmount
                     };
 
-                    string remaksDescription = $"【{childInfo.PayType}】【{childInfo.ModuleName}】{rouNumber}、[申请人:{childInfo.Applicant}][收款方:{childInfo.Payee}]{priName},{payInfo.OtherBankName},{payInfo.OtherSideNo}[{payInfo.ConsumptionPatterns}] {childInfo.PayCurrCode} {payInfo.PayMoney.ToString("#0.00")}、CNY:{childInfo.CNYSubTotalAmount.ToString("#0.00")}";
+                    //string remaksDescription = $"【{childInfo.PayType}】【{childInfo.ModuleName}】{rouNumber}、[申请人:{childInfo.Applicant}][收款方:{childInfo.Payee}]{priName},{payInfo.OtherBankName},{payInfo.OtherSideNo}[{payInfo.ConsumptionPatterns}] {childInfo.PayCurrCode} {payInfo.PayMoney.ToString("#0.00")}、CNY:{childInfo.CNYSubTotalAmount.ToString("#0.00")}(团组:{groupInfo.TeamName})";
+
+                    string remaksDescription = $"【{childInfo.PayType}】【{childInfo.ModuleName}】{rouNumber}、[申请人:{childInfo.Applicant}]{priName}[收款方:{childInfo.Payee}] {childInfo.PayCurrCode} {_PaymentAmount.ToString("#0.00")}、CNY:{childInfo.CNYSubTotalAmount.ToString("#0.00")}(团组:{groupInfo.TeamName})";
 
                     childInfo.RemaksDescription = remaksDescription;
                     childList.Add(childInfo);
@@ -2611,8 +2712,10 @@ namespace OASystem.API.Controllers
                         //groupGZSubStr += $"\t";
                     }
 
-                    if (!string.IsNullOrEmpty(groupGZSubStr)) groupGZStr += $"团组:{item.GroupName}\r\n{groupGZSubStr}\r\n";
-                    if (!string.IsNullOrEmpty(groupSZSubStr)) groupSZStr += $"团组:{item.GroupName}\r\n{groupSZSubStr}\r\n";
+                    //if (!string.IsNullOrEmpty(groupGZSubStr)) groupGZStr += $"团组:{item.GroupName}\r\n{groupGZSubStr}\r\n";
+                    //if (!string.IsNullOrEmpty(groupSZSubStr)) groupSZStr += $"团组:{item.GroupName}\r\n{groupSZSubStr}\r\n";
+                    if (!string.IsNullOrEmpty(groupGZSubStr)) groupGZStr += $"{groupGZSubStr}\r\n";
+                    if (!string.IsNullOrEmpty(groupSZSubStr)) groupSZStr += $"{groupSZSubStr}\r\n";
 
                 }
 

+ 1 - 3
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -3740,7 +3740,6 @@ namespace OASystem.API.Controllers
         {
             try
             {
-
                 var data = await _enterExitCostRep.GetEnterExitCostInfoByDiId(dto);
 
                 if (data.Code != 0)
@@ -5798,7 +5797,7 @@ namespace OASystem.API.Controllers
                 city = "未录入黑屏代码";
             }
 
-            var OpTravelList = _sqlSugar.Queryable<Grp_TravelList>().Where(x => x.Diid == diid && x.IsDel == 0).OrderBy(x => x.Date).Select(x => new TravelArrView
+            var OpTravelList = _sqlSugar.Queryable<Grp_TravelList>().Where(x => x.Diid == diid && x.IsDel == 0).OrderBy(x => x.Days).Select(x => new TravelArrView
             {
                 Date = x.Date,
                 Days = x.Days,
@@ -11301,7 +11300,6 @@ namespace OASystem.API.Controllers
                 builder.MoveToBookmark(key);
                 builder.Write(dic[key]);
             }
-
             #endregion
 
             var fileDir = AppSettingsHelper.Get("WordBasePath");

+ 149 - 68
OASystem/OASystem.Api/Controllers/ResourceController.cs

@@ -1,7 +1,9 @@
-using NPOI.HPSF;
+using Aspose.Words;
+using NPOI.HPSF;
 using OASystem.API.OAMethodLib;
 using OASystem.Domain.Dtos.Resource;
 using OASystem.Domain.Entities.Groups;
+using OASystem.Domain.ViewModels.Groups;
 using OASystem.Infrastructure.Repositories.Groups;
 using Org.BouncyCastle.Utilities;
 using Quartz.Util;
@@ -35,12 +37,14 @@ namespace OASystem.API.Controllers
         private readonly OfficialActivitiesRepository _officialActivitiesRep;
         private readonly AskDataRepository _askDataRep;
         private readonly TicketBlackCodeRepository _ticketBlackCodeRep;
+        private readonly TourClientListRepository _tourClientListRep;
+        private readonly DelegationInfoRepository _delegationInfoRep;
 
-        public ResourceController(IMapper mapper, IConfiguration config, SqlSugarClient sqlSugar, CarDataRepository carDataRep,LocalGuideDataRepository localGuideDataRep, 
-            ThreeCodeRepository threeCodeRep,HotelDataRepository hotelDataRep, ResItemInfoRepository resItemInfoRep, SetDataRepository setDataRepository,
+        public ResourceController(IMapper mapper, IConfiguration config, SqlSugarClient sqlSugar, CarDataRepository carDataRep, LocalGuideDataRepository localGuideDataRep,
+            ThreeCodeRepository threeCodeRep, HotelDataRepository hotelDataRep, ResItemInfoRepository resItemInfoRep, SetDataRepository setDataRepository,
             CountryFeeRepository countryFeeRep, SetDataTypeRepository setDataTypeRep, AirTicketAgentRepository airTicketAgentRep,
-            InvitationOfficialActivityDataRepository invitationOfficialActivityDataRep, OfficialActivitiesRepository officialActivitiesRep, AskDataRepository askDataRep, 
-            TicketBlackCodeRepository ticketBlackCodeRep)
+            InvitationOfficialActivityDataRepository invitationOfficialActivityDataRep, OfficialActivitiesRepository officialActivitiesRep, AskDataRepository askDataRep,
+            TicketBlackCodeRepository ticketBlackCodeRep, TourClientListRepository tourClientListRep, DelegationInfoRepository delegationInfoRep)
         {
             _mapper = mapper;
             _config = config;
@@ -57,7 +61,9 @@ namespace OASystem.API.Controllers
             _InvitationOfficialActivityDataRep = invitationOfficialActivityDataRep;
             _officialActivitiesRep = officialActivitiesRep;
             _askDataRep = askDataRep;
-            _ticketBlackCodeRep=ticketBlackCodeRep;
+            _ticketBlackCodeRep = ticketBlackCodeRep;
+            _tourClientListRep = tourClientListRep;
+            _delegationInfoRep = delegationInfoRep;
         }
 
 
@@ -1548,10 +1554,16 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> GetGroupAllList(OfficialActivitiesByDiIdDto dto)
         {
-            List<Grp_DelegationInfo> _DelegationInfos = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(a => a.IsDel == 0).OrderBy(a => a.CreateTime, OrderByType.Desc).ToList();
-            List<Sys_SetData> data = await _sqlSugar.Queryable<Sys_SetData>().Where(a => a.IsDel == 0 && a.STid == 38).ToListAsync();
+            //string groupSql = string.Format("Select * From Grp_DelegationInfo With(NoLock) Where IsDel = 0 Order By CreateTime Desc");
+            //List<Grp_DelegationInfo> _DelegationInfos = _sqlSugar.SqlQueryable< Grp_DelegationInfo >(groupSql).ToList();
+
+            var _groupData = await _delegationInfoRep.PostShareGroupInfos(1);
+            dynamic groupInfos = null;
+            if (_groupData.Code == 0) groupInfos = _groupData.Data;
+
+            List<Sys_SetData> data = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.IsDel == 0 && a.STid == 38).ToList();
             List<Grp_DeleFile> _DeleFile = _sqlSugar.Queryable<Grp_DeleFile>().Where(a => a.Diid == dto.DiId && a.IsDel == 0 && a.Category == 970).ToList();
-            return Ok(JsonView(true, "查询成功!", new { Delegation = _DelegationInfos, SetData = data, DeleFile = _DeleFile }));
+            return Ok(JsonView(true, "查询成功!", new { Delegation = groupInfos, SetData = data, DeleFile = _DeleFile }));
         }
         [HttpPost]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
@@ -1736,6 +1748,134 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
                 throw;
             }
         }
+
+
+        /// <summary>
+        /// 公务出访 (省外办,市外办) File Downlaod
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> OfficialActivitiesFileDownload(AskFileDownloadDto dto)
+        {
+            #region 参数验证
+
+            if (dto.FileType < 1 || dto.FileType > 2) return Ok(JsonView(false, "请传入有效的FileType参数. 1 省外办出访请示 2 市外办出访请示"));
+            if (dto.DiId < 1) return Ok(JsonView(false, "请传入有效的DiId参数."));
+
+            #endregion
+            //团组基础信息
+            var groupInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0 && it.Id == dto.DiId).First();
+            if (groupInfo == null) return Ok(JsonView(false, "该团组基本信息不存在"));
+
+            //团组公务信息
+            var obDatas = _sqlSugar.Queryable<Res_OfficialActivities>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).ToList();
+            if (obDatas.Count < 1) return Ok(JsonView(false, "请先录入公务信息!"));
+
+            //请示数据库范例数据
+
+            //团组客户名单
+            var guestResult = _tourClientListRep._ItemByDiId(1, dto.DiId);
+            List<TourClientListByDiIdView> guestInfos = new List<TourClientListByDiIdView>();
+            if (guestResult.Result.Code == 0) guestInfos = guestResult.Result.Data as List<TourClientListByDiIdView>;
+
+            //载入模板
+            string tempPath = AppSettingsHelper.Get("WordBasePath") + "Template/省外办出访请示 - 模板.docx";
+            var doc = new Document(tempPath);
+            DocumentBuilder builder = new DocumentBuilder(doc);
+
+            //键值对存放数据
+            Dictionary<string, string> dic = new Dictionary<string, string>();
+
+            //××(组团单位):接团客户信息团组
+            dic.Add("GroupClient", groupInfo.ClientUnit);
+
+            //关于××(职务、姓名)等×人赴××(国家或地区)进行×××(出访目的)的请示
+            string guestName = "";
+            string guestJob = "";
+            string guestInfoStr = "";
+            var guestFirstInfo = guestInfos.FirstOrDefault();
+            if (guestFirstInfo != null)
+            {
+                guestName = guestFirstInfo.LastName + guestFirstInfo.FirstName;
+                guestJob = guestFirstInfo.Job;
+                guestInfoStr = $@"{guestJob}、{guestName}";
+            }
+            string askTitle = $@"关于{guestInfoStr}等{guestInfos.Count}人赴{groupInfo.VisitCountry}进行{groupInfo.VisitPurpose}的请示";
+            dic.Add("AskTitle", askTitle);
+
+            //应×××(邀请方名称+邀请人职务和姓名)的邀请,我单位拟派×××(职务、姓名)等×人(人数)于×××年×××月×××日赴×××(国家或地区)进行×××(出访目的)。现请示如下。
+            string visitDateStr = @$"{groupInfo.VisitDate.Year}年{groupInfo.VisitDate.Month}月{groupInfo.VisitDate.Day}日";
+            string obInfoStr = "";
+            foreach (var ob in obDatas)
+            {
+                obInfoStr += @$"{ob.Client}{ob.Job}{ob.Contact}、";
+            }
+            if (obInfoStr.Length > 0)
+            {
+                obInfoStr = obInfoStr.Substring(0, obInfoStr.Length - 1);
+            }
+
+            string askSubTitle = $@"应{obInfoStr}的邀请,我单位拟派{guestInfoStr}等{guestInfos.Count}人于{visitDateStr}赴{groupInfo.VisitCountry}进行{groupInfo.VisitPurpose}。现请示如下。";
+            dic.Add("AskSubTitle", askSubTitle);
+
+            //出访背景
+            dic.Add("AskTitle", askTitle);
+
+            #region 填充word模板书签内容
+            foreach (var key in dic.Keys)
+            {
+                builder.MoveToBookmark(key);
+                builder.Write(dic[key]);
+            }
+            #endregion
+
+            //获取word里所有表格
+            NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
+            //获取所填表格的序数
+            Aspose.Words.Tables.Table tableOne = allTables[0] as Aspose.Words.Tables.Table;
+
+            var rowStart = tableOne.Rows[0]; //获取第1行
+
+            //循环赋值
+            for (int i = 0; i < guestInfos.Count; i++)
+            {
+                var guestInfo = guestInfos[i];
+                builder.MoveToCell(0, i + 1, 0, 0);
+                builder.Write(guestInfo.LastName + guestInfo.FirstName);
+
+                builder.MoveToCell(0, i + 1, 1, 0);
+                int sex = guestInfo.Sex;
+                string sexStr = string.Empty;
+                if (sex == 0) sexStr = "男";
+                else if (sex == 1) sexStr = "女";
+                else sexStr = "未设置";
+                builder.Write(sexStr);
+
+                builder.MoveToCell(0, i + 1, 2, 0);
+                builder.Write(guestInfo.CompanyFullName + guestInfo.Job);
+
+
+                builder.MoveToCell(0, i + 1, 3, 0);
+                string birthDay = "";
+                string birthDayStr = string.Empty;
+                if (!string.IsNullOrEmpty(birthDay))
+                {
+                    birthDayStr = Convert.ToDateTime(birthDay).ToString("yyyy-MM-dd");
+                }
+                builder.Write(birthDayStr);
+
+            }
+
+            var fileDir = AppSettingsHelper.Get("WordBasePath");
+            string fileName = $"{groupInfo.TeamName}省外办出访请示.docx";
+            string filePath = fileDir + $@"Ask/{fileName}";
+            doc.Save(filePath);
+            string Url = $@"{AppSettingsHelper.Get("WordBaseUrl")}Office/Word/Ask/{fileName}";
+            return Ok(JsonView(true, "操作成功!", Url));
+        }
+
         #endregion
 
         #region 请示数据库
@@ -1837,65 +1977,6 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
             }
         }
 
-
-        /// <summary>
-        /// 导出省外办请示
-        /// </summary>
-        /// <param name="dto"></param>
-        /// <returns></returns>
-        [HttpPost]
-        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> AskAdviceDerive(AskAdviceDerive dto)
-        {
-            try
-            {
-                string Air = "";//机票信息
-                string Area = "";//城市
-                string Area2 = "";//城市
-                string ClientName = "";//人员
-                string ClientName2 = "";//人员
-                int ClientNumber =0;//总人数
-                string Content = "";//行程安排
-                string CountryAndDay = "";//各个国家待的天数
-                string Destination = "";//此行目的
-                string Destination2 = "";//此行目的
-                string Duration = "";//出访时间
-                int Durationdays = 0;//出访天数
-                int Durationdays2 =0;//出访天数
-                string Official = "";//对谁的邀请
-                string Temp = "";//出访任务
-                string VisitDate = "";//出访日期,多少号到多少号
-
-
-                return Ok(JsonView(true, "导出成功!"));
-            }
-            catch (Exception ex)
-            {
-                return Ok(JsonView(false, "程序错误!"));
-                throw;
-            }
-        }
-
-        /// <summary>
-        /// 导出市外办请示
-        /// </summary>
-        /// <param name="dto"></param>
-        /// <returns></returns>
-        [HttpPost]
-        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> AskCityDerive(AskAdviceDerive dto)
-        {
-            try
-            {
-              
-                return Ok(JsonView(true, "导出成功!"));
-            }
-            catch (Exception ex)
-            {
-                return Ok(JsonView(false, "程序错误!"));
-                throw;
-            }
-        }
         #endregion
 
         #region 机票黑屏代码

+ 5 - 0
OASystem/OASystem.Domain/Dtos/Groups/CarTouristGuideGroundDto.cs

@@ -104,6 +104,11 @@ namespace OASystem.Domain.Dtos.Groups
         /// </summary>
         public int PriceType { get; set; }
 
+        /// <summary>
+        /// 费用名称
+        /// </summary>
+        public string PriceName { get; set; }
+
     }
 
     public class CarTouristGuideGroundContentDto : PortDtoBase

+ 8 - 1
OASystem/OASystem.Domain/Dtos/Resource/QueryAskDataDto.cs

@@ -69,8 +69,15 @@ namespace OASystem.Domain.Dtos.Resource
     /// <summary>
     /// 导出请示参数
     /// </summary>
-    public class AskAdviceDerive
+    public class AskFileDownloadDto
     {
+        /// <summary>
+        /// 文件类型
+        /// 1 省外办出访请示
+        /// 2 市外办出访请示
+        /// </summary>
+        public int FileType { get; set; } = 1;
+
         public int DiId { get; set; }
 
         public int[] IdList { get; set; }

+ 5 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_CarTouristGuideGroundReservations.cs

@@ -108,5 +108,10 @@ namespace OASystem.Domain.Entities.Groups
         /// 费用类型
         /// </summary>
         public int PriceType {  get; set; }
+
+        /// <summary>
+        /// 费用名称
+        /// </summary>
+        public string PriceName { get; set; }
     }
 }

+ 35 - 13
OASystem/OASystem.Domain/ViewModels/Financial/Fin_ForeignReceivablesView.cs

@@ -384,40 +384,62 @@ namespace OASystem.Domain.ViewModels.Financial
         /// <summary>
         /// 子项明细
         /// </summary>
-        public List<ProceedsReceivedInfoView>? prItem { get; set; }
+        public List<ClientFeeInfoView>? feeItem { get; set; }
     }
 
     /// <summary>
-    /// 已收详情 Info View
+    /// 单位应收已收详情 Info View
     /// 新增
     /// 雷怡 2024-01-08 11:01:55
     /// </summary>
-    public class ProceedsReceivedInfoView
+    public class ClientFeeInfoView
     {
         /// <summary>
-        /// 到款时间
+        /// 付款单位
         /// </summary>
-        public string time { get; set; }
+        public string client { get; set; }
 
         /// <summary>
-        /// 付款单位
+        /// 金额 - 应收
         /// </summary>
-        public string client { get; set; }
+        public string frMoney { get; set; }
+
+        /// <summary>
+        /// 汇率 - 应收
+        /// </summary>
+        public string frRate { get; set; }
+
+        /// <summary>
+        /// 币种 - 应收
+        /// </summary>
+        public string frCurrency { get; set; }
+
+
+        /// <summary>
+        /// 付款类型(转账,刷卡等) - 已收
+        /// </summary>
+        public string prReceivablesType { get; set; }
 
         /// <summary>
-        /// 付款金额
+        /// 到款时间 - 已收
         /// </summary>
-        public string money { get; set; }
+        public string prTime { get; set; }
 
         /// <summary>
-        /// 付款币种
+        /// 付款金额 - 已收
         /// </summary>
-        public string currency { get; set; }
+        public string prMoney { get; set; }
 
         /// <summary>
-        /// 付款类型(转账,刷卡等)
+        /// 付款币种 - 已收
         /// </summary>
-        public string receivablesType { get; set; }
+        public string prCurrency { get; set; }
+
+        /// <summary>
+        /// 尾款
+        /// </summary>
+        public string balPayment { get; set; }
+
     }
 
     #endregion

+ 2 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/CarTouristGuideGroundRepository.cs

@@ -45,7 +45,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 Grp_CarTouristGuideGroundReservations grp_CarTouristGuide = _mapper.Map<Grp_CarTouristGuideGroundReservations>(dto);
                 if (dto.Status == 1)//添加
                 {
-                    Grp_CarTouristGuideGroundReservations grp_CarTouristGuideGround = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().First(a => a.IsDel == 0 && a.Area == dto.Area && a.BusName == dto.BusName && a.ServiceGuide == dto.ServiceGuide && a.DiId == dto.DiId && a.BusTel == dto.BusTel && a.ServiceTel == dto.ServiceTel);
+                    Grp_CarTouristGuideGroundReservations grp_CarTouristGuideGround = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().First(a => a.IsDel == 0 && a.Area == dto.Area && a.BusName == dto.BusName && a.ServiceGuide == dto.ServiceGuide && a.DiId == dto.DiId && a.BusTel == dto.BusTel && a.ServiceTel == dto.ServiceTel && a.PriceName == dto.PriceName);
                     if (grp_CarTouristGuideGround != null)
                     {
                         return result = new Result() { Code = -1, Msg = "该笔费用已存在,请勿重复添加!" };
@@ -85,6 +85,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         OrbitalPrivateTransfer = grp_CarTouristGuide.OrbitalPrivateTransfer,
                         Remark = grp_CarTouristGuide.Remark,
                         PriceType = grp_CarTouristGuide.PriceType,
+                        PriceName = grp_CarTouristGuide.PriceName,
                     });
                     if (res)
                     {

+ 1 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/DelegationInfoRepository.cs

@@ -105,7 +105,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
             Result result = new Result() { Code = -2, Msg = "未知错误", Data = new List<object>() { } };
 
             string sql = string.Format(@"Select Id,TeamName,TourCode,ClientName,VisitCountry,VisitStartDate,VisitEndDate,VisitDays,VisitPNumber 
-                                             From Grp_DelegationInfo Where IsDel = 0 Order By Id Desc");
+                                             From Grp_DelegationInfo With(NoLock) Where IsDel = 0 Order By Id Desc");
 
 
             var _DelegationInfo = await _sqlSugar.SqlQueryable<Web_ShareGroupInfoView>(sql).ToListAsync();

+ 14 - 28
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs

@@ -257,10 +257,23 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         }
                     }
                     else
-                    { //添加
+                    {
+                        //效重 根据团组Id 
+
+                        var info  = _sqlSugar.Queryable<Grp_EnterExitCost>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).First();
+                        if (info != null )
+                        {
+                            _sqlSugar.RollbackTran();
+                            result.Msg = "该团组相关数据已存在,请勿重新添加!";
+                            return result;
+
+                        }
+
+                        //添加
                         enterExitId = _sqlSugar.Insertable<Grp_EnterExitCost>(enterExitCost).ExecuteReturnIdentity();
                         if (enterExitId < 1)
                         {
+                            _sqlSugar.RollbackTran();
                             result.Msg = "添加操作失败!";
                             return result;
                         }
@@ -268,7 +281,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                     if (enterExitId > 0)
                     {
-
                         string sqlDelete = string.Format(@" Delete From Grp_DayAndCost Where Diid = {0} ", dto.DiId);
                         await ExecuteCommandAsync(sqlDelete);
 
@@ -282,32 +294,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                 return result;
                             }
                         }
-
-                        //foreach (var item in subData)
-                        //{
-                        //    if (item.Id > 0) //修改
-                        //    {
-                        //        var updateId = _sqlSugar.Updateable<Grp_DayAndCost>(item)
-                        //                                .IgnoreColumns(it => new { it.DiId, it.Type, it.CreateUserId, it.CreateTime, it.IsDel })
-                        //                                .ExecuteCommand();
-                        //        if (updateId < 1)
-                        //        {
-                        //            _sqlSugar.RollbackTran();
-                        //            result.Msg = "修改操作失败!";
-                        //            return result;
-                        //        }
-                        //    }
-                        //    else
-                        //    {  //添加
-                        //        var updateId = _sqlSugar.Insertable<Grp_DayAndCost>(item).ExecuteCommand();
-                        //        if (updateId < 1)
-                        //        {
-                        //            _sqlSugar.RollbackTran();
-                        //            result.Msg = "添加操作失败!";
-                        //            return result;
-                        //        }
-                        //    }
-                        //}
                     }
 
                     _sqlSugar.CommitTran();

+ 0 - 2
OASystem/OASystem.Infrastructure/Repositories/Resource/OfficialActivitiesRepository.cs

@@ -60,7 +60,6 @@ namespace OASystem.Infrastructure.Repositories.Resource
                             bool b_dt = DateTime.TryParse(temp.Date, out dt);
                             if (b_dt)
                             {
-
                                 if (!string.IsNullOrEmpty(temp.Time)) temp.Date = dt.ToString("yyyy-MM-dd") + " " + temp.Time;
                                 else temp.Date = dt.ToString("yyyy-MM-dd HH:mm:ss");
 
@@ -128,7 +127,6 @@ namespace OASystem.Infrastructure.Repositories.Resource
                         rst.CurrPageSize = dto.PageSize;
                         result = new Result() { Code = 0, Msg = "查询成功!", Data = rst };
                     }
-
                 }
                 else
                 {