Browse Source

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

leiy 1 year ago
parent
commit
72679a63c2

+ 216 - 17
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -73,6 +73,7 @@ using OASystem.Domain.ViewModels.Statistics;
 using NPOI.XSSF.Model;
 using NetTaste;
 using Microsoft.AspNetCore.Http;
+using EyeSoft.Collections.Generic;
 
 namespace OASystem.API.Controllers
 {
@@ -3038,6 +3039,35 @@ namespace OASystem.API.Controllers
 
         }
 
+        /// <summary>
+        /// 查询供应商名称
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult QueryAssociateSupplier(AssociateSupplierDto dto)
+        {
+            var dbResult = _sqlSugar.Queryable<Grp_DecreasePayments>()
+                .Where(x => x.SupplierName.Contains(dto.param) && x.IsDel == 0).ToList() 
+                ?? new List<Grp_DecreasePayments>();
+            dbResult = dbResult.Distinct(new
+                 ProductComparer ()).ToList();
+
+            var jw = JsonView(true, "success", dbResult.OrderByDescending(x=>x. Id ).Select(x => new
+            {
+                x.Id,
+                x.SupplierAddress,
+                x.SupplierArea,
+                x.SupplierContact,
+                x.SupplierContactNumber,
+                x.SupplierEmail,
+                x.SupplierName,
+                x.SupplierSocialAccount,
+                x.SupplierTypeId,
+            }).ToList());
+            return Ok(jw);
+        }
+
         #endregion
 
         #region 文件上传、删除
@@ -3724,29 +3754,30 @@ namespace OASystem.API.Controllers
                 //默认币种显示
                 List<CurrencyInfo> _currencyInfos = new List<CurrencyInfo>()
                 {
-                    new CurrencyInfo (){ CurrencyCode="USD",CurrencyName = "美元",Rate = 0.0000M },
-                    new CurrencyInfo (){ CurrencyCode="EUR",CurrencyName = "欧元",Rate = 0.0000M },
-                    new CurrencyInfo (){ CurrencyCode="GBP",CurrencyName = "英镑",Rate = 0.0000M },
-                    new CurrencyInfo (){ CurrencyCode="JPY",CurrencyName = "日元",Rate = 0.0000M },
-                    new CurrencyInfo (){ CurrencyCode="HKD",CurrencyName = "港币",Rate = 0.0000M },
+                    new CurrencyInfo (){ CurrencyCode="USD",CurrencyName = "美元",Rate = 7.5000M },
+                    new CurrencyInfo (){ CurrencyCode="EUR",CurrencyName = "欧元",Rate = 8.0000M },
+                    new CurrencyInfo (){ CurrencyCode="GBP",CurrencyName = "英镑",Rate = 9.5000M },
+                    new CurrencyInfo (){ CurrencyCode="JPY",CurrencyName = "日元",Rate = 0.0500M },
+                    new CurrencyInfo (){ CurrencyCode="HKD",CurrencyName = "港币",Rate = 0.9500M },
 
                 };
 
                 var _currencyRate = await _juHeApi.PostItemRateAsync(_currencyInfos.Select(it => it.CurrencyCode).ToArray());
                 if (_currencyRate.Count > 0)
                 {
-
                     foreach (var item in _currencyInfos)
                     {
                         var rateInfo = _currencyRate.Where(it => it.Name.Equals(item.CurrencyName)).FirstOrDefault();
                         if (rateInfo != null)
                         {
-                            item.Rate = Convert.ToDecimal(rateInfo.FSellPri) / 100.00M;
+                            decimal rate1 = Convert.ToDecimal(rateInfo.FSellPri) / 100.00M;
+                            rate1 *= 1.03M;
+
+                            item.Rate = Convert.ToDecimal(rate1.ToString("#0.00")) + 0.01M;
                         }
                     }
                 }
 
