Commit 2d82b1b1 by zhouminghui

亚马逊凭证

parent 0fa5b991
...@@ -4,4 +4,10 @@ ...@@ -4,4 +4,10 @@
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="10.0.1" />
<PackageReference Include="NPOI" Version="2.4.1" />
<PackageReference Include="StackExchange.Redis" Version="2.1.28" />
</ItemGroup>
</Project> </Project>
using Newtonsoft.Json;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Common
{
public class RedisHelper
{
public static string RedisServiceAddr = "localhost:6379";
public static ConnectionMultiplexer Redis { get; set; }
static RedisHelper()
{
Redis = ConnectionMultiplexer.Connect(RedisServiceAddr);
}
/// <summary>
/// 获取缓存
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static string GetString(string key)
{
using (var conn = ConnectionMultiplexer.Connect(RedisServiceAddr))
{
var db = conn.GetDatabase();
return db.StringGet(key);
}
}
/// <summary>
/// 获取缓存(序列化)
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <returns></returns>
public static List<T> GetList<T>(string key)
{
using (var conn = ConnectionMultiplexer.Connect(RedisServiceAddr))
{
var db = conn.GetDatabase();
var value = db.StringGet(key);
return value.HasValue ? JsonConvert.DeserializeObject<List<T>>(value) : new List<T>();
}
}
/// <summary>
/// 添加
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="value"></param>
/// <returns></returns>
public static bool Add<T>(string key, T value)
{
using (var conn = ConnectionMultiplexer.Connect(RedisServiceAddr))
{
var db = conn.GetDatabase();
return db.StringSet(key, JsonConvert.SerializeObject(value));
}
}
/// <summary>
/// 添加(带过期时间)
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="value"></param>
/// <param name="expire"></param>
/// <returns></returns>
public static bool Add<T>(string key, T value, TimeSpan expire)
{
using (var conn = ConnectionMultiplexer.Connect(RedisServiceAddr))
{
var db = conn.GetDatabase();
return db.StringSet(key, JsonConvert.SerializeObject(value), expire);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.Voucher
{
public class QueryDtos
{
public string Site { get; set; }
public string TitleName { get; set; }
public decimal Amount { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.Voucher
{
/// <summary>
/// 各站点对应的表头标题。用于转换数据
/// </summary>
public class SiteTitleEntity
{
public string type { get; set; }
public string product_sales { get; set; }
public string shipping_credits { get; set; }
public string gift_wrap_credits { get; set; }
public string selling_fees { get; set; }
public string promotional_rebates { get; set; }
public string other_transaction_fees { get; set; }
public string fulfillment { get; set; }
/// <summary>
/// UK站点
/// </summary>
public string fulfilment { get; set; }
public string fba_fees { get; set; }
public string other { get; set; }
public string total { get; set; }
public string description { get; set; }
public string product_sales_tax { get; set; }
public string postage_credits { get; set; }
public string shipping_credits_tax { get; set; }
public string giftwrap_credits_tax { get; set; }
public string Typ { get; set; }
public string Umsätze { get; set; }
public string Produktumsatzsteuer { get; set; }
public string Gutschrift_für_Versandkosten { get; set; }
public string Steuer_auf_Versandgutschrift { get; set; }
public string Gutschrift_für_Geschenkverpackung { get; set; }
public string Steuer_auf_Geschenkverpackungsgutschriften { get; set; }
public string Rabatte_aus_Werbeaktionen { get; set; }
public string Steuer_auf_Aktionsrabatte { get; set; }
public string Verkaufsgebühren { get; set; }
public string Gebühren_zu_Versand_durch_Amazon { get; set; }
public string Andere_Transaktionsgebühren { get; set; }
public string Andere { get; set; }
public string Gesamt { get; set; }
public string Versand { get; set; }
public string promotional_rebates_tax { get; set; }
public string ventes_de_produits { get; set; }
public string Taxes_sur_la_vente_des_produits { get; set; }
public string crédits_d_expédition { get; set; }
public string taxe_sur_les_crédits_d_expédition { get; set; }
public string crédits_sur_l_emballage_cadeau { get; set; }
public string Taxes_sur_les_crédits_cadeaux { get; set; }
public string Rabais_promotionnels { get; set; }
public string Taxes_sur_les_remises_promotionnelles { get; set; }
public string frais_de_vente { get; set; }
public string traitement { get; set; }
public string Frais_Expédié_par_Amazon { get; set; }
public string autres_frais_de_transaction { get; set; }
public string autre { get; set; }
public string Vendite { get; set; }
public string totale { get; set; }
public string imposta_sulle_vendite_dei_prodotti { get; set; }
public string Accrediti_per_le_spedizioni { get; set; }
public string imposta_accrediti_per_le_spedizioni { get; set; }
public string Accrediti_per_confezioni_regalo { get; set; }
public string imposta_sui_crediti_confezione_regalo { get; set; }
public string Sconti_promozionali { get; set; }
public string imposta_sugli_sconti_promozionali { get; set; }
public string Commissioni_di_vendita { get; set; }
public string Costi_del_servizio_Logistica_di_Amazon { get; set; }
public string Altri_costi_relativi_alle_transazioni { get; set; }
public string Altro { get; set; }
public string Tipo { get; set; }
public string Gestione { get; set; }
public string ventas_de_productos { get; set; }
public string abonos_de_envío { get; set; }
public string impuestos_por_abonos_de_envío { get; set; }
public string abonos_de_envoltorio_para_regalo { get; set; }
public string devoluciones_promocionales { get; set; }
public string tarifas_de_venta { get; set; }
public string tarifas_de_Logística_de_Amazon { get; set; }
public string tarifas_de_otras_transacciones { get; set; }
public string otro { get; set; }
public string gestión_logística { get; set; }
public string tipo { get; set; }
public string totaal { get; set; }
public string verkoop_van_producten { get; set; }
public string Verzendtegoeden { get; set; }
public string promotiekortingen { get; set; }
public string verkoopkosten { get; set; }
public string fba_vergoedingen { get; set; }
public string overige_transactiekosten { get; set; }
public string overige { get; set; }
public string totalt { get; set; }
public string försäljning_av_produkter { get; set; }
public string fraktkrediter { get; set; }
public string krediter_för_presentinslagning { get; set; }
public string kampanjrabatter { get; set; }
public string försäljningsavgifter { get; set; }
public string fba_avgifter { get; set; }
public string övriga_transaktionsavgifter { get; set; }
public string Övrigt { get; set; }
public string leverans { 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 FBA_手数料 { get; set; }
public string トランザクションに関するその他の手数料 { get; set; }
public string その他 { get; set; }
public string フルフィルメント { get; set; }
public string トランザクションの種類 { get; set; }
public string tarifas_fba { get; set; }
public string cumplimiento { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.Voucher
{
public class VoucherData
{
/// <summary>
/// FBA
/// </summary>
public decimal yongjinAmazon { get; set; } = 0;
/// <summary>
/// Seller
/// </summary>
public decimal yongjinToTal { get; set; } = 0;
/// <summary>
/// 广告费
/// </summary>
public decimal guanggaoTotal { get; set; } = 0;
/// <summary>
/// 仓储费
/// </summary>
public decimal fbacangchu { get; set; } = 0;
/// <summary>
/// 物流费(销售费用-fba物流费-尾程)
/// </summary>
public decimal TailCourseFba { get; set; } = 0;
/// <summary>
/// 货运费(销售费用-fba物流费-头程)
/// </summary>
public decimal FirstJourneyFba { get; set; } = 0;
/// <summary>
/// 销售费用
/// </summary>
public decimal salseFee { get; set; } = 0;
/// <summary>
/// 应收
/// </summary>
public decimal yingyewaiAdju { get; set; } = 0;
/// <summary>
/// 主营
/// </summary>
public decimal yingyewaiTotal { get; set; } = 0;
public string Market { get; set; }
public decimal yongjinSeller { get; set; } = 0;
public decimal yongjinSeller2 { get; set; } = 0;
public decimal yongjinSeller3 { get; set; } = 0;
public decimal yongjinSeller4 { get; set; } = 0;
public decimal yongjinSeller5 { get; set; } = 0;
public decimal guanggaoDeal { get; set; } = 0;
public decimal guanggaoService { get; set; } = 0;
public decimal guanggaoService_Sub { get; set; } = 0;
public decimal yingyewaiRefund { get; set; } = 0;
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.Voucher
{
public class VoucherTemplateEntity
{
public string 凭证ID { 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 备注1 { get; set; }
public string 备注2 { 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; }
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 自定义项1 { get; set; }
public string 自定义项2 { get; set; }
public string 自定义项3 { get; set; }
public string 自定义项4 { get; set; }
public string 自定义项5 { get; set; }
public string 自定义项6 { get; set; }
public string 自定义项7 { get; set; }
public string 自定义项8 { get; set; }
public string 自定义项9 { get; set; }
public string 自定义项10 { get; set; }
public string 自定义项11 { get; set; }
public string 自定义项12 { get; set; }
public string 自定义项13 { get; set; }
public string 自定义项14 { get; set; }
public string 自定义项15 { get; set; }
public string 自定义项16 { get; set; }
public string 现金流量项目 { get; set; }
public string 现金流量借方金额 { get; set; }
public string 现金流量贷方金额 { get; set; }
}
}
using Bailun.DC.Common;
using Bailun.DC.Services;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace Bailun.DC.Web.Areas.DataWareHouse.Controllers
{
[Area("DataWareHouse")]
public class VoucherController : Base.BaseController
{
public IActionResult Index()
{
return View();
}
#region 导出凭证
/// <summary>
/// 获取凭证信息
/// </summary>
/// <returns></returns>
public ActionResult GetVoucherList(DateTime month,string platform)
{
var data = new VoucherService().GetVoucherListNew(month, platform);
var columns = JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(data.FirstOrDefault())).Select(x => x.Key).ToList();
columns.Remove("取值列");
columns.Remove("站点");
var table = new DataTable();
foreach (var item in columns)
{
table.Columns.Add(item);
}
foreach (var dataItem in data)
{
var row = table.NewRow();
var dataObj = JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(dataItem));
var index = 0;
foreach (var dicItem in dataObj)
{
if (columns.Contains(dicItem.Key))
{
row[dicItem.Key] = dicItem.Value;
}
index++;
}
table.Rows.Add(row);
}
var filepath = Directory.GetCurrentDirectory() + "\\Files\\Report\\" + DateTime.Now.ToString("yyyyMMdd") + "\\";
var filename = $"亚马逊{month.Month}月凭证" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
ExcelHelper.DataTableToExcel(table, filepath + filename, true);
var stream = System.IO.File.OpenRead(filepath + filename);//excel表转换成流
return File(stream, "application/vnd.android.package-archive", Path.GetFileName(filepath + filename));//进行浏览器下载
}
#endregion
}
}
var baseUrl = 'http://data.bailuntec.com'; //'http://localhost:59628/';// var baseUrl = 'http://localhost:50077/';
var globalOrderSort=''; var globalOrderSort='';
var globalOrderType = ''; var globalOrderType = '';
var global_userid; var global_userid;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment