Browse Source

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

leiy 1 year ago
parent
commit
30d7eef4bd

+ 3 - 3
OASystem/EntitySync/Program.cs

@@ -94,7 +94,7 @@ db.CodeFirst.SetStringDefaultLength(50).BackupTable().InitTables(new Type[]
     //typeof(Fin_DailyFeePayment),       // 财务 - 日付申请
     //typeof(Fin_DailyFeePaymentContent),// 财务 - 日付申请详细类
     //typeof(Grp_GroupsTaskAssignment),
-    //typeof(Grp_AirTicketReservations),
+    typeof(Grp_AirTicketReservations),
     //typeof(Grp_GroupCostParameter),
     //typeof(Grp_TeamRate),              // 团组汇率
     //typeof(Fin_ForeignReceivables),    // 对外收款账单
@@ -108,7 +108,7 @@ db.CodeFirst.SetStringDefaultLength(50).BackupTable().InitTables(new Type[]
     //typeof(Grp_NationalTravelFee),
     //typeof(Air_TicketBlackCode),
     //typeof(Pm_WageSheet)       //人事模块 工资表单
-    typeof(Grp_VisaProgressCustomer),
-    typeof(Grp_VisaProgressCustomerPicture)
+    //typeof(Grp_VisaProgressCustomer),
+    //typeof(Grp_VisaProgressCustomerPicture)
 });
 Console.WriteLine("数据库结构同步完成!");

+ 4 - 2
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -476,9 +476,9 @@ namespace OASystem.API.Controllers
                 return Ok(JsonView(false, "id错误:" + diId.ToString()));
             }
 
+            List<DelegationVisaProgressView> list = _delegationVisaRep.GetDelegationProgressList(diId);
 
-
-            return Ok(JsonView(false));
+            return Ok(JsonView(list));
         }
 
 
@@ -905,6 +905,8 @@ namespace OASystem.API.Controllers
         {
             try
             {
+                
+
                 Result groupData = await _airTicketResRep.OpAirTicketRes(dto);
                 if (groupData.Code != 0)
                 {

+ 14 - 11
OASystem/OASystem.Domain/Entities/Groups/Grp_AirTicketReservations.cs

@@ -27,7 +27,7 @@ namespace OASystem.Domain.Entities.Groups
         /// <summary>
         /// 航班日期
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(22)")]
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(50)")]
         public string FlightsDate { get; set; }
 
         /// <summary>
@@ -74,17 +74,17 @@ namespace OASystem.Domain.Entities.Groups
         /// <summary>
         /// 去程航班描述代码
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "text")]
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(500)")]
         public string LeaveDescription { get; set; }
         /// /// <summary>
         /// 内陆段航班描述
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "text")]
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(500)")]
         public string FlightsDescription { get; set; }
         /// <summary>
         /// 返程航班描述代码
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "text")]
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(500)")]
         public string ReturnDescription { get; set; }
         /// <summary>
         /// 客户人数
@@ -94,7 +94,7 @@ namespace OASystem.Domain.Entities.Groups
         /// <summary>
         /// 客人名称
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "text")]
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(500)")]
         public string ClientName { get; set; }
         /// <summary>
         /// 出票前报价
@@ -116,21 +116,24 @@ namespace OASystem.Domain.Entities.Groups
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int Currency { get; set; }
-        /// <summary>
-        /// 报价说明
-        /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "text")]
-        public string PriceDescription { get; set; }
+
         /// <summary>
         /// 机票编号
         /// </summary>
-        [SugarColumn(IsNullable =true,ColumnDataType ="varchar(100)")]
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(100)")]
         public string TicketNumber { get; set; }
         /// <summary>
         /// 机票票号
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "varchar(100)")]
         public string TicketCode { get; set; }
+
+        /// <summary>
+        /// 报价说明
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(1000)")]
+        public string PriceDescription { get; set; }
+        
         /// <summary>
         /// 舱类型
         /// </summary>

+ 32 - 3
OASystem/OASystem.Domain/Entities/Groups/Grp_VisaProgress.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -111,11 +112,18 @@ namespace OASystem.Domain.Entities.Groups
         public int CustomerId { get; set; }
 
         /// <summary>
-        /// 客户姓
+        /// 客户姓
         /// 正式使用新版OA后弃用
         /// </summary>
         [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)")]