-
                 return Ok(JsonView(true, "查询成功!", new
                 {
                     GroupNameData = groupNameData.Data,
@@ -3779,11 +3810,11 @@ namespace OASystem.API.Controllers
             //默认币种显示
             List<CurrencyInfo> _currencyInfos = new List<CurrencyInfo>()
                 {
-                    new CurrencyInfo (){ CurrencyCode="USD",CurrencyName = "美元",Rate = 0.0000M },
-                    new CurrencyInfo (){ CurrencyCode="EUR",CurrencyName = "欧元",Rate = 0.0000M },
-                    new CurrencyInfo (){ CurrencyCode="GBP",CurrencyName = "英镑",Rate = 0.0000M },
-                    new CurrencyInfo (){ CurrencyCode="JPY",CurrencyName = "日元",Rate = 0.0000M },
-                    new CurrencyInfo (){ CurrencyCode="HKD",CurrencyName = "港币",Rate = 0.0000M },
+                    new CurrencyInfo (){ CurrencyCode="USD",CurrencyName = "美元",Rate = 7.5000M },
+                    new CurrencyInfo (){ CurrencyCode="EUR",CurrencyName = "欧元",Rate = 8.0000M },
+                    new CurrencyInfo (){ CurrencyCode="GBP",CurrencyName = "英镑",Rate = 9.5000M },
+                    new CurrencyInfo (){ CurrencyCode="JPY",CurrencyName = "日元",Rate = 0.0500M },
+                    new CurrencyInfo (){ CurrencyCode="HKD",CurrencyName = "港币",Rate = 0.9500M },
                 };
 
             var _currencyRate = await _juHeApi.PostItemRateAsync(_currencyInfos.Select(it => it.CurrencyCode).ToArray());
@@ -3796,11 +3827,17 @@ namespace OASystem.API.Controllers
                     if (rateInfo != null)
                     {
                         item.Rate = Convert.ToDecimal((Convert.ToDecimal(rateInfo.FSellPri == null ? 0.00M : rateInfo.FSellPri) / 100.00M).ToString("#0.0000"));
+
+                        decimal rate1 = item.Rate;
+                        rate1 *= 1.03M;
+
+                        decimal rate2 = Convert.ToDecimal(rate1.ToString("#0.00")) + 0.01M;
+
                         reteInfos.Add(new
                         {
                             currCode = item.CurrencyCode,
                             currName = item.CurrencyName,
-                            rate = item.Rate,
+                            rate = rate2,
                             lastUpdateDt = rateInfo.Date + " " + rateInfo.Time
                         });
                     }
@@ -5819,7 +5856,7 @@ namespace OASystem.API.Controllers
             }
             else
             {
-                jw.Msg = "城市数据空!";
+                jw.Msg = "城市数据空!";
                 jw.Data = new string[0];
             }
 
@@ -6354,11 +6391,12 @@ namespace OASystem.API.Controllers
                 }
             }
             string path = savePath + Find.TeamName + "出访日程.docx";
+            string ftpPath = AppSettingsHelper.Get("WordBaseUrl") + AppSettingsHelper.Get("WordFtpPath") + "Travel/export/" + Find.TeamName + "出访日程.docx";
 
             try
             {
                 doc.Save(path, Aspose.Words.SaveFormat.Doc);
-                jw = JsonView(true, "导出成功", path);
+                jw = JsonView(true, "导出成功", ftpPath);
             }
             catch (Exception)
             {
@@ -7136,6 +7174,8 @@ namespace OASystem.API.Controllers
             //     Grp_GroupCostParameter());
             var GroupCostParameterMap = _mapper.Map<List<Grp_GroupCostParameterDto>>(GroupCostParameter);
 
+            bool hotelIsTrue = _sqlSugar.Queryable<Grp_HotelInquiry>().Where(x => x.DiId == dto.Diid && x.IsDel == 0 ).Count() > 0;
+
             return Ok(JsonView(new
             {
                 groupList,
@@ -7151,7 +7191,8 @@ namespace OASystem.API.Controllers
                     x.Id,
                 }).ToList(),
                 baoPi = _GroupCostParameterRepository.GetBaoPi(diid),
-                blackCodeIsTrue = create.Code == 0 ? true : false
+                blackCodeIsTrue = create.Code == 0 ? true : false,
+                hotelIsTrue = hotelIsTrue,
             })) ;
         }
 
@@ -9019,6 +9060,164 @@ namespace OASystem.API.Controllers
             return Ok(jw);
         }
 
