立航 饭 před 3 týdny
rodič
revize
375ac9aa9f

+ 14 - 12
2.Data/SMP.Data/Finance/IFinance_Logistics_LadingBillRepository.cs

@@ -33,7 +33,7 @@ namespace SMP.Data.Finance
         Task ClearIncidentals(int LadingBillId, AmountType amountType = AmountType.应付);
 
         Task<IEnumerable<Finance_Logistics_LadingBill>> QueryByLadingBillNumbers(IEnumerable<string> ladingBillNumbers);
-        Task<IEnumerable<LadingBillCost>> GetLadingBillCost(int month, int publicId);
+        Task<IEnumerable<LadingBillCost>> GetLadingBillCost(string month, int publicId);
         #endregion
         #region 订单成本(作废)
         //Task CreateCostTable(string BillTypeCode);
@@ -117,32 +117,34 @@ where rowNum=1 ");
         }
 
         [NonTrans]
-        public async Task<IEnumerable<LadingBillCost>> GetLadingBillCost(int month,int publicId)
+        public async Task<IEnumerable<LadingBillCost>> GetLadingBillCost(string month, int publicId)
         {
-            DateTime start = new DateTime(DateTime.Now.Year, month, 1);
+            DateTime start = DateTime.Parse(month + "-01");
             DateTime end = start.AddMonths(1);
-            string sql = @" with t1 as(
-                         select b.LadingBillNumber,f.Name,sum(c.SettlementAmount)SettlementAmount,CONVERT(nvarchar(7),ReceiveTime,120 ) as [Month]  from 
+            string sql = @"  with t1 as(
+                         select b.LadingBillNumber,g.BillName,f.Name,sum(c.SettlementAmount)SettlementAmount,CONVERT(nvarchar(7),ReceiveTime,120 ) as [Month]  from 
                         (select LadingBillNumber 
-	                        from Logistisc_Order(nolock) where PublicChannelId = @publicId and ReceiveTime between @start and @end
+	                        from Logistisc_Order(nolock) where PublicChannelId=@publicId and ReceiveTime between @start and @end
                         group by LadingBillNumber)as a 
-                        join Logistisc_Order(nolock)b on PublicChannelId =@publicId and a.LadingBillNumber=b.LadingBillNumber
+                        join Logistisc_Order(nolock)b on  PublicChannelId=@publicId and  a.LadingBillNumber=b.LadingBillNumber
                         join Compute_ExpenseAmount(nolock)c on c.Number = b.SystemNo and c.CostType=1
                         join Compute_ExpenseAmountBatchOperation(nolock) d on d.BatchNo = c.BatchNo
                         join Compute_ExpenseItem(nolock)e on c.ExpenseItemId=e.Id
                         join Compute_ExpenseItemCategory(nolock)f on f.Id=e.CategoryId
-                          group by b.LadingBillNumber,f.Name,CONVERT(nvarchar(7),ReceiveTime,120 ))
+                        left join Finance_ServiceBillSpreadApply(nolock)g on g.Id = c.ServiceBillSpreadApplyId
+                          group by g.BillName,b.LadingBillNumber,f.Name,CONVERT(nvarchar(7),ReceiveTime,120 ))
 
                           select * from (
-	                        select 提单=LadingBillNumber,类目=Name,费用=SettlementAmount,月份=[MONTH] from t1
+	                        select 提单=LadingBillNumber,类目=Name,费用=SettlementAmount,月份=[MONTH],账单=BillName from t1
+	                        where Name <>'尾程派送费' and Name<>'全程派送费用'
                           )a
                           pivot
                          (
-	                        sum(a.费用) for a.类目 in(空运成本,尾程派送费,海外清关,出口报关,全程派送费用,中转成本)
+	                        sum(a.费用) for a.类目 in(空运成本,海外清关,出口报关,中转成本)
                          )p
-                         order by 提单,月份
+ order by 账单,提单,月份 
                     ";
-            var result = await _unitOfWork.Connection.QueryAsync<LadingBillCost>(sql, new { start, end, publicId }, _unitOfWork.Transaction, null);
+            var result = await _unitOfWork.Connection.QueryAsync<LadingBillCost>(sql, new { start, end, publicId }, _unitOfWork.Transaction, 60);
             return result;
         }
 

+ 15 - 7
2.Data/SMP.Model/Report/LadingBillCost.cs

@@ -10,22 +10,30 @@ namespace SMP.Model.Report
     {
         public string 提单 { get; set; }
 
-        public string 月份 { get; set;
+        public string 月份
+        {
+            get; set;
         }
 
-        public string 空运成本 { get; set;
+        public string 账单
+        {
+            get; set;
         }
 
-        public string 尾程派送费 { get; set;
+        public string 空运成本
+        {
+            get; set;
         }
 
-        public string 海外清关 { get; set;
+
+        public string 海外清关
+        {
+            get; set;
         }
 
-        public string 出口报关 { get; set;}
+        public string 出口报关 { get; set; }
 
-        public string 全程派送费用 { get; set;}
 
-        public string 中转成本 { get; set;}
+        public string 中转成本 { get; set; }
     }
 }

+ 2 - 1
3.Service/SMP.Service/Finance/IServiceBillSpreadService.cs

@@ -506,7 +506,8 @@ namespace SMP.Service.Finance
             decimal settlementAmount = originAmount * rate.ToCNY;
             decimal settlementRate = rate.ToCNY;
 
-            ComputeAmountResult amountResult = CreateComputeAmountResult(firstData, expense, billTime, financialTime, originAmount, originCurrency, settlementCurrency, settlementRate, settlementAmount, expenseItemId);
+            ComputeAmountResult amountResult = CreateComputeAmountResult(firstData, expense, billTime,
+                financialTime, originAmount, originCurrency, settlementCurrency, settlementRate, settlementAmount, expenseItemId);
             string ladingbillNumber = ladingBillOrders.FirstOrDefault()?.LadingBillNumber;
             ApportionComputeRecordInput input = new ApportionComputeRecordInput
             {

+ 2 - 2
3.Service/SMP.Service/Report/ICostProfitReportService.cs

@@ -37,7 +37,7 @@ namespace SMP.Service.Report
 
         Task<byte[]> DownPeriodCostProfitReportV(QueryModel queryModel);
         Task<byte[]> DownCheckDataReport(CheackDataQuery param);
-        Task<MemoryStream> OutLoaddingCost(int channelId, int month);
+        Task<MemoryStream> OutLoaddingCost(int channelId, string month);
     }
 
     public class CostProfitReportService : ICostProfitReportService
@@ -540,7 +540,7 @@ namespace SMP.Service.Report
             #endregion
         }
 
-        public async Task<MemoryStream> OutLoaddingCost(int channelId, int month)
+        public async Task<MemoryStream> OutLoaddingCost(int channelId, string month)
         {
 
             var list = await finance_Logistics_LadingBillRepository.GetLadingBillCost(month, channelId);

+ 1 - 1
4.Api/SMP.Api.Base/Controllers/Report/ReportController.cs

@@ -88,7 +88,7 @@ namespace SMP.Api.Base.Controllers.Report
         }
         [AllowAnonymous] 
         [HttpGet]
-        public async Task<IActionResult> DownLoaddingCostReport(int channelId, int month)
+        public async Task<IActionResult> DownLoaddingCostReport(int channelId, string month)
         {
             var allPublicChannels = await _baseInfoService.CacheGetAllPublicChannels();
             var publicChannel = allPublicChannels.FirstOrDefault(i => i.Id == channelId);