|
@@ -15,6 +15,7 @@ using XYY.Common.Standard;
|
|
|
using XYY.Core.Standard.ExcelHelper.MSExcelHelper;
|
|
|
using XYY.Core.Standard.Mvc;
|
|
|
using XYY.Model.Standard.Finance;
|
|
|
+using XYY.Model.Standard.MpsOrder.dto;
|
|
|
using XYY.Service.Standard.Customer;
|
|
|
using XYY.Service.Standard.Finance;
|
|
|
|
|
@@ -112,45 +113,84 @@ namespace XYY.Api.Finance.Controllers
|
|
|
|
|
|
}
|
|
|
|
|
|
- public async Task<IActionResult> InputFinanceCustomerSupplements(FinanceCustomerSupplementOrDeductionType type,
|
|
|
- string url, string month, bool isNewFee,
|
|
|
- string currencyCode = "CNY")
|
|
|
+
|
|
|
+
|
|
|
+ public async Task<IActionResult> InputFinanceCustomerSupplements(
|
|
|
+ FinanceCustomerSupplementOrDeductionType type,
|
|
|
+ string url,
|
|
|
+ string month,
|
|
|
+ bool isNewFee,
|
|
|
+ string currencyCode = "CNY",
|
|
|
+ SupplementTargetType targetValue = SupplementTargetType.全部)
|
|
|
{
|
|
|
- System.Net.WebClient client = new System.Net.WebClient();
|
|
|
- byte[] data = client.DownloadData(url);
|
|
|
- MSExcelHelper excelHelper = new MSExcelHelper();
|
|
|
- var list = excelHelper.LoadDataByByte<CustomerSupplementMapping, Finance_Customer_Supplement>(data);
|
|
|
- foreach (var item in list)
|
|
|
- {
|
|
|
- item.CurrenyRate = currencyCode;
|
|
|
- }
|
|
|
+ List<Finance_Customer_Supplement> list = new List<Finance_Customer_Supplement>();
|
|
|
var nsmpCustomers = await customerService.GetNSMPCustomer();
|
|
|
- FinanceCustomerSupplementOrDeductionType financeCustomerSupplementType = type;
|
|
|
- list.ForEach(x =>
|
|
|
+ if (type == FinanceCustomerSupplementOrDeductionType.补_通用杂费)
|
|
|
{
|
|
|
- x.FinanceCustomerSupplementType = type;
|
|
|
- if (x.FinanceCustomerSupplementType == FinanceCustomerSupplementOrDeductionType.补_退件费)
|
|
|
- {
|
|
|
- x.Describe = "退件费";
|
|
|
- }
|
|
|
- else if (x.FinanceCustomerSupplementType == FinanceCustomerSupplementOrDeductionType.补_重派费)
|
|
|
+ System.Net.WebClient client = new System.Net.WebClient();
|
|
|
+ byte[] data = client.DownloadData(url);
|
|
|
+ MSExcelHelper excelHelper = new MSExcelHelper();
|
|
|
+ var fees = excelHelper.LoadDataByByte<OtherFeeSupplementMapping, Finance_Customer_Supplement>(data);
|
|
|
+ foreach (var item in fees)
|
|
|
{
|
|
|
- x.Describe = "重派费";
|
|
|
+ item.CurrenyRate = currencyCode;
|
|
|
+ item.Describe = item.AvgFee + item.CurrenyRate + "*" + item.Qty;
|
|
|
+ item.CurrenyRate = currencyCode;
|
|
|
+ item.SupplementTargetType = (int)targetValue;
|
|
|
+ item.FinanceCustomerSupplementType = type;
|
|
|
+ item.FeeString = item.Fee + item.CurrenyRate;
|
|
|
+ list.Add(item);
|
|
|
}
|
|
|
- else if (x.FinanceCustomerSupplementType == FinanceCustomerSupplementOrDeductionType.扣_重量差异费)
|
|
|
+
|
|
|
+ await this.supplementService.InputFinanceCustomerSupplements(type, list);
|
|
|
+ var nsmpList2 = list.Where(x => nsmpCustomers.Contains(x.CustomerId)).ToList();
|
|
|
+ if (nsmpList2.Count() != 0)
|
|
|
{
|
|
|
- x.Describe = "重量差异费";
|
|
|
+ await this.supplementService.InputFinanceCustomerSupplementsNew(type, nsmpList2);
|
|
|
}
|
|
|
- else if (x.FinanceCustomerSupplementType == FinanceCustomerSupplementOrDeductionType.扣_时间差异费)
|
|
|
+ return Ok();
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ System.Net.WebClient client = new System.Net.WebClient();
|
|
|
+ byte[] data = client.DownloadData(url);
|
|
|
+ MSExcelHelper excelHelper = new MSExcelHelper();
|
|
|
+ excelHelper.LoadDataByByte<CustomerSupplementMapping, Finance_Customer_Supplement>(data);
|
|
|
+ foreach (var item in list)
|
|
|
{
|
|
|
- x.Describe = "时间差异费";
|
|
|
+ item.CurrenyRate = currencyCode;
|
|
|
+ item.SupplementTargetType = (int)type;
|
|
|
+ item.FinanceCustomerSupplementType = type;
|
|
|
}
|
|
|
- else if (x.FinanceCustomerSupplementType == FinanceCustomerSupplementOrDeductionType.扣_索赔)
|
|
|
+ FinanceCustomerSupplementOrDeductionType financeCustomerSupplementType = type;
|
|
|
+ list.ForEach(x =>
|
|
|
{
|
|
|
- x.Describe = "索赔费用";
|
|
|
- }
|
|
|
- x.Month = month;
|
|
|
- });
|
|
|
+ x.FinanceCustomerSupplementType = type;
|
|
|
+ if (x.FinanceCustomerSupplementType == FinanceCustomerSupplementOrDeductionType.补_退件费)
|
|
|
+ {
|
|
|
+ x.Describe = "退件费";
|
|
|
+ }
|
|
|
+ else if (x.FinanceCustomerSupplementType == FinanceCustomerSupplementOrDeductionType.补_重派费)
|
|
|
+ {
|
|
|
+ x.Describe = "重派费";
|
|
|
+ }
|
|
|
+ else if (x.FinanceCustomerSupplementType == FinanceCustomerSupplementOrDeductionType.扣_重量差异费)
|
|
|
+ {
|
|
|
+ x.Describe = "重量差异费";
|
|
|
+ }
|
|
|
+ else if (x.FinanceCustomerSupplementType == FinanceCustomerSupplementOrDeductionType.扣_时间差异费)
|
|
|
+ {
|
|
|
+ x.Describe = "时间差异费";
|
|
|
+ }
|
|
|
+ else if (x.FinanceCustomerSupplementType == FinanceCustomerSupplementOrDeductionType.扣_索赔)
|
|
|
+ {
|
|
|
+ x.Describe = "索赔费用";
|
|
|
+ }
|
|
|
+ x.Month = month;
|
|
|
+ });
|
|
|
+ }
|
|
|
await this.supplementService.InputFinanceCustomerSupplements(type, list);
|
|
|
var nsmpList = list.Where(x => nsmpCustomers.Contains(x.CustomerId)).ToList();
|
|
|
if (nsmpList.Count() != 0)
|
|
@@ -166,6 +206,27 @@ namespace XYY.Api.Finance.Controllers
|
|
|
return Ok(items);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public class OtherFeeSupplementMapping : MSExcelClassMapping<Finance_Customer_Supplement>
|
|
|
+ {
|
|
|
+ public OtherFeeSupplementMapping()
|
|
|
+ {
|
|
|
+ Map(x => x.SystemNo).Name("订单编号");
|
|
|
+ Map(x => x.TrackingNumber).Name("订单编号");
|
|
|
+ Map(x => x.CustomerOrderNo).Name("订单编号");
|
|
|
+ Map(x => x.CreateTime).Name("业务时间");
|
|
|
+ Map(x => x.CustomerName).Name("客户");
|
|
|
+ Map(x => x.SMPDetailType).Name("费用名称");
|
|
|
+ Map(x => x.AvgFee).Name("单价");
|
|
|
+ Map(x => x.Qty).Name("数量");
|
|
|
+ Map(x => x.Fee).Name("金额");
|
|
|
+ Map(x => x.OrderRemark).Name("备注");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public class CustomerSupplementMapping : MSExcelClassMapping<Finance_Customer_Supplement>
|
|
|
{
|
|
|
public CustomerSupplementMapping()
|