+        /// <summary>
+        /// 成本获取OP历史车费用
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<IActionResult> GetHistoryCarData(HistoryCarDataDto dto)
+        {
+            var jw = JsonView(false);
+
+            try
+            {
+                List<HistoryCarDataView> dbResult = new List<HistoryCarDataView>();
+                //获取现有所有车的数据
+                if (!dto.Param.IsNullOrWhiteSpace())
+                {
+
+                   
+
+                    string sql = $@"
+SELECT gdi.TeamName , gctggr.Area, gctggr.PriceName  , gctggrc.Id  ,gctggrc.Price , gctggrc.DatePrice , gctggrc.PriceContent , gctggrc.Currency , gctggr.ServiceStartTime , gctggr.ServiceEndTime 
+FROM  Grp_CarTouristGuideGroundReservationsContent gctggrc inner join Grp_CarTouristGuideGroundReservations gctggr  on 
+gctggrc.CTGGRId  = gctggr.Id  inner JOIN  Grp_DelegationInfo gdi  on gctggr.DiId = gdi.Id  LEFT JOIN  Sys_SetData ssd  on ssd.Id  = gctggr.PriceType  
+WHERE gctggr.IsDel  = 0  and gctggrc.SId  = 91  AND  gdi.IsDel  = 0 AND  gctggrc.Price != 0   AND (ssd.Id in (1061,1069) or ssd.Id is NULL) AND  gctggr.ServiceStartTime is not null 
+AND  gctggr.ServiceEndTime is not NULL 
+ORDER by  gctggrc.id DESC 
+";
+
+                    dbResult = await _sqlSugar.SqlQueryable<HistoryCarDataView>(sql).ToListAsync();
+
+                    
+
+                    var numeberResult = await Task.Run(() =>
+                    {
+                        var numberArr = dbResult.Where(x => int.TryParse(x.Area, out int number)).ToList();
+                        _ = dbResult.RemoveAll(x => int.TryParse(x.Area, out int number));
+                        return numberArr;
+                    });
+
+                    var cityArr = await _sqlSugar.Queryable<Grp_NationalTravelFee>().ToListAsync();
+
+                    foreach (var item in numeberResult)
+                    {
+                        var find = cityArr.Find(x => x.Id == int.Parse(item.Area)) ?? new Grp_NationalTravelFee
+                        {
+                            Country = "数据异常!",
+                            City = string.Empty,
+                        };
+                        item.Area = find.Country + " " + find.City;
+                    }
+
+                    dbResult.AddRange(numeberResult);
+
+                    if (dto.Param.Contains("、"))
+                    {
+                        var sp = dto.Param.Split("、");
+                        dbResult = dbResult.AsParallel().WithDegreeOfParallelism(Environment.ProcessorCount)
+                           .Where(x =>
+                           {
+                               return System.Array.Exists(sp, e =>
+                               {
+                                   bool where = false;
+                                   if (x.Area != null)
+                                   {
+                                       where = x.Area.Contains(e);
+                                       if (x.Area.Contains("尾款") || x.PriceName.Contains("尾款"))
+                                       {
+                                           return false;
+                                       }
+                                   }
+                                   if (x.PriceName != null && !where)
+                                   {
+                                       where = x.PriceName.Contains(e);
+                                       if (x.PriceName.Contains("尾款") || x.PriceName.Contains("尾款"))
+                                       {
+                                           return false;
+                                       }
+                                   }
+                                   return where;
+                               });
+                           }).ToList();
+                    }
+                    else
+                    {
+                        dbResult = dbResult.AsParallel().WithDegreeOfParallelism(Environment.ProcessorCount)
+                            .Where(x =>
+                            {
+                                bool where = false;
+                                if (x.Area != null)
+                                {
+                                    where = x.Area.Contains(dto.Param);
+                                    if (x.Area.Contains("尾款") || x.PriceName.Contains("尾款"))
+                                    {
+                                        return false;
+                                    }
+                                }
+                                if (x.PriceName != null && !where)
+                                {
+                                    where = x.PriceName.Contains(dto.Param);
+                                    if (x.PriceName.Contains("尾款") || x.PriceName.Contains("尾款"))
+                                    {
+                                        return false;
+                                    }
+                                }
+                                return where;
+                            }
+                            )
+                            .ToList();
+                    }
+                }
+
+                var view = dbResult.Select(x => {
+
+                    decimal dp = 0.00M;
+                    var startB = DateTime.TryParse(x.Start.ToString(),out DateTime startD);
+                    var endB = DateTime.TryParse(x.End.ToString(), out DateTime endD);
+                    if (string.IsNullOrWhiteSpace(x.DatePrice))
+                    {
+                        if (startB && endB)
+                        {
+                            var timesp = endD.Subtract(startD);
+                            if ((timesp.Days + 1) != 0 )
+                            {
+                                dp = x.Price / (timesp.Days + 1);
+                            }
+                            
+                        }
+                    }
+                    else
+                    {
+                        dp = x.Price;
+                    }
+
+                    return new
+                    {
+                        start = startB ? startD.ToString("yyyy-MM-dd") : "",
+                        end = endB ? endD.ToString("yyyy-MM-dd") : "",
+                        x.Area,
+                        x.id,
+                        price = x.Price.ToString("F2"),
+                        x.PriceName,
+                        x.PriceContent,
+                        x.TeamName,
+                        x.DatePrice,
+                        dayPrice = dp.ToString("F2"),
+                    };
+                }).OrderByDescending(x=>x.id).ToList();
+
+                jw = JsonView(true, "获取成功!", view);
+            }
+            catch (Exception e)
+            {
+                jw = JsonView(false,e.Message);
+            }
+
+            return Ok(jw);
+        }
+
         #endregion
 
         #region 酒店预订 新 雷怡 2023-12-28 17:45

+ 51 - 1
OASystem/OASystem.Domain/Dtos/Groups/DecreasePaymentsDto.cs

@@ -1,5 +1,7 @@
-using System;
+using OASystem.Domain.Entities.Groups;
+using System;
 using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -157,4 +159,52 @@ namespace OASystem.Domain.Dtos.Groups
 
         public int Id { get; set; }
     }