-        public string CustomerName { get; set; }
+        public string LastName { get; set; }
+
+        /// <summary>
+        /// 客户名
+        /// 正式使用新版OA后弃用
+        /// </summary>
+        [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)")]
+        public string FirstName { get; set; }
 
         /// <summary>
         /// 签证国家
@@ -145,6 +153,27 @@ namespace OASystem.Domain.Entities.Groups
         public DateTime LastOperatorDt { get; set; }
     }
 
+    public enum Enum_DelegationVisaPicType
+    {
+        [Description("护照首页")]
+        FirstPage,
+
+        [Description("批件")]
+        Documents,
+
+        [Description("免签证明")]
+        Exemption,
+
+        [Description("派遣函红头文件")]
+        Dispatch,
+
+        [Description("签证页")]
+        Visa,
+
+        [Description("发票")]
+        Invoice
+    }
+
     [SugarTable("Grp_VisaProgressCustomerPicture")]
     public class Grp_VisaProgressCustomerPicture : EntityBase
     {
@@ -176,6 +205,6 @@ namespace OASystem.Domain.Entities.Groups
         /// 5:发票
         /// </summary>
         [SugarColumn(IsNullable = false, ColumnDataType = "int")]
-        public int PicType { get; set; }
+        public Enum_DelegationVisaPicType PicType { get; set; }
     }
 }

+ 23 - 25
OASystem/OASystem.Domain/ViewModels/Groups/Grp_DelegationVisaView.cs

@@ -30,23 +30,40 @@ namespace OASystem.Domain.ViewModels.Groups
         public string CompletePNumber { get; set; } = "已完成0人";
     }
 
-    public class DelegationVisaPersonView
+    public class DelegationVisaProgressView
     {
         /// <summary>
         /// ID
         /// DeleClient.ID
         /// </summary>
-        public int PersonViewId { get; set; }
+        public int ProgressViewId { get; set; }
 
         //public int RowNumber { get; set; }
         public int DiId { get; set; }
-
+        public int CustomerId { get; set; }
         public string LastName { get; set; }
         public string FirstName { get; set; }
 
         public string Country { get; set; }
         public int StatusSign { get; set; }
-        public string StatusStr { get; set; }
+
+        private string statusstr = "未知";
+        public string StatusStr
+        {
+            get
+            {
+                switch (StatusSign) {
+                    case 0: statusstr= "未完成"; break;
+                    case 1: statusstr= "已完成";break;
+                    case 2: statusstr= "已忽略";break;
+                    default: statusstr= "未知";break;
+                }
+                return statusstr;
+            }
+            set {
+                this.statusstr = value;
+            }
+        }
         public DelegationVisaPicCountList PicCountList { get; set; }
     }
 
@@ -65,33 +82,14 @@ namespace OASystem.Domain.ViewModels.Groups
         }
     }
 
-    public enum Enum_DelegationVisaPicType
-    {
-        [Description("护照首页")]
-        FirstPage,
-
-        [Description("批件")]
-        Documents,
-
-        [Description("免签证明")]
-        Exemption,
-
-        [Description("派遣函红头文件")]
-        Dispatch,
-
-        [Description("签证页")]
-        Visa,
-
-        [Description("发票")]
-        Invoice
-    }
+    
 
     public class DelegationVisaVisitCountryView
     {
         public int CountryViewId { get; set; }
         public int PersonViewId { get; set; }
         public string PicName { get; set; }
-        public Enum_DelegationVisaPicType PicType { get; set; }
+        public Entities.Groups.Enum_DelegationVisaPicType PicType { get; set; }
         public string PicPath { get; set; }
     }
 

+ 26 - 6
OASystem/OASystem.Infrastructure/Repositories/Groups/AirTicketResRepository.cs

