Commit 3f52061e by lizefeng

1、缺货改零支持全量推送。

2、采购员为赵美聪,陈嘉雯1 的产品,休息日不推送
parent c3598da9
......@@ -41,9 +41,18 @@ namespace AutoGeneratePurchaseAdvise
if (now.Hour == 08 && now.Minute == 59)
{
Console.WriteLine($"开始推送 服装采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
PurchaseAdviseServices.AutoPushBuySys(2);
Console.WriteLine($"结束推送 服装采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
// 要上班才推
if (ApiServices.GetSchedulings())
{
Console.WriteLine($"开始推送 手机采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
PurchaseAdviseServices.AutoPushBuySys(3);
Console.WriteLine($"结束推送 手机采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
Console.WriteLine($"开始推送 服装采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
PurchaseAdviseServices.AutoPushBuySys(2);
Console.WriteLine($"结束推送 服装采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
}
......
......@@ -8,5 +8,6 @@
"SecretKey": "yagRd-cBOVhkRGGT-o_reMqNVjI8_k7YwoTXkhrm",
"CdnUrl": "http://imgcache.bailuntec.com"
},
"QiYeJiQiRen": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5fa4c1d5-ce65-4e8a-9ae9-a0d689a13b65"
"QiYeJiQiRen": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5fa4c1d5-ce65-4e8a-9ae9-a0d689a13b65",
"GetSchedulings": "http://www.bailuntec.com/Api/Cq/GetSchedulings?userID=2409"
}
......@@ -8,5 +8,6 @@
"SecretKey": "yagRd-cBOVhkRGGT-o_reMqNVjI8_k7YwoTXkhrm",
"CdnUrl": "http://imgcache.bailuntec.com"
},
"QiYeJiQiRen": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5fa4c1d5-ce65-4e8a-9ae9-a0d689a13b65"
"QiYeJiQiRen": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5fa4c1d5-ce65-4e8a-9ae9-a0d689a13b65",
"GetSchedulings": "http://www.bailuntec.com/Api/Cq/GetSchedulings?userID=2409"
}
......@@ -8,5 +8,6 @@
"SecretKey": "yagRd-cBOVhkRGGT-o_reMqNVjI8_k7YwoTXkhrm",
"CdnUrl": "http://imgcache.bailuntec.com"
},
"QiYeJiQiRen": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5fa4c1d5-ce65-4e8a-9ae9-a0d689a13b65"
"QiYeJiQiRen": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5fa4c1d5-ce65-4e8a-9ae9-a0d689a13b65",
"GetSchedulings": "http://www.bailuntec.com/Api/Cq/GetSchedulings?userID=2409"
}
\ No newline at end of file
......@@ -304,7 +304,7 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise=
}
/// <summary>
/// 导入缺货明细 (服装)
/// 导入缺货明细 (手机)
/// </summary>
/// <param name="mainID"></param>
public static int ImportShoujiShortageDetailed(int mainID)
......
......@@ -449,7 +449,9 @@ where ( t_db.hq_type!='国内仓' or t2.buyer_name not in ('张莹霞','张莹
/// <summary>
/// 缺货推送
/// </summary>
public static List<dc_auto_shortage_push> ShortagePush()
/// <param name="is_all">是否全量数据</param>
/// <returns></returns>
public static List<dc_auto_shortage_push> ShortagePush(bool is_all = false)
{
var conn = _connection;
var shortage_list = new List<dc_auto_shortage_push>();
......@@ -476,9 +478,12 @@ and (
end
)<=0
and (case when t_db.warehouse_code in ( 'GZBLWH', 'QYBLZZ' ) and t2.buyer_name not in ('张莹霞','张莹霞1') then (ifnull(t4.sum_unshipped_quantity,0) - ifnull(t3.sum_usable_stock,0)) else t1.quantity_out_stock end )>0
and not exists ( select * from dc_auto_shortage_push where dc_auto_shortage_push.warehouse_code = t1.warehouse_code and dc_auto_shortage_push.bailun_sku = t1.bailun_sku and dc_auto_shortage_push.`type`=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 )
";
if (!is_all)
{
sql += " and not exists ( select * from dc_auto_shortage_push where dc_auto_shortage_push.warehouse_code = t1.warehouse_code and dc_auto_shortage_push.bailun_sku = t1.bailun_sku and dc_auto_shortage_push.`type`=1 ) ";
}
shortage_list.AddRange(conn.Query<dc_auto_shortage_push>(sql,commandTimeout: 0));
// 0库存推送
......@@ -512,9 +517,13 @@ and not EXISTS (
)>0
)
) -- 同属性仓库 (是否国内) 有库存,就不算 0库存
and not exists ( select * from dc_auto_shortage_push where dc_auto_shortage_push.warehouse_code = t1.warehouse_code and dc_auto_shortage_push.bailun_sku = t1.bailun_sku and dc_auto_shortage_push.`type`=2 )
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 )
";
if (!is_all)
{
no_library_sql += " and not exists ( select * from dc_auto_shortage_push where dc_auto_shortage_push.warehouse_code = t1.warehouse_code and dc_auto_shortage_push.bailun_sku = t1.bailun_sku and dc_auto_shortage_push.`type`=2 ) ";
}
shortage_list.AddRange(conn.Query<dc_auto_shortage_push>(no_library_sql, commandTimeout: 0));
return shortage_list;
......
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models.ApiDto
{
public class scheduling_response_dto
{
public bool success { get; set; }
public List<scheduling_response_data_dto> data { get; set; }
public class scheduling_response_data_dto
{
public DateTime cqDateTime { get; set; }
public int status { get; set; }
}
}
}
......@@ -562,5 +562,30 @@ namespace AutoTurnOver.Services
}
/// <summary>
/// 查看今天是否需要上班
/// </summary>
/// <returns></returns>
public static bool GetSchedulings()
{
try
{
var date_str = DateTime.Now.ToString("yyyy-MM-dd");
string url = ConfigHelper.GetValue("GetSchedulings");
string resultStr = HttpHelper.Request(url + $"&btime={date_str}&etime={date_str}", RequestType.GET, timeout: 1000 * 60 * 60 * 24);
var result = resultStr.ToObj<scheduling_response_dto>();
if (result == null)
{
throw new Exception("oa系统异常: 获取上班数据失败 ");
}
return result.data.Any(s => s.status == 1);
}
catch (Exception)
{
return true;
}
}
}
}
......@@ -198,6 +198,9 @@ namespace AutoTurnOver.Services
else if(type==2)
{
mainID = purchase_advise.ImportFuZhuangShortageDetailed(0);
}else if (type == 3)
{
mainID = purchase_advise.ImportShoujiShortageDetailed(0);
}
List<dc_auto_purchase_advise_detailed_dto> datas = new List<dc_auto_purchase_advise_detailed_dto>();
......
......@@ -446,9 +446,9 @@ namespace AutoTurnOver.Services
/// <summary>
/// 缺货推送
/// </summary>
public void ShortagePush()
public void ShortagePush(bool is_all = false)
{
var datas = report.ShortagePush();
var datas = report.ShortagePush(is_all);
var err_datas = ApiServices.ShortagePush(datas);
// 记录推送状态
......
......@@ -33,5 +33,6 @@
"SecretKey": "yagRd-cBOVhkRGGT-o_reMqNVjI8_k7YwoTXkhrm",
"CdnUrl": "http://imgcache.bailuntec.com"
},
"QiYeJiQiRen": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5fa4c1d5-ce65-4e8a-9ae9-a0d689a13b65"
"QiYeJiQiRen": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5fa4c1d5-ce65-4e8a-9ae9-a0d689a13b65",
"GetSchedulings": "http://www.bailuntec.com/Api/Cq/GetSchedulings?userID=2409"
}
......@@ -33,5 +33,6 @@
"SecretKey": "yagRd-cBOVhkRGGT-o_reMqNVjI8_k7YwoTXkhrm",
"CdnUrl": "http://imgcache.bailuntec.com"
},
"QiYeJiQiRen": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5fa4c1d5-ce65-4e8a-9ae9-a0d689a13b65"
"QiYeJiQiRen": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5fa4c1d5-ce65-4e8a-9ae9-a0d689a13b65",
"GetSchedulings": "http://www.bailuntec.com/Api/Cq/GetSchedulings?userID=2409"
}
......@@ -33,5 +33,6 @@
"SecretKey": "yagRd-cBOVhkRGGT-o_reMqNVjI8_k7YwoTXkhrm",
"CdnUrl": "http://imgcache.bailuntec.com"
},
"QiYeJiQiRen": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5fa4c1d5-ce65-4e8a-9ae9-a0d689a13b65"
"QiYeJiQiRen": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5fa4c1d5-ce65-4e8a-9ae9-a0d689a13b65",
"GetSchedulings": "http://www.bailuntec.com/Api/Cq/GetSchedulings?userID=2409"
}
using AutoTurnOver.Services;
using AutoTurnOver.DB;
using AutoTurnOver.Services;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
......@@ -11,7 +12,7 @@ namespace ShortagePush
static async Task Main(string[] args)
{
Console.WriteLine("推送缺货数据服务");
//new ReportServices().ShortagePush();
var datas = report.ShortagePush();
var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
{
services.AddHostedService<ShortagePushBackgroundService>();
......
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