+
+    public class AssociateSupplierDto
+    {
+        public string param { get; set; }
+    }
+
+    public class ProductComparer : IEqualityComparer<Grp_DecreasePayments>
+    {
+        public bool Equals(Grp_DecreasePayments x, Grp_DecreasePayments y)
+        {
+            if (Object.ReferenceEquals(x,y))
+            {
+                return true;
+            }
+
+            var xStr = 
+                x.SupplierAddress +
+                x.SupplierArea +
+                x.SupplierContact +
+                x.SupplierContactNumber +
+                x.SupplierEmail +
+                x.SupplierName +
+                x.SupplierSocialAccount +
+                x.SupplierTypeId;
+
+            var yStr =
+                y.SupplierAddress +
+                y.SupplierArea +
+                y.SupplierContact +
+                y.SupplierContactNumber +
+                y.SupplierEmail +
+                y.SupplierName +
+                y.SupplierSocialAccount +
+                y.SupplierTypeId;
+
+            if (xStr == yStr)
+            {
+                return true;
+            }
+
+            return false;
+        }
+
+        public int GetHashCode([DisallowNull] Grp_DecreasePayments product)
+        {
+            return 0;
+        }
+    }
 }

+ 143 - 91
OASystem/OASystem.Domain/Dtos/Groups/GroupCostSavaDto.cs

@@ -1,4 +1,5 @@
-using OASystem.Domain.Entities;
+using Google.Protobuf.WellKnownTypes;
+using OASystem.Domain.Entities;
 using OASystem.Domain.Entities.Groups;
 using System;
 using System.Collections.Generic;
@@ -11,25 +12,25 @@ namespace OASystem.Domain.Dtos.Groups
     public class GroupCostSavaDto
     {
         //选中
-       public List<Grp_CheckBoxsDto> CheckBoxs { get; set; }
+        public List<Grp_CheckBoxsDto> CheckBoxs { get; set; }
 
         //列表
-       public List<Grp_GroupCostDto> GroupCosts { get; set; }
+        public List<Grp_GroupCostDto> GroupCosts { get; set; }
 
         //房间数
-       public List<Grp_CostTypeHotelNumberDto> CostTypeHotelNumbers { get; set; }
+        public List<Grp_CostTypeHotelNumberDto> CostTypeHotelNumbers { get; set; }
 
         //系数
-       public List<Grp_GroupCostParameterDto> GroupCostParameters { get; set; }
+        public List<Grp_GroupCostParameterDto> GroupCostParameters { get; set; }
 
         public int Userid { get; set; }
 
-        public int Diid {  get; set; }  
+        public int Diid { get; set; }
     }
 
     public class CarGuidesDto
     {
-     
+
     }
 
     public class GroupIsShareDto
@@ -104,7 +105,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 车费用
         /// </summary>
