Commit b8031617 by 泽锋 李

现金流月度支付,支持多次付款

parent 4016c712
...@@ -87,7 +87,7 @@ namespace AutoTurnOver.DB ...@@ -87,7 +87,7 @@ namespace AutoTurnOver.DB
{ {
//查询采购建议明细 //查询采购建议明细
string url = ConfigHelper.GetValue("PPSSkuStatus"); string url = ConfigHelper.GetValue("PPSSkuStatus");
string resultStr = HttpHelper.Request(url, RequestType.POST, data.ToJson(), "application/json", timeout: 1000 * 60 * 60 * 24); string resultStr = HttpHelper.Request(url, RequestType.POST, data.sku.ToJson(), "application/json", timeout: 1000 * 60 * 60 * 24);
var result = resultStr.ToObj<api_pps_sku_status_response_dto>(); var result = resultStr.ToObj<api_pps_sku_status_response_dto>();
if (result == null) if (result == null)
{ {
......
...@@ -668,7 +668,7 @@ where bailun_sku in @skus", new { skus = skus.Split(',').ToList() }); ...@@ -668,7 +668,7 @@ where bailun_sku in @skus", new { skus = skus.Split(',').ToList() });
public static void SynchroPPSSkuStatus() public static void SynchroPPSSkuStatus()
{ {
int page = 1; int page = 1;
int rows = 1000; int rows = 10000;
var conn = _connection; var conn = _connection;
conn.Execute(" Truncate table dc_base_listing_status_temp; "); conn.Execute(" Truncate table dc_base_listing_status_temp; ");
while (true) while (true)
...@@ -678,6 +678,7 @@ where bailun_sku in @skus", new { skus = skus.Split(',').ToList() }); ...@@ -678,6 +678,7 @@ where bailun_sku in @skus", new { skus = skus.Split(',').ToList() });
List<dc_base_listing_status> update_datas = new List<dc_base_listing_status>(); List<dc_base_listing_status> update_datas = new List<dc_base_listing_status>();
var skus = conn.Query<string>($" select bailun_sku from dc_base_sku limit {(page - 1) * rows},{rows} ").ToList(); var skus = conn.Query<string>($" select bailun_sku from dc_base_sku limit {(page - 1) * rows},{rows} ").ToList();
page++;
if (skus == null || skus.Count <= 0) if (skus == null || skus.Count <= 0)
{ {
break; break;
......
...@@ -980,16 +980,29 @@ where t1.create_time>=@btime and t1.create_time<=@etime "; ...@@ -980,16 +980,29 @@ where t1.create_time>=@btime and t1.create_time<=@etime ";
/// </summary> /// </summary>
public static DateTime CalculationPayTime(List<dc_report_cash_flow_config> configs, DateTime occur_time, int data_type, string platform_type, string web_stite) public static DateTime CalculationPayTime(List<dc_report_cash_flow_config> configs, DateTime occur_time, int data_type, string platform_type, string web_stite)
{ {
var item_config = configs.Where(s => s.data_type == data_type var item_configs = configs.Where(s => s.data_type == data_type
&& (s.platform_type == "" || s.platform_type.Equals(platform_type)) && (s.platform_type == "" || s.platform_type.Equals(platform_type))
&& (s.web_stite == "" || s.web_stite.Equals(web_stite)) && (s.web_stite == "" || s.web_stite.Equals(web_stite))
).OrderByDescending(s => s.web_stite).FirstOrDefault(); ).OrderByDescending(s => s.web_stite).ToList();
if (item_config == null) if (item_configs == null || item_configs.Count<=0)
{ {
return occur_time; return occur_time;
} }
else else
{ {
dc_report_cash_flow_config item_config = item_configs[0];
if (item_configs.Where(v=>v.settlement_type== (int)dc_report_cash_flow_settlement_type_enum.月度固定).Count()>1)
{
// 取发生时间后,最早的一个付款日期
item_config = item_configs.Where(s => s.settlement_type > occur_time.Day).OrderBy(s=>s.settlement_type).FirstOrDefault();
if (item_config == null)
{
// 如果没取到,则有可能是最后一天了,要下个月付款了,。则取最早的一天
item_config = item_configs.OrderBy(s => s.settlement_type).FirstOrDefault();
}
}
if (item_config.settlement_type == (int)dc_report_cash_flow_settlement_type_enum.等长顺延) if (item_config.settlement_type == (int)dc_report_cash_flow_settlement_type_enum.等长顺延)
{ {
return occur_time.AddDays(item_config.settlement_val); return occur_time.AddDays(item_config.settlement_val);
...@@ -1009,6 +1022,7 @@ where t1.create_time>=@btime and t1.create_time<=@etime "; ...@@ -1009,6 +1022,7 @@ where t1.create_time>=@btime and t1.create_time<=@etime ";
{ {
return occur_time; return occur_time;
} }
} }
} }
......
...@@ -23,7 +23,7 @@ namespace AutoTurnOver.Purchase.AverageTarget ...@@ -23,7 +23,7 @@ namespace AutoTurnOver.Purchase.AverageTarget
Console.WriteLine("采购平均值计算任务启动..."); Console.WriteLine("采购平均值计算任务启动...");
// 创建采购计划 // 创建采购计划
//Console.WriteLine($"开始同步sku刊登状态,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"); //Console.WriteLine($"开始同步sku刊登状态,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
//daily.SynchroPPSSkuStatus(); daily.SynchroPPSSkuStatus();
//Console.WriteLine($"结束同步sku刊登状态,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"); //Console.WriteLine($"结束同步sku刊登状态,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
var builder = new HostBuilder().ConfigureServices((hostContext, services) => var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
......
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