Pārlūkot izejas kodu

PostEnterExitCostSubItemDel
Update

leiy 1 gadu atpakaļ
vecāks
revīzija
fc14a3ecd4

+ 42 - 80
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -566,86 +566,7 @@ namespace OASystem.API.Controllers
                 //    GWCAveragePrice = (GWCCNYTotalPrice / GWCPeopleNum).ConvertToDecimal1();
                 //}
                
-                int Index = 0;
-                foreach (var item in groupAirFeeViews)
-                {
-                    if (item.AirId > 2924)
-                    {
-                        string itemClientName = "";
-                        if (!string.IsNullOrEmpty(item.ClientName))
-                        {
-                            string[] clientIds = new string[] { };
-                            if (item.ClientName.Contains(','))
-                            {
-                                clientIds = item.ClientName.Split(',');
-                            }
-                            else
-                            {
-                                clientIds = new string[] { item.ClientName };
-                            }
-                            if (clientIds.Length > 0)
-                            {
-                                int[] output = Array.ConvertAll<string, int>(clientIds, delegate (string s) { return int.Parse(s); });
-
-                                if (output.Contains(-1))
-                                {
-                                    itemClientName += $@"行程单";
-                                    output = output.Where(val => val != -1).ToArray();
-                                }
-
-                                var clients = _clientDatas.Where(it => output.Contains(it.Id)).ToList();
-                                decimal unitCost = 0.00M;
-                                unitCost = (item.PayMoney / item.ClientNum).ConvertToDecimal1();
-
-                                int clienIndex = 1;
-                                foreach (var client in clients)
-                                {
-                                    airClientPris.Add(new {
-                                        CnName = client.LastName+client.FirstName,
-                                        EnName = client.Pinyin,
-                                        Price = unitCost,
-                                        AirType = item.AirTypeName
-                                    });
-
-                                    string six = "";
-                                    if (client.Sex == 0) six = "Mr";
-                                    else if (client.Sex == 1) six = "Ms";
-
-                                    itemClientName += string.Format(@"{0}.{1} {2};", clienIndex, client.LastName + client.FirstName, six);
-                                    clienIndex++;
-                                }
-                            }
-                        }
-                        item.ClientName = itemClientName;
-                    }
-                    else
-                    {
-                        string clientPinYinName = "";
-                        decimal unitCost = 0.00M;
-                        unitCost = (item.PayMoney / item.ClientNum).ConvertToDecimal1();
-
-                        string[] clientNames = item.ClientName.Split('.');
-                        for (int i = 0; i < item.ClientNum; i++)
-                        {
-                            string name = "";
-                            if (clientNames.Length > 0)
-                            {
-                                int index = i + 1;
-                                if (index < clientNames.Length)
-                                {
-                                    name = clientNames[index].Replace("MR","").Replace("MS","");
-                                }
-                            }
-                            
-                            clientPinYinName += string.Format(@"{0}.{1}出票价为:{2} CNY;", Index, name, unitCost);
-                        }
-                    }
-                    if (!string.IsNullOrEmpty(item.AuditGMDate))
-                    {
-                        item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss");
-                    }
-                    AirCNYTotalPrice += item.CNYPrice;
-                }
+                
 
                 _geView.GroupAirFeeViews = groupAirFeeViews;
                 if (airClientPris.Count > 0)
@@ -704,6 +625,47 @@ namespace OASystem.API.Controllers
                     }
                 }
 
+                if (string.IsNullOrEmpty(str))
+                {
+                    List<string> _clientNames = new List<string>();
+                    foreach (var item in groupAirFeeViews)
+                    {
+                        Regex r = new Regex("[0-9]");
+                        string[] ClientName = r.Replace(item.ClientName, "|").Split('|');
+
+                        foreach (var C in ClientName)
+                        {
+                            if (!string.IsNullOrWhiteSpace(C) && !C.Trim().Contains("行程单"))
+                            {
+                                string C1 = C.Replace("Mr", "").Replace("MR", "").Replace("mR", "").Replace("mr", "").Replace("Ms", "").Replace("MS", "").Replace("mS", "").Replace("ms", "");
+                                C1 = C1.Replace(".", "").Trim();
+                                if (!_clientNames.Contains(C1))
+                                {
+                                    _clientNames.Add(C1);
+                                }
+                                
+                            }
+                        }
+                    }
+
+                    int index = 1;
+                    foreach (var item in _clientNames)
+                    {
+                        decimal CountCost = 0.00M;
+                        foreach (var Air in groupAirFeeViews)
+                        {
+                            if (Air.ClientName.Trim().Contains(item))
+                            {
+                                CountCost += Convert.ToDecimal((Air.PayMoney * Air.DayRate).ToString(").00"));
+                            }
+                        }
+                        index++;
+
+                        str += $"{index}. {item} 出票价为: { CountCost.ToString("#0.00")}CNY;";
+                    }
+
+                }
+
                 _geView.GroupAirFeeStr = $@"人民币总费用:{AirCNYTotalPrice.ToString("#0.00")} CNY\r\n{str}\r\n经济舱均价为:{JJCAveragePrice.ToString("#0.00")}CNY/人;公务舱均价为:{GWCAveragePrice.ToString("#0.00")}CNY/人;";
                 #endregion
 

+ 8 - 9
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs

@@ -191,16 +191,15 @@ namespace OASystem.Infrastructure.Repositories.Groups
         {
             Result result = new Result();
 
+            var data = new Grp_DayAndCost()
+            {
+                Id = dto.Id,
+                IsDel = 1,
+                DeleteUserId = dto.DeleteUserId,
+                DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")
+            };
 
-            var del = await _sqlSugar.Updateable<Grp_DayAndCost>()
-                .SetColumns(it => new Grp_DayAndCost()
-                {
-                    IsDel = 1,
-                    DeleteUserId = dto.DeleteUserId,
-                    DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")
-                })
-                .Where(it => it.Id == dto.Id)
-                .ExecuteCommandAsync();
+            var del = _sqlSugar.Updateable(data).UpdateColumns(it => new { it.IsDel, it.DeleteUserId,it.DeleteTime }).ExecuteCommand();
 
             if (del > 0) result.Code = 0;
             else result.Msg = string.Format("删除失败!");