Commit b014a726 by 泽锋 李

供应商假期全面改零,供应商收假,全面改1

parent 0117c214
......@@ -234,5 +234,33 @@ namespace AutoTurnOver.DB
throw new Exception("调拨费用同步接口 接口异常: " + ex.StackTrace);
}
}
/// <summary>
/// 抓取供应商放假时间
/// </summary>
/// <returns></returns>
public static List<SupplierHolidayTimeDtoOutPut> getSupplierHolidayTimes()
{
try
{
//查询采购建议明细
string url = ConfigHelper.GetValue("distribution_sys:getSupplierHolidayTimes");
string resultStr = HttpHelper.Request(url, RequestType.GET);
var result = resultStr.ToObj<api_SupplierHolidayTimeDtoOutPut>();
if (result == null)
{
return new List<SupplierHolidayTimeDtoOutPut>();
}
else
{
return result.result;
}
}
catch (Exception ex)
{
throw new Exception("pps 供应商节假日接口异常: " + ex.Message);
throw new Exception("pps 供应商节假日接口异常: " + ex.StackTrace);
}
}
}
}
using AutoTurnOver.Models;
using System;
using System.Collections.Generic;
using System.Text;
using Dapper;
using System.Linq;
namespace AutoTurnOver.DB
{
/// <summary>
/// 供应商节假日
/// </summary>
public class base_supplier_holiday_time_dao : connectionHelper
{
/// <summary>
/// 同步所有节假日
/// </summary>
public static void SynchroData()
{
var conn = _connection;
var datas = ApiUtility.getSupplierHolidayTimes();
if (datas!=null)
{
foreach (var item in datas)
{
var new_data = new base_supplier_holiday_time {
source_sys_id = item.Id,
end_date = item.EndData,
reason = item.Reason,
start_date = item.StartData,
supplier_id = item.bailunSupplierId,
status = item.Status,
supplier_name = item.SupplierName,
gmt_update_time =DateTime.Now
};
new_data.id = conn.QuerySingleOrDefault<int>(" select id from base_supplier_holiday_time where source_sys_id=@source_sys_id ",new { source_sys_id = new_data.source_sys_id });
if (new_data.id > 0)
{
conn.Update(new_data);
}
else
{
new_data.gmt_create_time = DateTime.Now;
conn.Insert(new_data);
}
}
}
if(datas != null && datas.Count >= 1)
{
conn.Execute(" update base_supplier_holiday_time set status=0,gmt_update_time=now() where source_sys_id not in @source_sys_ids ", new { source_sys_ids = datas.Select(s=>s.Id).ToList() });
}
else
{
conn.Execute(" update base_supplier_holiday_time set status=0,gmt_update_time=now() ");
}
}
}
}
......@@ -478,8 +478,9 @@ t5.usable_stock as 'stocks',
@platform as 'platform',
0 as 'has_return_goods',
t2.buyer_name,
t_db.hq_type as 'warehouse_type'
from dc_mid_transit as t1
t_db.hq_type as 'warehouse_type',
t_sp.title as 'supplier_holiday_time'
from (select * from dc_mid_transit where warehouse_code in ( 'GZBLWH','BLGZ03','YWWH01' ) ) as t1
left join dc_base_sku as t2 on t1.bailun_sku = t2.bailun_sku
left join dc_base_warehouse as t_db on t1.warehouse_code = t_db.warehouse_code
left join (
......@@ -496,7 +497,9 @@ left join (
left join dc_base_stock as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
left join dc_auto_config_sku_warehouse as t6 on t1.bailun_sku = t6.bailun_sku and t1.warehouse_code = t6.warehouse_code
left join ( select * from dc_auto_monitor_sku_type where warehouse_type='国内仓') as t7 on t1.bailun_sku = t7.bailun_sku
left join holiday_supplier_view as t_sp on t2.suppliers_id = t_sp.supplier_id
where
t_sp.supplier_id is not null or
( t1.warehouse_code in ('GZBLWH','BLGZ03') or ( t1.warehouse_code in ('YWWH01') and ( t2.`status`=1 or t6.`status`=1 ) ) ) -- 义务仓 只要停止监控 或者停售就推送
and t1.bailun_sku not in ('942904501')
and ( t1.quantity_purchase<=0 and (ifnull(t4.sum_unshipped_quantity,0) - ifnull(t3.sum_usable_stock,0))>0 ) -- 有缺货
......@@ -525,7 +528,9 @@ now() as 'push_date',
0 as 'has_return_goods',
t3.buyer_name,
t_db.hq_type as 'warehouse_type',
2 as 'type' from dc_base_stock as t1
2 as 'type' ,
t_sp.title as 'supplier_holiday_time'
from ( select * from dc_base_stock where warehouse_code in ( 'GZBLWH','BLGZ03','YWWH01' ) ) as t1
left join dc_mid_transit as t2 on t1.warehouse_code =t2.warehouse_code and t1.bailun_sku =t2.bailun_sku
left join dc_base_warehouse as t_db on t1.warehouse_code = t_db.warehouse_code
left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku
......@@ -542,7 +547,10 @@ left join (
) as t5 on t1.bailun_sku = t5.bailun_sku and t_db.area_id = t5.area_id
left join dc_auto_config_sku_warehouse as t6 on t1.bailun_sku = t6.bailun_sku and t1.warehouse_code = t6.warehouse_code
left join ( select * from dc_auto_monitor_sku_type where warehouse_type='国内仓') as t7 on t1.bailun_sku = t7.bailun_sku
where t1.usable_stock<=0 and t1.bailun_sku!=''
left join holiday_supplier_view as t_sp on t3.suppliers_id = t_sp.supplier_id
where
t_sp.supplier_id is not null or
t1.usable_stock<=0 and t1.bailun_sku!=''
and ( t1.warehouse_code in ('GZBLWH','BLGZ03') or ( t1.warehouse_code in ('YWWH01') and ( t3.`status`=1 or t6.`status`=1 ) ) ) -- 义务仓 只要停止监控 或者停售就推送
and t1.bailun_sku not in ('942904501')
and ( case
......@@ -585,13 +593,16 @@ t5.usable_stock as 'stocks',
@platform as 'platform',
0 as 'has_return_goods',
t2.buyer_name,
t_db.hq_type as 'warehouse_type'
t_db.hq_type as 'warehouse_type',
t_sp.title as 'supplier_holiday_time'
from dc_mid_transit as t1
left join dc_base_sku as t2 on t1.bailun_sku = t2.bailun_sku
left join dc_base_warehouse as t_db on t1.warehouse_code = t_db.warehouse_code
left join dc_base_stock as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
left join dc_auto_config_sku_warehouse as t6 on t1.bailun_sku = t6.bailun_sku and t1.warehouse_code = t6.warehouse_code
left join holiday_supplier_view as t_sp on t2.suppliers_id = t_sp.supplier_id
where
t_sp.supplier_id is not null or
( t1.warehouse_code in ('GZBLWH','BLGZ03','YWWH01') ) -- 义务仓 只要停止监控 或者停售就推送
and ( t2.`status`=1 or t6.`status`=1 )
and (ifnull(t1.quantity_unshipped,0) - ifnull(t5.usable_stock,0))>0 -- 有缺货
......@@ -612,12 +623,17 @@ now() as 'push_date',
0 as 'has_return_goods',
t3.buyer_name,
t_db.hq_type as 'warehouse_type',
2 as 'type' from dc_base_stock as t1
2 as 'type' ,
t_sp.title as 'supplier_holiday_time'
from dc_base_stock as t1
left join dc_mid_transit as t2 on t1.warehouse_code =t2.warehouse_code and t1.bailun_sku =t2.bailun_sku
left join dc_base_warehouse as t_db on t1.warehouse_code = t_db.warehouse_code
left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku
left join dc_auto_config_sku_warehouse as t6 on t1.bailun_sku = t6.bailun_sku and t1.warehouse_code = t6.warehouse_code
where t1.usable_stock<=0 and t1.bailun_sku!=''
left join holiday_supplier_view as t_sp on t3.suppliers_id = t_sp.supplier_id
where
t_sp.supplier_id is not null or
t1.usable_stock<=0 and t1.bailun_sku!=''
and ( t1.warehouse_code in ('GZBLWH','BLGZ03','YWWH01'))
and ( t3.`status`=1 or t6.`status`=1)
and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_shortage_push_not_config.warehouse_code=t1.warehouse_code and dc_auto_shortage_push_not_config.bailun_sku=t1.bailun_sku )
......@@ -652,11 +668,13 @@ t5.usable_stock as 'stocks',
@platform as 'platform',
0 as 'has_return_goods',
t2.buyer_name,
t_db.hq_type as 'warehouse_type'
from dc_mid_transit as t1
t_db.hq_type as 'warehouse_type',
t_sp.title as 'supplier_holiday_time'
from (select * from dc_mid_transit where warehouse_code in @warehouse_codes ) as t1
left join dc_base_sku as t2 on t1.bailun_sku = t2.bailun_sku
left join dc_base_warehouse as t_db on t1.warehouse_code = t_db.warehouse_code
left join dc_base_stock as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
left join (
select t1.bailun_sku,t2.area_id,sum(t1.usable_stock) as 'usable_stock' from dc_base_stock as t1
left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code
......@@ -672,7 +690,9 @@ left join (
-- and t3.bailun_sku_warehouse_code not in ( select bailun_sku_warehouse_code from dc_auto_shortage_push_ignore )
GROUP BY t1.bailun_sku,t2.area_id
) as t7 on t1.bailun_sku = t7.bailun_sku and t_db.area_id = t7.area_id
left join holiday_supplier_view as t_sp on t2.suppliers_id = t_sp.supplier_id
where
t_sp.supplier_id is not null or
t1.warehouse_code in @warehouse_codes
-- and t5.bailun_sku_warehouse_code not in ( select bailun_sku_warehouse_code from dc_auto_shortage_push_ignore )
and ( ifnull(t6.usable_stock,0)<ifnull(t7.quantity_unshipped,0) ) -- 有缺货
......@@ -694,8 +714,9 @@ now() as 'push_date',
2 as 'type' ,
0 as 'has_return_goods',
t2.buyer_name,
t_db.hq_type as 'warehouse_type'
from dc_base_stock as t1
t_db.hq_type as 'warehouse_type',
t_sp.title as 'supplier_holiday_time'
from ( select * from dc_base_stock where warehouse_code in @warehouse_codes ) as t1
left join dc_base_warehouse as t_db on t1.warehouse_code = t_db.warehouse_code
left join dc_base_sku as t2 on t1.bailun_sku = t2.bailun_sku
left join (
......@@ -705,7 +726,10 @@ left join (
-- and t1.bailun_sku_warehouse_code not in ( select bailun_sku_warehouse_code from dc_auto_shortage_push_ignore )
GROUP BY t1.bailun_sku,t2.area_id
) as t6 on t1.bailun_sku = t6.bailun_sku and t_db.area_id = t6.area_id
where t1.warehouse_code in @warehouse_codes
left join holiday_supplier_view as t_sp on t2.suppliers_id = t_sp.supplier_id
where
t_sp.supplier_id is not null or
t1.warehouse_code in @warehouse_codes
-- and t1.bailun_sku_warehouse_code not in ( select bailun_sku_warehouse_code from dc_auto_shortage_push_ignore )
and ifnull(t6.usable_stock,0)<=0 -- (case when t2.buyer_name in ('张莹霞','张莹霞1') and @platform='ebay' then 2 else 0 end )
and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_shortage_push_not_config.warehouse_code=t1.warehouse_code and dc_auto_shortage_push_not_config.bailun_sku=t1.bailun_sku )
......@@ -1021,7 +1045,8 @@ when t_db.hq_type in ( '国内仓' ) then ifnull(tc1.sum_usable_stock,0) - ifn
else ifnull(tnc1.usable_stock,0)
end
) as 'stocks',
t2.buyer_name
t2.buyer_name,
t_sp.title as 'supplier_holiday_time'
from dc_auto_shortage_push as t1
left join dc_base_sku as t2 on t1.bailun_sku = t2.bailun_sku
left join dc_mid_transit as t3 on t1.bailun_sku = t3.bailun_sku and t1.warehouse_code = t3.warehouse_code
......@@ -1054,10 +1079,10 @@ left join dc_base_stock as t3 on t1.warehouse_code = t3.warehouse_code and t1.ba
-- and t3.bailun_sku_warehouse_code not in ( select bailun_sku_warehouse_code from dc_auto_shortage_push_ignore )
GROUP BY t1.bailun_sku,t2.area_id
) as tnc2 on t1.bailun_sku = tnc2.bailun_sku and t_db.area_id = tnc2.area_id
where 1=1
-- t_stock.bailun_sku_warehouse_code not in ( select bailun_sku_warehouse_code from dc_auto_shortage_push_ignore )
and t1.platform=@platform and t1.has_return_goods=0
left join holiday_supplier_view as t_sp on t2.suppliers_id = t_sp.supplier_id
where
t_sp.supplier_id is null and
t1.platform=@platform and t1.has_return_goods=0
and
(
case
......
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models.ApiDto
{
public class api_SupplierHolidayTimeDtoOutPut
{
public List<SupplierHolidayTimeDtoOutPut> result { get; set; }
public string statusCode { get; set; }
public string message { get; set; }
}
public class SupplierHolidayTimeDtoOutPut
{
public long Id { get; set; }
/// <summary>
/// 供应商id
/// </summary>
public long SupplierId { get; set; }
public long bailunSupplierId { get; set; }
/// <summary>
/// 供应商
/// </summary>
public string SupplierName { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public DateTime? StartData { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public DateTime? EndData { get; set; }
/// <summary>
/// 原因
/// </summary>
public string Reason { get; set; }
/// <summary>
/// 状态:1开启,0关闭
/// </summary>
public int? Status { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models
{
/// <summary>
/// 供应商节假日
/// </summary>
public class base_supplier_holiday_time
{
public int id { get; set; }
public long source_sys_id { get; set; }
public long supplier_id { get; set; }
public string supplier_name { get; set; }
public DateTime? start_date { get; set; }
public DateTime? end_date { get; set; }
public string reason { get; set; }
public int? status { get; set; }
public DateTime gmt_create_time { get; set; }
public DateTime gmt_update_time { get; set; }
}
}
......@@ -41,5 +41,10 @@ namespace AutoTurnOver.Models
/// </summary>
public string platform { get; set; }
public string buyer_name { get; set; }
/// <summary>
/// 供应商节假日情况
/// </summary>
public string supplier_holiday_time { get; set; }
}
}
......@@ -79,6 +79,13 @@ namespace ResetOutofstock
report_cash_flow_dao.CalculationPublishFeeEbay(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
Console.WriteLine($"结束 刷新ebay 上架费,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
if (now.Hour == 0 && now.Minute == 27)
{
Console.WriteLine($"开始 抓取供应商节假日数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
base_supplier_holiday_time_dao.SynchroData();
Console.WriteLine($"结束 抓取供应商节假日数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
if (now.Hour == 4 && now.Minute == 01)
{
Console.WriteLine($"开始刷新 现金流 sku 报表 数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
......
......@@ -15,7 +15,9 @@ namespace ResetOutofstock
Console.WriteLine("刷新缺货数据任务启动...");
try
{
var now = DateTime.Now;
//base_supplier_holiday_time_dao.SynchroData();
//report.ResetCashFlowData();
//report.StockWeekBackUp();
//report.PurchaseWeekBackUp();
......
......@@ -17,5 +17,8 @@
"BrowseLogSetting": {
"Url": "http://saas.admin.bailuntec.com/Api/Ssoadmin/operationloginfo/addoperationloginfo",
"CanLog": "yes"
},
"distribution_sys": {
"getSupplierHolidayTimes": "http://pps.bailuntec.com/distributionapi/Manager/SupplierAssessmentData/getSupplierHolidayTimes"
}
}
......@@ -18,5 +18,8 @@
"BrowseLogSetting": {
"Url": "http://saas.admin.bailuntec.com/Api/Ssoadmin/operationloginfo/addoperationloginfo",
"CanLog": "yes"
},
"distribution_sys": {
"getSupplierHolidayTimes": "http://pps.bailuntec.com/distributionapi/Manager/SupplierAssessmentData/getSupplierHolidayTimes"
}
}
......@@ -17,5 +17,8 @@
"BrowseLogSetting": {
"Url": "http://saas.admin.bailuntec.com/Api/Ssoadmin/operationloginfo/addoperationloginfo",
"CanLog": "yes"
},
"distribution_sys": {
"getSupplierHolidayTimes": "http://pps.bailuntec.com/distributionapi/Manager/SupplierAssessmentData/getSupplierHolidayTimes"
}
}
\ No newline at end of file
......@@ -12,6 +12,7 @@ namespace ShortagePush
static async Task Main(string[] args)
{
Console.WriteLine("推送缺货数据服务");
//new ReportServices().ShortagePush();
//new ReportServices().ShortagePush(platform: "walmart");
//new ReportServices().ShortagePush();
......
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