Commit 2f040936 by lizefeng

升级亚马逊长期仓储费的抓取

parent cec04702
......@@ -978,7 +978,7 @@ namespace AutoTurnOver.Services
/// <param name="data_id"></param>
public void AnaFbaLongTermStorageFeeReport(int status = 0, string report_id = "")
{
var reportTypeEnum = ReportTypes.GET_FBA_INVENTORY_PLANNING_DATA;
var reportTypeEnum = ReportTypes.GET_FBA_FULFILLMENT_LONGTERM_STORAGE_FEE_CHARGES_DATA;
var ana_task = MyMySqlConnection._connection.QueryFirstOrDefault<dc_base_amazon_fee_report_log>(" select * from dc_base_amazon_fee_report_log where report_type=@report_type and ana_status=@status order by id asc limit 1 ", new
{
report_type = reportTypeEnum.ToString(),
......@@ -1027,58 +1027,55 @@ namespace AutoTurnOver.Services
ana_task.content = jsonText;
var table = CsvFileHelper.ReadFromCSV(reportData.ReportDocumentId, true, '\t');
if (table.Columns.Contains("estimated-ltsf-next-charge") || table.Columns.Contains("estimated-storage-cost-next-month"))
foreach (DataRow row in table.Rows)
{
foreach (DataRow row in table.Rows)
try
{
try
dc_profit_business_amazon_storage_fee storageFee = new dc_profit_business_amazon_storage_fee
{
dc_profit_business_amazon_storage_fee storageFee = new dc_profit_business_amazon_storage_fee
{
currency = row.DataRowToString("currency"),
fulfillment_center = row.DataRowToString("marketplace"),
site = row.DataRowToString("marketplace"),
fee_type = "超长仓储费",
report_id = ana_task.report_id,
account = pamsAccount.Account,
asin = row.DataRowToString("asin"),
sku = row.DataRowToString("fnsku"),
report_end_date = reportData.DataEndTime ?? new DateTime(1991, 1, 1)
};
storageFee.fee = row.DataRowToNumber("estimated-ltsf-next-charge") ?? (row.DataRowToNumber("estimated-storage-cost-next-month") ??0);
storageFee._date = reportData.DataStartTime.Value.ToDayHome();
//storageFee.site = row.DataRowToString("country_code");
if ("GB".Equals(storageFee.site, StringComparison.CurrentCultureIgnoreCase))
{
storageFee.site = "UK";
}
storageFee._create_date = DateTime.Now;
storageFee._update_date = DateTime.Now;
storageFee._unique_id = $"{storageFee.asin}-{storageFee._date.ToString("yyyy-MM")}-{storageFee.site}-{storageFee.account}-{storageFee.fulfillment_center}-{storageFee.fee_type}";
var oldData = MyMySqlConnection._connection.QueryFirstOrDefault<dc_profit_business_amazon_storage_fee>(" select * from dc_profit_business_amazon_storage_fee where _unique_id=@unique_id ", new { unique_id = storageFee._unique_id });
if (oldData != null)
{
storageFee._project = oldData._project;
storageFee.business_user = oldData.business_user;
storageFee.exchange_cny = oldData.exchange_cny;
storageFee.id = oldData.id;
MyMySqlConnection._connection.Update(storageFee);
}
else
{
MyMySqlConnection._connection.Insert(storageFee);
}
currency = row.DataRowToString("country"),
fulfillment_center = row.DataRowToString("country"),
site = row.DataRowToString("country"),
fee_type = "超长仓储费",
report_id = ana_task.report_id,
account = pamsAccount.Account,
asin = row.DataRowToString("asin"),
sku = row.DataRowToString("fnsku"),
report_end_date = reportData.DataEndTime ?? new DateTime(1991, 1, 1)
};
storageFee.fee = row.DataRowToNumber("long-time-range-long-term-storage-fee") ?? 0;
storageFee._date = reportData.DataStartTime.Value.ToDayHome();
//storageFee.site = row.DataRowToString("country_code");
if ("GB".Equals(storageFee.site, StringComparison.CurrentCultureIgnoreCase))
{
storageFee.site = "UK";
}
catch (Exception ex)
storageFee._create_date = DateTime.Now;
storageFee._update_date = DateTime.Now;
storageFee._unique_id = $"{storageFee.asin}-{storageFee._date.ToString("yyyy-MM")}-{storageFee.site}-{storageFee.account}-{storageFee.fulfillment_center}-{storageFee.fee_type}";
var oldData = MyMySqlConnection._connection.QueryFirstOrDefault<dc_profit_business_amazon_storage_fee>(" select * from dc_profit_business_amazon_storage_fee where _unique_id=@unique_id ", new { unique_id = storageFee._unique_id });
if (oldData != null)
{
throw;
storageFee._project = oldData._project;
storageFee.business_user = oldData.business_user;
storageFee.exchange_cny = oldData.exchange_cny;
storageFee.id = oldData.id;
MyMySqlConnection._connection.Update(storageFee);
}
else
{
MyMySqlConnection._connection.Insert(storageFee);
}
}
catch (Exception ex)
{
throw;
}
}
ana_task.ana_error = "";
......
......@@ -57,13 +57,13 @@ namespace ResetOutofstock
//new AmazonDataSynchroService().SetMarketplaceNameByDate();
//new AmazonDataSynchroService().SynchroReportIds();
//new AmazonDataSynchroService().SynchroReportIds(FikaAmazonAPI.Utils.Constants.ReportTypes.GET_FBA_INVENTORY_PLANNING_DATA, 16, "Eumengman", "FR");
//new AmazonDataSynchroService().SynchroReportIdByCreate(FikaAmazonAPI.Utils.Constants.ReportTypes.GET_FBA_FULFILLMENT_LONGTERM_STORAGE_FEE_CHARGES_DATA, 17, "Eumengman", "ES",DateTime.Parse("2023-03-01"),DateTime.Parse("2023-03-31 23:59:59"));
//new AmazonDataSynchroService().SynchroReportIdByCreate(FikaAmazonAPI.Utils.Constants.ReportTypes.GET_FBA_INVENTORY_PLANNING_DATA, version: 22, account: "Elite99 Nail Art", site: "US",
// btime: DateTime.Parse("2023-04-01"), DateTime.Parse("2023-04-24 23:59:59"));
//new AmazonDataSynchroService().SynchroReportIds(FikaAmazonAPI.Utils.Constants.ReportTypes.GET_AMAZON_FULFILLED_SHIPMENTS_DATA_GENERAL, 13);
//new AmazonDataSynchroService().AnaFbaShipmentReport();
//new AmazonDataSynchroService().AnaFbaStorageFeeReport(status:-1);
//new AmazonDataSynchroService().AnaFbaLongTermStorageFeeReport();
//new AmazonDataSynchroService().AnaFbaLongTermStorageFeeReport(0, "994146019488");
//new AmazonDataSynchroService().AnaFbaOverageStorageFeeReport(report_id: "937084019471");
//new AmazonDataSynchroService().AnaFbaStorageFeeReport(data_id: "323250019473");
......
......@@ -691,7 +691,17 @@ namespace ResetOutofstock
{
Console.WriteLine($"开始 拉取亚马逊 长期仓储费,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
// 下载上个月的
new AmazonDataSynchroService().SynchroReportIds(FikaAmazonAPI.Utils.Constants.ReportTypes.GET_FBA_STORAGE_FEE_CHARGES_DATA, 25);
new AmazonDataSynchroService().SynchroReportIdByCreate(
FikaAmazonAPI.Utils.Constants.ReportTypes.GET_FBA_FULFILLMENT_LONGTERM_STORAGE_FEE_CHARGES_DATA,
version: 25,
btime: DateTime.Now.AddMonths(-1).GetMonthFirstDay().ToDayHome().AddHours(-8),
etime: DateTime.Now.AddMonths(-1).LastDayOfMonth().ToDayEnd().AddHours(-8));
// 下载这个月的
new AmazonDataSynchroService().SynchroReportIdByCreate(
FikaAmazonAPI.Utils.Constants.ReportTypes.GET_FBA_FULFILLMENT_LONGTERM_STORAGE_FEE_CHARGES_DATA,
version: 25,
btime: DateTime.Now.GetMonthFirstDay().ToDayHome(),
etime: DateTime.Now.AddDays(-1).ToDayEnd());
Console.WriteLine($"结束 拉取亚马逊 长期仓储费,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
Thread.Sleep(1000 * 60 * 3);
}
......
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