@@ -52,7 +52,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 }
                 else
                 {
-                    Grp_CreditCardPayment grp_CreditCard = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == grp_AirTicket.Id && a.IsDel == 0);
+                    Grp_CreditCardPayment grp_CreditCard = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == grp_AirTicket.Id && a.IsDel == 0 && a.CTable==85);
                     if (grp_CreditCard == null) { return result = new Result() { Code = -1, Msg = "暂无数据" }; }
                     return result = new Result()
                     {
@@ -80,17 +80,26 @@ namespace OASystem.Infrastructure.Repositories.Groups
             Grp_DelegationInfo _DelegationInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().First(it => it.Id == dto.DiId);
             if (_DelegationInfo != null)
             {
+                string UserId = "";
+                List<Grp_GroupsTaskAssignment> gtaUIdList = _sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(a=>a.DIId==dto.DiId && a.IsDel==0 && a.CTId==85).ToList();
+                foreach (Grp_GroupsTaskAssignment gta in gtaUIdList)
+                    UserId += gta.UId + ",";
+
+                if (!string.IsNullOrWhiteSpace(UserId))
+                {
+                    UserId = UserId.Substring(0, UserId.Length - 1);
+                }
                 string sql = string.Format(@"select a.*,c.IsAuditGM,(select Name from Sys_SetData where Id=a.cType) as 'CTypeName',(select Name from 
                                                 Sys_SetData where Id=a.PreCurrency) as 'PreCurrencyStr',(select Name from Sys_SetData where Id=a.Currency)
                                                 as 'CurrencyStr' from Grp_AirTicketReservations a,Grp_CreditCardPayment c where  a.id=c.CId  and a.isdel={1} and c.IsDel={1}
-                                                and a.DIId={0} and a.CreateUserId={2} Order By a.CreateTime desc", dto.DiId, 0,dto.UserId);
+                                                and a.DIId={0} and c.DIId={0} and c.CTable=85 and a.CreateUserId in({2}) Order By a.CreateTime desc", dto.DiId, 0,UserId);
                 List<AirTicketReservationsView> _AirTicketReservations = _sqlSugar.SqlQueryable<AirTicketReservationsView>(sql).ToList();
 
                 foreach (var item in _AirTicketReservations)
                 {
-                    if (item.FlightsDescription.Contains("\r\n"))
+                    if (item.FlightsDescription.Contains("\n"))
                     {
-                        var spilitArr = Regex.Split(item.FlightsDescription, "\r\n");
+                        var spilitArr = Regex.Split(item.FlightsDescription, "\n");
                         int rowindex = 1;
                         foreach (var spilitItem in spilitArr)
                         {
@@ -366,11 +375,17 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     var DeleClient = await _sqlSugar.SqlQueryable<Grp_AirTicketReservations>(selectSql).FirstAsync();//查询是否存在
                     if (DeleClient != null)
                     {
-                        return result = new Result() { Code = -1, Msg = "该客户已存在,请勿重复添加!" };
+                        return result = new Result() { Code = -1, Msg = "该机票信息已存在,请勿重复添加!" };
                     }
                     else//不存在,可添加
                     {
-
+                        //grp_AirTicket.ArrivedTime = "";
+                        //grp_AirTicket.LeaveDescription = "";
+                        //grp_AirTicket.FlightsDescription = "";
+                        //grp_AirTicket.DeleteUserId = 0;
+                        //grp_AirTicket.DeleteTime = "";
+                        //grp_AirTicket.ReturnDescription = "";
+                        grp_AirTicket.FlightsDate= DateTime.Parse(grp_AirTicket.FlightsDate).ToString("yyyy-MM-dd");
                         id = await AddAsyncReturnId(grp_AirTicket);
                         if (id == 0)
                         {
@@ -518,7 +533,12 @@ namespace OASystem.Infrastructure.Repositories.Groups
                             return result = new Result() { Code = -1, Msg = "添加失败!" };
 
                         }
+                        await UpdateAsync(a => a.Id == id, a => new Grp_AirTicketReservations
+                        {
+                            FlightsDescription = dto.AirTicketResOpData.FlightsDescription,
+                        });
                         CommitTran();
+                        
                         return result = new Result() { Code = 0, Msg = "添加成功!" };
                         //C表操作
                     }

+ 10 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/DecreasePaymentsRepository.cs

@@ -34,9 +34,18 @@ namespace OASystem.Infrastructure.Repositories.Groups
             Result result = new Result() { Code = -2, Msg = "未知错误" };
             try
             {
+                string UserId = "";
+                List<Grp_GroupsTaskAssignment> gtaUIdList = _sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(a => a.DIId == dto.DiId && a.IsDel == 0 && a.CTId == 98).ToList();
+                foreach (Grp_GroupsTaskAssignment gta in gtaUIdList)
+                    UserId += gta.UId + ",";
+
+                if (!string.IsNullOrWhiteSpace(UserId))
+                {
+                    UserId = UserId.Substring(0, UserId.Length - 1);
+                }
                 string sql = string.Format(@"select Id,DiId,PriceName,Price,(select name from Sys_SetData where id=s.Currency) as Currency,FilePath,
                                             (select CnName from Sys_Users where Id=s.CreateUserId) as 'CreateUserName',CreateTime,(select IsAuditGM from 
-                                            Grp_CreditCardPayment where CTable=98 and CId=s.Id and IsDel=0) as 'isAudit' from Grp_DecreasePayments s where DIID={0} and IsDel=0 ", dto.DiId);
+                                            Grp_CreditCardPayment where CTable=98 and CId=s.Id and IsDel=0) as 'isAudit' from Grp_DecreasePayments s where DIID={0} and IsDel=0 and s.CreateUserId in ({1}) ", dto.DiId,UserId);
                 List<DecreasePaymentsView> _DecreasePayments = await _sqlSugar.SqlQueryable<DecreasePaymentsView>(sql).ToListAsync();
                 if (_DecreasePayments.Count != 0)
                 {

+ 83 - 9
OASystem/OASystem.Infrastructure/Repositories/Groups/DelegationVisaRepository.cs

@@ -1,4 +1,5 @@
-using OASystem.Domain.Dtos.Groups;
+using Aspose.Words.Lists;
+using OASystem.Domain.Dtos.Groups;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Domain.ViewModels.Resource;
@@ -54,7 +55,7 @@ From DelegationInfo With(Nolock) {2}
             return rst;
         }
 
-        public List<DelegationVisaPersonView> GetDelegationPersonList(int diid)
+        public List<DelegationVisaProgressView> GetDelegationProgressList(int diid)
         {
             ChangeDataBase(DBEnum.OA2014DB);
 
@@ -64,27 +65,100 @@ Diid,
 LastName,
 [Name] as 'FirstName'
 From DeleClient With(Nolock) Where Diid = {0} And IsDel = 0 ", diid);
-            List<DelegationVisaPersonView> clientList = _sqlSugar.SqlQueryable<DelegationVisaPersonView>(sqlDeleClient).ToList();
+            List<DelegationVisaProgressView> clientList = _sqlSugar.SqlQueryable<DelegationVisaProgressView>(sqlDeleClient).ToList();
 
             string sqlDelegation = string.Format(@" Select * From DelegationInfo With(Nolock) Where Id = {0} ", diid);
             OA2021_DelegationInfo delegationInfo = _sqlSugar.SqlQueryable<OA2021_DelegationInfo>(sqlDelegation).First();
-            string countryName = delegationInfo.VisitCountry;
+            //string countryName = delegationInfo.VisitCountry;
+
 
+            #region 检查与配置
 
-            #region 配置
+            ChangeDataBase(DBEnum.OA2023DB);
 
+            string sqlCheck = string.Format(@" Select * From Grp_VisaProgressCustomer With(Nolock) Where DiId = {0} ", diid);
+            List<Grp_VisaProgressCustomer> listVisaPro = _sqlSugar.SqlQueryable<Grp_VisaProgressCustomer>(sqlCheck).ToList();
+            if (listVisaPro.Count < 1)
+            {
+                //listVisaPro = new List<Grp_VisaProgressCustomer>(initVisitCountry(diid, delegationInfo));
+                initVisitCountry(diid, delegationInfo);
+            }
             #endregion
 
-            return null;
+            string sqlView1 = string.Format(@" Select 
+Id as 'ProgressViewId',
+DiId,
+CustomerId,
+LastName,
+FirstName,
+Country,
+WorkStatus as 'StatusSign'
+From Grp_VisaProgressCustomer With(Nolock) Where DiId = {0} And IsDel = 0 ", diid);
+
+            List<DelegationVisaProgressView> result = _sqlSugar.SqlQueryable<DelegationVisaProgressView>(sqlView1).ToList();
+
+            //查询各子项行数
+            foreach (var pro in result)
+            {
+                string sqlCheckCount = string.Format(@" Select PicType,Count(PicType) PicTypeCount 
+From Grp_VisaProgressCustomerPicture Where VisaProgressCustomerId = {0}
+Group by PicType Order By PicType ", pro.ProgressViewId);
+
+                List<dynamic> tempList = _sqlSugar.SqlQueryable<dynamic>(sqlCheckCount).ToList();
+                DelegationVisaPicCountList countList = new DelegationVisaPicCountList();
+
+                foreach (var item in tempList)
+                {
+                    int tempCount = item.PicTypeCount;
+                    switch (item.PicType)
+                    {
+                        case 0: countList.FirstPageCount = tempCount; break;
+                        case 1: countList.DocumentsCount = tempCount; break;
+                        case 2: countList.ExemptionCount = tempCount; break;
+                        case 3: countList.DispatchCount = tempCount; break;
+                        case 4: countList.VisaCount = tempCount; break;
+                        case 5: countList.InvoiceCount = tempCount; break;
+                        default:break;
+                    }
+                }
+                countList.totalCount();
+                pro.PicCountList = countList;
+            }
+
+            return result;
         }
 
-        public int initVisitCountry(int diid)
+        public void initVisitCountry(int diid, OA2021_DelegationInfo delegationInfo)
         {
+            ChangeDataBase(DBEnum.OA2014DB);
+            string sqlDeleClient = String.Format(@" Select * From DeleClient With(Nolock) Where diid = {0} ", diid);
+            List<OA2021_DeleClient> listDeleClient = _sqlSugar.SqlQueryable<OA2021_DeleClient>(sqlDeleClient).ToList();
             ChangeDataBase(DBEnum.OA2023DB);
 
-            string sqlCheck = string.Format(@" Select * From  ");
+            List<Grp_VisaProgressCustomer> listVisaCustomer = new List<Grp_VisaProgressCustomer>();
+
+            string countryName = delegationInfo.VisitCountry;
+            string[] countrys = Regex.Replace(countryName, @"[,,|-、\s丶]", ",", RegexOptions.IgnoreCase).Split(',');
+
+
+            foreach (var client in listDeleClient)
+            {
+                foreach (string cname in countrys)
+                {
+                    Grp_VisaProgressCustomer item = new Grp_VisaProgressCustomer();
+                    item.Country = cname;
+                    item.CreateUserId = -3;
+                    item.CustomerId = 0;
+                    item.DiId = diid;
+                    item.FirstName = client.Name;
+                    item.LastName = client.LastName;
+                    item.WorkStatus = 0;
+                    listVisaCustomer.Add(item);
+                }
+            }
 
-            return 0;
+            _sqlSugar.Insertable(listVisaCustomer).UseParameter().ExecuteCommand();
+            //return listVisaCustomer;
         }
 
     }

+ 10 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/InvitationOfficialActivitiesRepository.cs

@@ -117,12 +117,22 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     sqlWhere += string.Format(@" And i.InviteTime between '{0}' and '{1}'", dto.StartInviteTime, dto.EndInviteTime);
                 }
                 sqlWhere += string.Format(@" And i.DiId={0} And i.IsDel={1}", dto.DiId, 0);
+                string UserId = "";
+                List<Grp_GroupsTaskAssignment> gtaUIdList = _sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(a => a.DIId == dto.DiId && a.IsDel == 0 && a.CTId == 81).ToList();
+                foreach (Grp_GroupsTaskAssignment gta in gtaUIdList)
+                    UserId += gta.UId + ",";
 
+                if (!string.IsNullOrWhiteSpace(UserId))
+                {
+                    UserId = UserId.Substring(0, UserId.Length - 1);
+                }
+                sqlWhere += string.Format(@" And i.CreateUserId in ({0})", UserId);
                 if (!string.IsNullOrEmpty(sqlWhere.Trim()))
                 {
                     Regex r = new Regex("And");
                     sqlWhere = r.Replace(sqlWhere, "Where", 1);
                 }
+                
                 string sql = string.Format(@"select Id,DiId,InviterArea,Inviter,InviteTime,InviteCosts,(select name from Sys_SetData where id=i.Currency and IsDel={0}) 
                                              as Currency,IsGoOfficaiaBussiness,(select IsAuditGM from Grp_CreditCardPayment where CTable=81 and CId=i.Id 
                                              and IsDel={0}) as 'isAudit',Attachment from Grp_InvitationOfficialActivities i  {1}", 0, sqlWhere);