-        
+
         public decimal CarCost
         {
             get { return carCost; }
@@ -115,7 +116,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 车数量
         /// </summary>
-        
+
         public int CarNumber
         {
             get { return carNumber; }
@@ -126,7 +127,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 用车时间
         /// </summary>
-        
+
         public decimal CarTiming
         {
             get { return carTiming; }
@@ -137,7 +138,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         ///  导游工资
         /// </summary>
-        
+
         public decimal TGS
         {
             get { return tgs; }
@@ -148,7 +149,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         ///  导游工作时间
         /// </summary>
-        
+
         public decimal TGWH
         {
             get { return tgwh; }
@@ -159,7 +160,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         ///  导游数量
         /// </summary>
-        
+
         public decimal TGN
         {
             get { return tgn; }
@@ -171,7 +172,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// </summary>
         decimal tgof;
 
-        
+
         public decimal TGOF
         {
             get { return tgof; }
@@ -182,7 +183,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 导游餐补
         /// </summary>
-        
+
         public decimal TGM
         {
             get { return tgm; }
@@ -193,7 +194,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 导游房补
         /// </summary>
-        
+
         public decimal TGA
         {
             get { return tga; }
@@ -204,7 +205,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 导游交通费
         /// </summary>
-        
+
         public decimal TGTF
         {
             get { return tgtf; }
@@ -215,7 +216,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 导游景点费
         /// </summary>
-        
+
         public decimal TGEF
         {
             get { return tgef; }
@@ -226,7 +227,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         ///  司机工资
         /// </summary>
-        
+
         public decimal CFS
         {
             get { return cfs; }
@@ -237,7 +238,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// 司机餐补
         /// </summary>
         decimal cfm;
-        
+
         public decimal CFM
         {
             get { return cfm; }
@@ -248,7 +249,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// 司机超时费用
         /// </summary>
         decimal cfof;
-        
+
         public decimal CFOF
         {
             get { return cfof; }
@@ -259,7 +260,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 早餐
         /// </summary>
-        
+
         public decimal B
         {
             get { return b; }
@@ -270,7 +271,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 午餐
         /// </summary>
-        
+
         public decimal L
         {
             get { return l; }
@@ -281,7 +282,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 晚餐
         /// </summary>
-        
+
         public decimal D
         {
             get { return d; }
@@ -292,7 +293,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 1/2 双人间
         /// </summary>
-        
+
         public decimal TBR
         {
             get { return tbr; }
@@ -302,7 +303,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 单间
         /// </summary>
-        
+
         public decimal SGR
         {
             get { return sgr; }
@@ -312,7 +313,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 小套房
         /// </summary>
-        
+
         public decimal JS_ES
         {
             get { return jses; }
@@ -323,7 +324,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 套房
         /// </summary>
-        
+
         public decimal Suite
         {
             get { return suite; }
@@ -344,7 +345,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 公务活动费用
         /// </summary>
-        
+
         public decimal TV
         {
             get { return tv; }
@@ -355,7 +356,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 邀请函相关费用
         /// </summary>
-        
+
         public decimal iL
         {
             get { return il; }
@@ -366,7 +367,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 公务翻译费用
         /// </summary>
-        
+
         public decimal IF
         {
             get { return iF; }
@@ -377,7 +378,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 景点门票
         /// </summary>
-        
+
         public decimal EF
         {
             get { return ef; }
@@ -388,7 +389,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 饮料零食水果
         /// </summary>
-        
+
         public decimal B_R_F
         {
             get { return brf; }
@@ -399,7 +400,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 出行物资
         /// </summary>
-        
+
         public decimal TE
         {
             get { return te; }
@@ -410,7 +411,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 导游小费
         /// </summary>
-        
+
         public decimal TGTips
         {
             get { return tgtips; }
@@ -420,7 +421,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 司机小费
         /// </summary>
-        
+
         public decimal DRVTips
         {
             get { return drvtips; }
@@ -431,7 +432,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 零用金
         /// </summary>
-        
+
         public decimal PC
         {
             get { return pc; }
@@ -442,7 +443,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 领队费
         /// </summary>
-        
+
         public decimal TLF
         {
             get { return tlf; }
@@ -453,7 +454,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 会务费
         /// </summary>
-        
+
         public decimal ECT
         {
             get { return ect; }
@@ -513,157 +514,157 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 团组ID
         /// </summary>
-        
+
         public int DiId { get; set; }
         /// <summary>
         /// 币种
         /// </summary>
-       
+
         public string Currency { get; set; }
         /// <summary>
         /// 汇率
         /// </summary>
-       
+
         public decimal Rate { get; set; }
         /// <summary>
         /// 税率
         /// </summary>
-       
+
         public decimal Tax { get; set; }
         /// <summary>
         /// 房费预算
         /// </summary>
-       
+
         public decimal FFYS { get; set; }
         /// <summary>
         /// 酒店系数
         /// </summary>
-       
+
         public decimal HotelXS { get; set; }
         /// <summary>
         /// 经济舱成本
         /// </summary>
-       
+
         public decimal JJCCB { get; set; }
         /// <summary>
         /// 经济舱系数
         /// </summary>
-       
+
         public decimal JJCXS { get; set; }
         /// <summary>
         /// 经济舱人数
         /// </summary>
-        
+
         public int JJCRS { get; set; }
         /// <summary>
         /// 公务舱成本
         /// </summary>
-       
+
         public decimal GWCCB { get; set; }
         /// <summary>
         /// 公务舱系数
         /// </summary>
-       
+
         public decimal GWCXS { get; set; }
         /// <summary>
         /// 公务舱人数
         /// </summary>
-        
+
         public int GWCRS { get; set; }
         /// <summary>
         /// 火车票成本
         /// </summary>
-       
+
         public decimal HCPCB { get; set; }
         /// <summary>
         /// 火车票系数
         /// </summary>
-       
+
         public decimal HCPXS { get; set; }
         /// <summary>
         /// 火车票人数
         /// </summary>
-        
+
         public int HCPRS { get; set; }
         /// <summary>
         /// 船票成本
         /// </summary>
-       
+
         public decimal CPCB { get; set; }
         /// <summary>
         /// 船票系数
         /// </summary>
-       
+
         public decimal CPXS { get; set; }
         /// <summary>
         /// 船票人数
         /// </summary>
-        
+
         public int CPRS { get; set; }
         /// <summary>
         /// 保险成本
         /// </summary>
-       
+
         public decimal BXCB { get; set; }
         /// <summary>
         /// 保险系数
         /// </summary>
-       
+
         public decimal BXXS { get; set; }
         /// <summary>
         /// 保险人数
         /// </summary>
-        
+
         public int BXRS { get; set; }
         /// <summary>
         /// 核酸检测成本
         /// </summary>
-       
+
         public decimal HSCB { get; set; }
         /// <summary>
         /// 核酸检测系数
         /// </summary>
-       
+
         public decimal HSXS { get; set; }
         /// <summary>
         /// 核酸检测人数
         /// </summary>
-        
+
         public int HSRS { get; set; }
         /// <summary>
         /// 签证成本
         /// </summary>
-       
+
         public decimal VisaCB { get; set; }
         /// <summary>
         /// 签证系数
         /// </summary>
-       
+
         public decimal VisaXS { get; set; }
         /// <summary>
         /// 签证人数
         /// </summary>
-        
+
         public int VisaRS { get; set; }
         /// <summary>
         /// 公务成本 : 公杂费
         /// </summary>
-       
+
         public decimal GWCB { get; set; }
         /// <summary>
         /// 公务系数: 公杂费
         /// </summary>
-       
+
         public decimal GWXS { get; set; }
         /// <summary>
         /// 公务人数 : 公杂费
         /// </summary>
-        
+
         public int GWRS { get; set; }
         /// <summary>
         /// 地接成本
         /// </summary>
-       
+
         public decimal DJCB { get; set; }
 
         /// <summary>
@@ -679,88 +680,88 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 单间 单人成本
         /// </summary>
-       
+
         public decimal SGRCB { get; set; }
         /// <summary>
         /// 单间数量(人数)
         /// </summary>
-        
+
         public int SGRNumber { get; set; }
         /// <summary>
         /// 单间 系数
         /// </summary>
-       
+
         public decimal SGRXS { get; set; }
         /// <summary>
         /// 1/2标间 单人成本
         /// </summary>
-       
+
         public decimal TBRCB { get; set; }
         /// <summary>
         /// 1/2标间数量(人数)
         /// </summary>
-        
+
         public int TBRNumber { get; set; }
         /// <summary>
         /// 1/2标间  系数
         /// </summary>
-       
+
         public decimal TBRXS { get; set; }
         /// <summary>
         /// 小套房/豪华套房 单人成本
         /// </summary>
-       
+
         public decimal JSESCB { get; set; }
         /// <summary>
         /// 小套房/豪华套房数量(人数)
         /// </summary>
-        
+
         public int JSESNumber { get; set; }
         /// <summary>
         /// 小套房/豪华套房 系数
         /// </summary>
-       
+
         public decimal JSESXS { get; set; }
         /// <summary>
         /// 套房  单人成本
         /// </summary>
-       
+
         public decimal SUITECB { get; set; }
         /// <summary>
         /// 套房数量(人数)
         /// </summary>
-        
+
         public int SUITENumber { get; set; }
         /// <summary>
         /// 套房  系数
         /// </summary>
-       
+
         public decimal SUITEXS { get; set; }
         /// <summary>
         /// 零用金成本
         /// </summary>
-       
+
         public decimal LYJCB { get; set; }
         /// <summary>
         /// 零用金系数
         /// </summary>
-       
+
         public decimal LYJXS { get; set; }
         /// <summary>
         /// 零用金人数
         /// </summary>
-        
+
         public int LYJRS { get; set; }
         /// <summary>
         /// 成本完成标识  0:未完成 1:完成
         /// </summary>
-        
+
         public int IsShare { get; set; }
 
         /// <summary>
         /// 分段类型
         /// </summary>
-       
+
         public string CostType { get; set; }
         /// <summary>
         /// 开始时间
@@ -773,13 +774,13 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 此段人数
         /// </summary>
-        
+
         public int CostTypenumber { get; set; }
     }
 
     public class GroupCostInItDto
     {
-        public int Diid { get; set; } 
+        public int Diid { get; set; }
     }
 
     public class GroupCostExportWordFile
@@ -834,7 +835,7 @@ namespace OASystem.Domain.Dtos.Groups
     {
         public string Type { get; set; }
 
-        public List<leftInfoModel> leftinfoNumber {get;set; }
+        public List<leftInfoModel> leftinfoNumber { get; set; }
     }
 
     public class RightModel
@@ -1302,7 +1303,7 @@ namespace OASystem.Domain.Dtos.Groups
 
         public string TeamName { get; set; }
 
-        public decimal Tax {  get; set; }
+        public decimal Tax { get; set; }
 
         public string Currency { get; set; }
 
@@ -1335,4 +1336,55 @@ namespace OASystem.Domain.Dtos.Groups
         /// </summary>
         public int CTable { get; set; }
     }
+
+    public class HistoryCarDataDto
+    {
+        public string Param { get; set; }
+    }
+
+    public class HistoryCarDataView
+    {
+        public int id { get; set; }
+
+        public string TeamName { get; set; }
+
+        public decimal Price { get; set; }
+
+        public string Area { get; set; }
+
+        public string PriceName { get; set; }
+
+        public string DatePrice { get; set; }
+
+        public string PriceContent { get; set; }
+
+        public string ServiceStartTime { get; set; }
+
+        public string ServiceEndTime { get; set; }
+
+        public DateTime? Start
+        {
+            get
+            {
+                if (DateTime.TryParse(this.ServiceStartTime, out DateTime time))
+                {
+                    return time;
+                }
+                return null;
+            }
+        }
+
+        public DateTime? End
+        {
+            get
+            {
+                if (DateTime.TryParse(this.ServiceEndTime, out DateTime time))
+                {
+                    return time;
+                }
+                return null;
+            }
+        }
+    }
+
 }

+ 2 - 1
OASystem/OASystem.Infrastructure/Repositories/BaseRepository.cs

@@ -229,10 +229,11 @@ namespace OASystem.Infrastructure.Repositories
             return result > 0;
         }
 
-        public virtual async Task<bool> SoftDeleteAsync(Expression<Func<TEntity, bool>> wherexp)
+        public virtual async Task<bool> SoftDeleteAsync(Expression<Func<TEntity, bool>> wherexp, int userid)
         {
             var result = await _sqlSugar.Updateable<TEntity>().Where(wherexp).SetColumns(a => new TEntity()
             {
+                DeleteUserId = userid,
                 IsDel = 1,
                 DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
             }).ExecuteCommandAsync();

+ 10 - 10
OASystem/OASystem.Infrastructure/Repositories/Groups/AirTicketResRepository.cs

@@ -426,15 +426,15 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 Grp_AirTicketReservations grp_AirTicket = _mapper.Map<Grp_AirTicketReservations>(dto.AirTicketResOpData);
                 if (dto.Status == 1)
                 {
-                    string selectSql = string.Format(@"select * from Grp_AirTicketReservations where CONVERT(nvarchar,ClientName)= '{0}' and IsDel={1} and FlightsCode='{2}'"
-                                                     , dto.AirTicketResOpData.ClientName, 0,dto.AirTicketResOpData.FlightsCode);
-                    var DeleClient = await _sqlSugar.SqlQueryable<Grp_AirTicketReservations>(selectSql).FirstAsync();//查询是否存在
-                    if (DeleClient != null)
-                    {
-                        return result = new Result() { Code = -1, Msg = "该机票信息已存在,请勿重复添加!" };
-                    }
-                    else//不存在,可添加
-                    {
+                    //string selectSql = string.Format(@"select * from Grp_AirTicketReservations where CONVERT(nvarchar,ClientName)= '{0}' and IsDel={1} and FlightsCode='{2}'"
+                    //                                 , dto.AirTicketResOpData.ClientName, 0,dto.AirTicketResOpData.FlightsCode);
+                    //var DeleClient = await _sqlSugar.SqlQueryable<Grp_AirTicketReservations>(selectSql).FirstAsync();//查询是否存在
+                    //if (DeleClient != null)
+                    //{
+                    //    return result = new Result() { Code = -1, Msg = "该机票信息已存在,请勿重复添加!" };
+                    //}
+                    //else//不存在,可添加
+                    //{
                         //grp_AirTicket.ArrivedTime = "";
                         //grp_AirTicket.LeaveDescription = "";
                         //grp_AirTicket.FlightsDescription = "";
@@ -453,7 +453,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                             result = new Result() { Code = 0, Msg = "添加成功!" };
                         }
 
-                    }
+                   // }
                     if (result.Code == 0)
                     {
                         Grp_CreditCardPayment grp_CreditCard = _mapper.Map<Grp_CreditCardPayment>(dto.CardPaymentOpData);

+ 43 - 4
OASystem/OASystem.Infrastructure/Repositories/Groups/CarTouristGuideGroundRepository.cs

@@ -741,11 +741,15 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     tb.Columns.Add("日期", typeof(DateTime));
                     tb.Columns.Add("费用", typeof(decimal));
                     tb.Columns.Add("币种", typeof(string));
-                    var addsTourClientList = new List<Grp_TourClientList>();
                     var carExtraList = carTouristList.Where(x => x.SId == 982 && x.Price != 0).ToList();
                     var mealPriceList = carTouristList.Where(x => (x.SId == 93 || x.SId == 988 || x.SId == 989) && x.Price != 0).GroupBy(x => x.DatePrice).ToList();
                     var tgOvertime = carTouristList.Where(x => x.SId == 1059 && x.Price != 0).ToList();
 
+                    List<Tuple<int, string, int, decimal>> arr = new List<Tuple<int, string, int, decimal>>();
+                    arr.Add(new Tuple<int, string, int,decimal>(1074, "早餐超支费用", 1077, 1M));  // sid name setdataid 系数
+                    arr.Add(new Tuple<int, string, int,decimal>(1075, "午餐超支费用", 1078, 1M));
+                    arr.Add(new Tuple<int, string, int,decimal>(1076, "晚餐超支费用", 1079, 1M));
+
                     //成本数据
                     List<Grp_GroupCost> _GroupCosts = new List<Grp_GroupCost>();
 
@@ -826,6 +830,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         return result;
                     }
 
+                    //车超时费
                     if (carExtraList.Count > 0)
                     {
                         foreach (var item in carExtraList)
@@ -835,7 +840,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                 Price = item.Price,
                                 CreateTime = DateTime.Now,
                                 CreateUserId = dto.CreateUserId,
-                                Coefficient = 1,
+                                Coefficient = 2M,
                                 DiId = dto.DiId,
                                 PriceCurrency = item.Currency,
                                 PriceName = di.TeamName + "-" + priceCity + "-" + "车超时费(地接导入)",
@@ -859,7 +864,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                 Price = item.Price,
                                 CreateTime = DateTime.Now,
                                 CreateUserId = dto.CreateUserId,
-                                Coefficient = 1,
+                                Coefficient = 2M,
                                 DiId = dto.DiId,
                                 PriceCurrency = item.Currency,
                                 PriceName = di.TeamName + "-" + priceCity + "-" + "导游超时费(地接导入)",
@@ -873,6 +878,40 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         }
                     }
 
+                    List<List<Fin_GroupExtraCost>> enterOverspendArr = new List<List<Fin_GroupExtraCost>>();
+
+                    foreach (var item in arr)
+                    {
+
+                        var a = carTouristList.Where(x => x.SId == item.Item1 && x.Price != 0).Select(x => new Fin_GroupExtraCost
+                        {
+                            Coefficient =  item.Item4,
+                            CreateTime = DateTime.Now,
+                            CreateUserId = dto.CreateUserId,
+                            DiId = dto.DiId,
+                            FilePath = string.Empty,
+                            IsDel = 0,
+                            PriceCount = x.Count,
+                            Price = x.Price,
+                            PriceDt = x.DatePrice.ObjToDate(),
+                            PriceCurrency = x.Currency,
+                            PriceSum = x.Count * x.Price,
+                            PriceName = di.TeamName + "-" + priceCity + "-" + $"{item.Item2}(地接导入)",
+                            PriceType = 1028,
+                            PriceDetailType = item.Item3,
+                        }).ToList();
+                        if (a.Count > 0)
+                        {
+                            enterOverspendArr.Add(a);
+                        }
+                    }
+
+                    //数组中的费用
+                    if (enterOverspendArr.Count > 0)
+                    {
+                        groupExtraCostsArr.AddRange(enterOverspendArr.SelectMany(x => x).ToList());
+                    }
+
                     if (_GroupCostParameters != null)
                     {
                         //币种
@@ -1176,7 +1215,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
             catch (Exception ex)
             {
                 RollbackTran();
-                return result = new Result() { Code = -2, Msg = "未知错误" };
+                return result = new Result() { Code = -2, Msg = $"接口异常!({ex.Message})"};
             }
             return result;
         }

+ 3 - 3
OASystem/OASystem.Infrastructure/Repositories/Groups/CostTypeHotelNumberRepository.cs

@@ -17,9 +17,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return Query(x=>x.Diid == diid).ToList();
         }
 
-        public async Task<bool> DeleteCostTypeHotelNumberByDiid(int diid)
+        public async Task<bool> DeleteCostTypeHotelNumberByDiid(int diid,int userid)
         {
-            return await SoftDeleteAsync(x => x.Diid == diid);
+            return await SoftDeleteAsync(x => x.Diid == diid && x.IsDel == 0,userid);
         }
 
 
@@ -29,7 +29,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
             try
             {
                 BeginTran();
-                isTrue = await DeleteCostTypeHotelNumberByDiid(diid);
+                isTrue = await DeleteCostTypeHotelNumberByDiid(diid,Userid);
                 if (List.Count > 0)
                 {
                     List.ForEach(x => { x.CreateUserId = Userid; x.CreateTime = DateTime.Now; });

+ 15 - 3
OASystem/OASystem.Infrastructure/Repositories/Groups/GroupCostParameterRepository.cs

@@ -30,9 +30,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return await UpdateAsync(x => x.Id == id, x=>new Grp_GroupCostParameter { IsShare = IsShare });
         }
 
-        public async Task<bool> DeleteGroupCostParameterListByDiid(int diid) 
+        public async Task<bool> DeleteGroupCostParameterListByDiid(int diid, int userid) 
         {
-            return await SoftDeleteAsync(x=>x.DiId == diid);
+            return await SoftDeleteAsync(x=>x.DiId == diid && x.IsDel == 0, userid);
         }
 
         public async Task<bool> SaveAsync(List<Grp_GroupCostParameter> List,int Userid, int diid)
@@ -41,9 +41,21 @@ namespace OASystem.Infrastructure.Repositories.Groups
             try
             {
                 BeginTran();
-                isTrue = await DeleteGroupCostParameterListByDiid(diid);
+                var mainCost = GetGroupCostParameterMainByDiid(diid) ?? new Grp_GroupCostParameter
+                {
+                    IsShare = 0
+                };
+                isTrue = await DeleteGroupCostParameterListByDiid(diid, Userid);
                 if (List.Count > 0)
                 {
+                    foreach (var item in List)
+                    {
+                        if (item.CostType == "A")
+                        {
+                            item.IsShare = mainCost.IsShare;
+                            break;
+                        }
+                    }
                     List.ForEach(x => { x.CreateUserId = Userid; x.CreateTime = DateTime.Now; });
                     isTrue = Adds(List) > 0;
                 }