Commit 759dd617 by 泽锋 李

默认头程方式支持导入

parent d9c75b53
...@@ -67,7 +67,7 @@ namespace AutoGeneratePurchaseAdvise ...@@ -67,7 +67,7 @@ namespace AutoGeneratePurchaseAdvise
} }
// 判断是不是指定的时间 // 判断是不是指定的时间
if (now.Hour == 9 && now.Minute == 1) if (now.Hour == 10 && now.Minute == 1)
{ {
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.Generate(DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"))); PurchaseAdviseServices.Generate(DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")));
......
...@@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection; ...@@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using ShortagePush; using ShortagePush;
using System; using System;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace AutoGeneratePurchaseAdvise namespace AutoGeneratePurchaseAdvise
...@@ -16,15 +17,9 @@ namespace AutoGeneratePurchaseAdvise ...@@ -16,15 +17,9 @@ namespace AutoGeneratePurchaseAdvise
try try
{ {
//PurchaseAdviseServices.Generate(DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")));
//PurchaseAdviseServices.AutoPushBuySys(2); purchase_advise.ReplaceLogistics(DateTime.Now);
//PurchaseAdviseServices.AutoPushBuySys(6);
//PurchaseAdviseServices.AutoPushBuySys(4);
//PurchaseAdviseServices.AutoPushBuySys(6);
//PurchaseAdviseServices.Generate(DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 12:00:00")));
//PurchaseAdviseServices.AutoPushBuySys(1);
} }
catch (Exception ex) catch (Exception ex)
{ {
......
...@@ -15,5 +15,10 @@ ...@@ -15,5 +15,10 @@
"BrowseLogSetting": { "BrowseLogSetting": {
"Url": "http://saas.admin.bailuntec.com/Api/Ssoadmin/operationloginfo/addoperationloginfo", "Url": "http://saas.admin.bailuntec.com/Api/Ssoadmin/operationloginfo/addoperationloginfo",
"CanLog": "yes" "CanLog": "yes"
} },
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics",
"api_plat_category": "http://doc.bailuntec.com:6040/profitplatfee/getplatcategory",
"api_lms_order_transfer_sku": "http://lms.bailuntec.com/api/order/transfer/list",
"ApiLogisticsGetFilterLogisticsAssignLine": "http://lms.bailuntec.com/api/Logistics/ApiLogistics/GetFilterLogisticsAssignLine",
"api_lms_order_transfer_sku_avg": "http://lms.bailuntec.com/api/order/transfer/avglist"
} }
...@@ -15,5 +15,10 @@ ...@@ -15,5 +15,10 @@
"BrowseLogSetting": { "BrowseLogSetting": {
"Url": "http://saas.admin.bailuntec.com/Api/Ssoadmin/operationloginfo/addoperationloginfo", "Url": "http://saas.admin.bailuntec.com/Api/Ssoadmin/operationloginfo/addoperationloginfo",
"CanLog": "yes" "CanLog": "yes"
} },
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics",
"api_plat_category": "http://doc.bailuntec.com:6040/profitplatfee/getplatcategory",
"api_lms_order_transfer_sku": "http://lms.bailuntec.com/api/order/transfer/list",
"ApiLogisticsGetFilterLogisticsAssignLine": "http://lms.bailuntec.com/api/Logistics/ApiLogistics/GetFilterLogisticsAssignLine",
"api_lms_order_transfer_sku_avg": "http://lms.bailuntec.com/api/order/transfer/avglist"
} }
...@@ -15,5 +15,10 @@ ...@@ -15,5 +15,10 @@
"BrowseLogSetting": { "BrowseLogSetting": {
"Url": "http://saas.admin.bailuntec.com/Api/Ssoadmin/operationloginfo/addoperationloginfo", "Url": "http://saas.admin.bailuntec.com/Api/Ssoadmin/operationloginfo/addoperationloginfo",
"CanLog": "yes" "CanLog": "yes"
} },
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics",
"api_plat_category": "http://doc.bailuntec.com:6040/profitplatfee/getplatcategory",
"api_lms_order_transfer_sku": "http://lms.bailuntec.com/api/order/transfer/list",
"ApiLogisticsGetFilterLogisticsAssignLine": "http://lms.bailuntec.com/api/Logistics/ApiLogistics/GetFilterLogisticsAssignLine",
"api_lms_order_transfer_sku_avg": "http://lms.bailuntec.com/api/order/transfer/avglist"
} }
\ No newline at end of file
...@@ -40,9 +40,6 @@ namespace AutoTurnOver.DB ...@@ -40,9 +40,6 @@ namespace AutoTurnOver.DB
public static List<LmsShipLogisticsDto> ShipLogisticsList() public static List<LmsShipLogisticsDto> ShipLogisticsList()
{ {
//查询采购建议明细
return RedisHelper.Get(RedisConsts.Lms_GetLogistics, () =>
{
string url = ConfigHelper.GetValue("Lms_GetLogistics"); string url = ConfigHelper.GetValue("Lms_GetLogistics");
string resultStr = HttpHelper.Request(url, RequestType.GET, "", timeout: 1000 * 60 * 60 * 24); string resultStr = HttpHelper.Request(url, RequestType.GET, "", timeout: 1000 * 60 * 60 * 24);
var result = resultStr.ToObj<LmsResultDto<List<LmsShipLogisticsDto>>>(); var result = resultStr.ToObj<LmsResultDto<List<LmsShipLogisticsDto>>>();
...@@ -55,7 +52,6 @@ namespace AutoTurnOver.DB ...@@ -55,7 +52,6 @@ namespace AutoTurnOver.DB
throw new Exception("lms系统异常: " + result.ErrorMessage); throw new Exception("lms系统异常: " + result.ErrorMessage);
} }
return result.Data; return result.Data;
});
} }
public static List<LmsShipLogisticsDto> ShipLogisticsListHead() public static List<LmsShipLogisticsDto> ShipLogisticsListHead()
...@@ -189,13 +185,14 @@ namespace AutoTurnOver.DB ...@@ -189,13 +185,14 @@ namespace AutoTurnOver.DB
/// 获取预估物流费用 /// 获取预估物流费用
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public static api_logistic_query_result_dto.line_dto GetFilterLogisticsAssignLine(api_logistic_query_input_dto data) public static List<api_logistic_query_result_dto.line_dto> GetFilterLogisticsAssignLineList(api_logistic_query_input_dto data)
{ {
try try
{ {
var parameter_str = $"?LineCodes={data.LineCodes}"; var parameter_str = $"?LineCodes={data.LineCodes}";
parameter_str += $"&endCountries={data.endCountries}"; parameter_str += $"&endCountries={data.endCountries}";
parameter_str += $"&Long={data.Long}"; parameter_str += $"&Long={data.Long}";
parameter_str += $"&skus={data.skus}";
parameter_str += $"&width={data.width}"; parameter_str += $"&width={data.width}";
parameter_str += $"&high={data.high}"; parameter_str += $"&high={data.high}";
parameter_str += $"&weightKg={data.weightKg}"; parameter_str += $"&weightKg={data.weightKg}";
...@@ -215,7 +212,7 @@ namespace AutoTurnOver.DB ...@@ -215,7 +212,7 @@ namespace AutoTurnOver.DB
} }
else else
{ {
return result.Data.successLines[0]; return result.Data.successLines;
} }
} }
catch (Exception ex) catch (Exception ex)
...@@ -224,6 +221,14 @@ namespace AutoTurnOver.DB ...@@ -224,6 +221,14 @@ namespace AutoTurnOver.DB
throw new Exception(" lms 接口异常: " + ex.StackTrace); throw new Exception(" lms 接口异常: " + ex.StackTrace);
} }
} }
/// <summary>
/// 获取预估物流费用
/// </summary>
/// <returns></returns>
public static api_logistic_query_result_dto.line_dto GetFilterLogisticsAssignLine(api_logistic_query_input_dto data)
{
return GetFilterLogisticsAssignLineList(data)[0];
}
/// <summary> /// <summary>
/// 获取调拨单真实费用 /// 获取调拨单真实费用
...@@ -475,6 +480,34 @@ namespace AutoTurnOver.DB ...@@ -475,6 +480,34 @@ namespace AutoTurnOver.DB
//throw new Exception("lms 调拨单时效 接口异常: " + ex.StackTrace); //throw new Exception("lms 调拨单时效 接口异常: " + ex.StackTrace);
} }
} }
/// <summary>
/// 获取lms 的调拨单时效
/// </summary>
/// <returns></returns>
public static List<api_avg_days_dto> GetLmsOrderTransferAvg(api_lms_order_transfer_sku_requst_dto data)
{
try
{
//查询采购建议明细
string url = ConfigHelper.GetValue("api_lms_order_transfer_sku_avg");
string resultStr = HttpHelper.Request(url , RequestType.POST, data.ToJson(),entype: "application/json; charset=utf-8", timeout: 1000 * 60 * 60 * 24);
var result = resultStr.ToObj<List<api_avg_days_dto>>();
if (result == null)
{
return new List<api_avg_days_dto>() { };
}
else
{
return result;
}
}
catch (Exception ex)
{
return new List<api_avg_days_dto>();
//throw new Exception("lms 调拨单时效 接口异常: " + ex.Message);
//throw new Exception("lms 调拨单时效 接口异常: " + ex.StackTrace);
}
}
/// <summary> /// <summary>
/// 抓取财务主体 /// 抓取财务主体
......
...@@ -40,7 +40,7 @@ GROUP BY t1.bailun_sku,t1.warehouse_code,t1.supplier_id ", new { c_time = DateT ...@@ -40,7 +40,7 @@ GROUP BY t1.bailun_sku,t1.warehouse_code,t1.supplier_id ", new { c_time = DateT
parameters.Add("time", DateTime.Now.AddDays(0 - day).ToString("yyyy-MM-dd 00:00:00")); parameters.Add("time", DateTime.Now.AddDays(0 - day).ToString("yyyy-MM-dd 00:00:00"));
return _connection.Query<temp_sku_dto>(@"select t2.hq_type,tsku.sku as 'bailun_sku',t1.targetwareno as 'warehouse_code' return _connection.Query<temp_sku_dto>(@"select t2.hq_type,tsku.sku as 'bailun_sku',t1.targetwareno as 'warehouse_code'
from dc_base_transfer_info as t1 from dc_base_transfer_info as t1
left join dc_base_transfer_info_skus as tsku on t1.dataid = tsku.dataid left join dc_base_transfer_info_skus as tsku on t1.data_id = tsku.dataid
left join dc_base_warehouse as t2 on t1.targetwareno = t2.warehouse_code left join dc_base_warehouse as t2 on t1.targetwareno = t2.warehouse_code
where t1.isdeleted=0 and t1.`timestamp`>=@c_time where t1.isdeleted=0 and t1.`timestamp`>=@c_time
GROUP BY tsku.sku,t1.targetwareno ", new { c_time = DateTime.Now.AddDays(-7) }); GROUP BY tsku.sku,t1.targetwareno ", new { c_time = DateTime.Now.AddDays(-7) });
......
using AutoTurnOver.DB.Base; using AutoTurnOver.DB.Base;
using AutoTurnOver.Models; using AutoTurnOver.Models;
using AutoTurnOver.Models.auto;
using AutoTurnOver.Models.Base; using AutoTurnOver.Models.Base;
using AutoTurnOver.Models.Report; using AutoTurnOver.Models.Report;
using Bailun.ServiceFabric; using Bailun.ServiceFabric;
...@@ -1627,11 +1628,15 @@ and start_date<=@end_date and end_date>=@start_date ...@@ -1627,11 +1628,15 @@ and start_date<=@end_date and end_date>=@start_date
{ {
if (m.id > 0) if (m.id > 0)
{ {
throw new Exception("数据不可修改,请作废重建"); //throw new Exception("数据不可修改,请作废重建");
var result = conn.Update<Models.dc_auto_sales_forecast_config>(m, t); var oldData = conn.QueryFirstOrDefault<Models.dc_auto_sales_forecast_config>(" select * from dc_auto_sales_forecast_config where id=@id ", new { id = m.id });
oldData.is_delete = 1;
oldData.delete_time = DateTime.Now;
var result = conn.Update<Models.dc_auto_sales_forecast_config>(oldData, t);
m.id = 0;
} }
else
{
m.create_date = DateTime.Now; m.create_date = DateTime.Now;
var new_id = conn.Insert<Models.dc_auto_sales_forecast_config>(m, t); var new_id = conn.Insert<Models.dc_auto_sales_forecast_config>(m, t);
if (input_data.bailun_skus != null) if (input_data.bailun_skus != null)
...@@ -1666,7 +1671,6 @@ and start_date<=@end_date and end_date>=@start_date ...@@ -1666,7 +1671,6 @@ and start_date<=@end_date and end_date>=@start_date
conn.Insert(item); conn.Insert(item);
} }
} }
}
t.Commit(); t.Commit();
} }
...@@ -1750,7 +1754,58 @@ and start_date<=@end_date and end_date>=@start_date ...@@ -1750,7 +1754,58 @@ and start_date<=@end_date and end_date>=@start_date
return ex.Message; return ex.Message;
} }
} }
public static string SaveSalesDayConfig(sales_day_config_input_dto m, UserData user)
{
try
{
var data = new sales_day_config()
{
sales = m.sales,
create_date = DateTime.Now,
date_str = m.date.ToString("yyyy-MM-dd"),
bailun_sku = m.bailun_sku,
bailun_sku_warehouse_code = $"{m.bailun_sku}{m.warehouse_code}",
warehouse_code = m.warehouse_code,
create_user = user.UserName,
date = m.date,
update_date = DateTime.Now,
update_user = user.UserName
};
var odlData = _connection.QueryFirstOrDefault<sales_day_config>(" select * from sales_day_config where bailun_sku_warehouse_code=@bailun_sku_warehouse_code and date_str=@date_str ", new
{
bailun_sku_warehouse_code = data.bailun_sku_warehouse_code,
date_str = data.date_str
});
if (odlData != null)
{
data.id = odlData.id;
data.create_user = odlData.create_user;
data.create_date = odlData.create_date;
_connection.Update(data);
}
else
{
_connection.Insert(data);
}
return "";
}
catch (Exception ex)
{
return ex.Message;
}
}
/// <summary>
/// 删除配置
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public static string SaveSalesDayConfigDelete(int id)
{
_connection.Execute(" delete from sales_day_config where id=@id ", new { id = id });
return "";
}
public static dc_report_cash_flow_config GetCashFlowById(int id) public static dc_report_cash_flow_config GetCashFlowById(int id)
{ {
...@@ -1956,7 +2011,7 @@ where 1 = 1 "; ...@@ -1956,7 +2011,7 @@ where 1 = 1 ";
{ {
foreach (var id in input_data.ids) foreach (var id in input_data.ids)
{ {
var dc_auto_turnover_data = _connection.QuerySingleOrDefault<Models.dc_auto_turnover>(" select * from dc_auto_turnover where id=@id ",new { id}); var dc_auto_turnover_data = _connection.QuerySingleOrDefault<Models.dc_auto_turnover>(" select * from dc_auto_turnover where id=@id ", new { id });
// 查询是否已经有数据 // 查询是否已经有数据
var dc_base_head_transport_config_old_data = _connection.QuerySingleOrDefault<dc_base_head_transport_config>(" select * from dc_base_head_transport_config where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code and is_delete=0 limit 1 ", new var dc_base_head_transport_config_old_data = _connection.QuerySingleOrDefault<dc_base_head_transport_config>(" select * from dc_base_head_transport_config where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code and is_delete=0 limit 1 ", new
{ {
...@@ -1976,10 +2031,10 @@ where 1 = 1 "; ...@@ -1976,10 +2031,10 @@ where 1 = 1 ";
create_date = DateTime.Now, create_date = DateTime.Now,
delete_user = "", delete_user = "",
delete_date = null, delete_date = null,
bailun_sku = dc_auto_turnover_data. bailun_sku, bailun_sku = dc_auto_turnover_data.bailun_sku,
warehouse_code = dc_auto_turnover_data.warehouse_code, warehouse_code = dc_auto_turnover_data.warehouse_code,
create_user = user.UserAccount, create_user = user.UserAccount,
head_transport = input_data.head_transport??"", head_transport = input_data.head_transport ?? "",
is_delete = 0, is_delete = 0,
logistics_code = input_data.logistics_code logistics_code = input_data.logistics_code
}); });
...@@ -2019,7 +2074,7 @@ where 1 = 1 "; ...@@ -2019,7 +2074,7 @@ where 1 = 1 ";
{ {
dc_base_head_transport_config_old_data.is_delete = 1; dc_base_head_transport_config_old_data.is_delete = 1;
dc_base_head_transport_config_old_data.delete_date = DateTime.Now; dc_base_head_transport_config_old_data.delete_date = DateTime.Now;
dc_base_head_transport_config_old_data.delete_user = input.user_name?? "trans-sys (user null)"; dc_base_head_transport_config_old_data.delete_user = input.user_name ?? "trans-sys (user null)";
_connection.Update(dc_base_head_transport_config_old_data); _connection.Update(dc_base_head_transport_config_old_data);
} }
......
...@@ -62,10 +62,6 @@ where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code and t1.bailun_o ...@@ -62,10 +62,6 @@ where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code and t1.bailun_o
var sumDataAvgVal = ((decimal)sumDataVal) / 7M; var sumDataAvgVal = ((decimal)sumDataVal) / 7M;
for (int j = 0; j <= 6; j++) for (int j = 0; j <= 6; j++)
{ {
if(j==3 && i == 4)
{
}
if (sumDataAvgVal <= 0) if (sumDataAvgVal <= 0)
{ {
week_coefficient_datas.Add(new week_coefficient_dto { week = j, coefficient = 0M, formula = " ( 0 / 0 )" }); week_coefficient_datas.Add(new week_coefficient_dto { week = j, coefficient = 0M, formula = " ( 0 / 0 )" });
...@@ -87,10 +83,6 @@ where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code and t1.bailun_o ...@@ -87,10 +83,6 @@ where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code and t1.bailun_o
for (int i = 0; i <= 6; i++) for (int i = 0; i <= 6; i++)
{ {
if (i == 3)
{
}
var weekDatas = week_coefficient_datas.Where(s => s.week == i); var weekDatas = week_coefficient_datas.Where(s => s.week == i);
var avg = weekDatas.Select(s => s.coefficient).Average(); var avg = weekDatas.Select(s => s.coefficient).Average();
//var has_val = weekDatas.Select(s => s.coefficient).Average(); //var has_val = weekDatas.Select(s => s.coefficient).Average();
......
...@@ -517,6 +517,20 @@ and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_sh ...@@ -517,6 +517,20 @@ and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_sh
{ {
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 and dc_auto_shortage_push.platform='{platform}' and dc_auto_shortage_push.has_return_goods=0 ) "; 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 and dc_auto_shortage_push.platform='{platform}' and dc_auto_shortage_push.has_return_goods=0 ) ";
} }
// ebay 的 10月新品 +普货全量推
if (platform=="ebay")
{
if (is_all)
{
// 全量推 只推普货
sql += " and t2.develop_time>='2020-10-01' and t2.buyer_name not in ('张莹霞','赵美聪','张莹霞') and t1.warehouse_code in ('GZBLWH') ";
}
else
{
// 增量推,那部分数据要剔除
sql += " and !(t2.develop_time>='2020-10-01' and t2.buyer_name not in ('张莹霞','赵美聪','张莹霞') and t1.warehouse_code in ('GZBLWH') ) ";
}
}
shortage_list.AddRange(conn.Query<dc_auto_shortage_push>(sql, new { platform = platform }, commandTimeout: 0)); shortage_list.AddRange(conn.Query<dc_auto_shortage_push>(sql, new { platform = platform }, commandTimeout: 0));
// 0库存推送 // 0库存推送
...@@ -566,6 +580,20 @@ and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_sh ...@@ -566,6 +580,20 @@ and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_sh
{ {
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 and dc_auto_shortage_push.platform='{platform}' and dc_auto_shortage_push.has_return_goods=0 ) "; 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 and dc_auto_shortage_push.platform='{platform}' and dc_auto_shortage_push.has_return_goods=0 ) ";
} }
// ebay 的 10月新品 +普货全量推
if (platform == "ebay")
{
if (is_all)
{
// 全量推 只推普货
no_library_sql += " and t3.develop_time>='2020-10-01' and t3.buyer_name not in ('张莹霞','赵美聪','张莹霞') and t1.warehouse_code in ('GZBLWH') ";
}
else
{
// 增量推,那部分数据要剔除
no_library_sql += " and !(t3.develop_time>='2020-10-01' and t3.buyer_name not in ('张莹霞','赵美聪','张莹霞') and t1.warehouse_code in ('GZBLWH') ) ";
}
}
shortage_list.AddRange(conn.Query<dc_auto_shortage_push>(no_library_sql, new { platform = platform }, commandTimeout: 0)); shortage_list.AddRange(conn.Query<dc_auto_shortage_push>(no_library_sql, new { platform = platform }, commandTimeout: 0));
return shortage_list; return shortage_list;
...@@ -859,7 +887,7 @@ and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_sh ...@@ -859,7 +887,7 @@ and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_sh
//{ //{
// conn.Delete<dc_auto_shortage_push>(item); // conn.Delete<dc_auto_shortage_push>(item);
//} //}
conn.Execute(" update dc_auto_shortage_push set has_return_goods=1 where id in @ids ", new { ids = datas }); conn.Execute(" update dc_auto_shortage_push set has_return_goods=1,last_return_goods_date=now() where id in @ids ", new { ids = datas });
} }
} }
...@@ -1085,7 +1113,8 @@ left join dc_base_stock as t3 on t1.warehouse_code = t3.warehouse_code and t1.ba ...@@ -1085,7 +1113,8 @@ left join dc_base_stock as t3 on t1.warehouse_code = t3.warehouse_code and t1.ba
left join holiday_supplier_view as t_sp on t2.suppliers_id = t_sp.supplier_id left join holiday_supplier_view as t_sp on t2.suppliers_id = t_sp.supplier_id
where where
t_sp.supplier_id is null and t_sp.supplier_id is null and
t1.platform=@platform and t1.has_return_goods=0 t1.platform=@platform
and ( t1.has_return_goods=0 or ( t_stock.update_time>t1.last_return_goods_date and t_db.hq_type not in ( '国内仓' ) and t1.platform='ebay' ) )
and and
( (
case case
......
...@@ -241,9 +241,19 @@ namespace AutoTurnOver.Models.ApiDto ...@@ -241,9 +241,19 @@ namespace AutoTurnOver.Models.ApiDto
public string logistics_name { get; set; } public string logistics_name { get; set; }
} }
public class api_avg_days_dto
{
public string logistics_code { get; set; }
public decimal avg_sign_days { get; set; }
public decimal avg_put_days { get; set; }
public string logistics_name { get; set; }
public string transport_type { get; set; }
}
public class api_lms_order_transfer_sku_requst_dto public class api_lms_order_transfer_sku_requst_dto
{ {
public string bailun_sku { get; set; } public string bailun_sku { get; set; }
public string country { get; set; }
public string warehouse_code { get; set; } public string warehouse_code { get; set; }
public int orders { get; set; } public int orders { get; set; }
......
...@@ -87,7 +87,7 @@ namespace AutoTurnOver.Models.ApiDto ...@@ -87,7 +87,7 @@ namespace AutoTurnOver.Models.ApiDto
/// <summary> /// <summary>
/// sku信息 以 , 分割 如已传长宽高重量 可不传 /// sku信息 以 , 分割 如已传长宽高重量 可不传
/// </summary> /// </summary>
//public string skus { get; set; } = ""; public string skus { get; set; } = "";
/// <summary> /// <summary>
/// 该票订单总金额 用于计算是否超过申报价值上限 /// 该票订单总金额 用于计算是否超过申报价值上限
......
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models.auto
{
public class dc_auto_replace_logistics_task
{
public int id { get; set; }
public string bailun_sku { get; set; }
public string warehouse_code { get; set; }
public string logistics_name { get; set; }
public string transport_type { get; set; }
public decimal transfer_bale_delivery { get; set; }
public decimal abroad_inbound_delivery { get; set; }
public decimal transfer_delivery { get; set; }
/// <summary>
/// 待处理=0 , 处理成功=1, 处理失败=2, 警告(该类型无需处理) = 3
/// </summary>
public decimal status { get; set; }
public string error_message { get; set; }
public string error_stack_trace { get; set; }
public DateTime update_date { get; set; }
public DateTime create_date { get; set; }
public decimal old_transfer_bale_delivery { get; set; }
public decimal old_abroad_inbound_delivery { get; set; }
public decimal old_transfer_delivery { get; set; }
public string logistics_code { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models.auto
{
public class replace_logistics_outofstock_dto
{
public int id { get; set; }
public string bailun_sku { get; set; }
public string warehouse_code { get; set; }
public DateTime start_time { get; set; }
/// <summary>
/// 供应商交期
/// </summary>
public int supplier_delivery { get; set; }
/// <summary>
/// 采购入库天数
/// </summary>
public int inspection_delivery { get; set; }
/// <summary>
/// 财务付款天数
/// </summary>
public int payment_before_delivery { get; set; }
/// <summary>
/// 周转天数
/// </summary>
public int turnover_days { get; set; }
/// <summary>
/// 国家
/// </summary>
public string area_name { get; set; }
public string country_code { get; set; }
/// <summary>
/// 剩给挑拨的天数
/// </summary>
public decimal surplus_allocation_days { get; set; }
public decimal abroad_inbound_delivery { get; set; }
public decimal transfer_bale_delivery { get; set; }
public decimal transfer_delivery { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models.auto
{
/// <summary>
/// 手动指定销量
/// </summary>
public class sales_day_config
{
public int id { get; set; }
public string bailun_sku { get; set; }
public string warehouse_code { get; set; }
public string bailun_sku_warehouse_code { get; set; }
public DateTime date { get; set; }
public string date_str { get; set; }
public decimal sales { get; set; }
public DateTime create_date { get; set; }
public string create_user { get; set; }
public DateTime update_date { get; set; }
public string update_user { get; set; }
}
public class sales_day_config_input_dto
{
public string bailun_sku { get; set; }
public string warehouse_code { get; set; }
public DateTime date { get; set; }
public decimal sales { get; set; }
}
}
...@@ -44,6 +44,11 @@ namespace AutoTurnOver.Models ...@@ -44,6 +44,11 @@ namespace AutoTurnOver.Models
/// 筛选类型 1 =根据入库时间筛选 2 = 根据销量筛选 /// 筛选类型 1 =根据入库时间筛选 2 = 根据销量筛选
/// </summary> /// </summary>
public int screen_type { get; set; } public int screen_type { get; set; }
/// <summary>
/// 销量数据来源平台
/// </summary>
public string data_source_platform { get; set; }
} }
public class dc_auto_sales_forecast_stage_config public class dc_auto_sales_forecast_stage_config
......
...@@ -23,7 +23,9 @@ namespace AutoTurnOver.Purchase.AverageTarget ...@@ -23,7 +23,9 @@ namespace AutoTurnOver.Purchase.AverageTarget
Console.WriteLine("采购平均值计算任务启动..."); Console.WriteLine("采购平均值计算任务启动...");
try try
{ {
//PurchaseAverageTargetServices.CalculationTransfer();
//dc_base_week_coefficient_dao.ResetData(); //dc_base_week_coefficient_dao.ResetData();
//purchase_advise.ReplaceLogistics(DateTime.Now);
} }
catch (Exception ex) catch (Exception ex)
{ {
......
...@@ -5,10 +5,11 @@ ...@@ -5,10 +5,11 @@
}, },
"PPSSkuStatus": "http://pps.bailuntec.com/Api/Centre/Publish/External/SkuStatus", "PPSSkuStatus": "http://pps.bailuntec.com/Api/Centre/Publish/External/SkuStatus",
"ApiLogisticsGetFilterLogisticsAssignLine": "http://lms.bailuntec.com/api/Logistics/ApiLogistics/GetFilterLogisticsAssignLine", "ApiLogisticsGetFilterLogisticsAssignLine": "http://lms.bailuntec.com/api/Logistics/ApiLogistics/GetFilterLogisticsAssignLine",
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics",
"PostPlatCategoryRate": "http://test.profit.bailuntec.com/api/platfee/ProfitPlatfee/PostPlatCategoryRate", "PostPlatCategoryRate": "http://test.profit.bailuntec.com/api/platfee/ProfitPlatfee/PostPlatCategoryRate",
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics",
"api_plat_category": "http://doc.bailuntec.com:6040/profitplatfee/getplatcategory", "api_plat_category": "http://doc.bailuntec.com:6040/profitplatfee/getplatcategory",
"api_lms_order_transfer_sku": "http://api.lms2.bailuntec.com/api/order/transfer/list", "api_lms_order_transfer_sku": "http://lms.bailuntec.com/api/order/transfer/list",
"api_lms_order_transfer_sku_avg": "http://lms.bailuntec.com/api/order/transfer/avglist",
"BrowseLogSetting": { "BrowseLogSetting": {
"Url": "http://saas.admin.bailuntec.com/Api/Ssoadmin/operationloginfo/addoperationloginfo", "Url": "http://saas.admin.bailuntec.com/Api/Ssoadmin/operationloginfo/addoperationloginfo",
"CanLog": "yes" "CanLog": "yes"
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics", "Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics",
"PostPlatCategoryRate": "http://test.profit.bailuntec.com/api/platfee/ProfitPlatfee/PostPlatCategoryRate", "PostPlatCategoryRate": "http://test.profit.bailuntec.com/api/platfee/ProfitPlatfee/PostPlatCategoryRate",
"api_plat_category": "http://doc.bailuntec.com:6040/profitplatfee/getplatcategory", "api_plat_category": "http://doc.bailuntec.com:6040/profitplatfee/getplatcategory",
"api_lms_order_transfer_sku": "http://api.lms2.bailuntec.com/api/order/transfer/list", "api_lms_order_transfer_sku": "http://lms.bailuntec.com/api/order/transfer/list",
"api_lms_order_transfer_sku_avg": "http://lms.bailuntec.com/api/order/transfer/avglist",
"BrowseLogSetting": { "BrowseLogSetting": {
"Url": "http://saas.admin.bailuntec.com/Api/Ssoadmin/operationloginfo/addoperationloginfo", "Url": "http://saas.admin.bailuntec.com/Api/Ssoadmin/operationloginfo/addoperationloginfo",
"CanLog": "yes" "CanLog": "yes"
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics", "Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics",
"PostPlatCategoryRate": "http://172.31.255.11/api/platfee/ProfitPlatfee/PostPlatCategoryRate", "PostPlatCategoryRate": "http://172.31.255.11/api/platfee/ProfitPlatfee/PostPlatCategoryRate",
"api_plat_category": "http://doc.bailuntec.com:6040/profitplatfee/getplatcategory", "api_plat_category": "http://doc.bailuntec.com:6040/profitplatfee/getplatcategory",
"api_lms_order_transfer_sku": "http://10.0.3.13/api/order/transfer/list", "api_lms_order_transfer_sku": "http://lms.bailuntec.com/api/order/transfer/list",
"api_lms_order_transfer_sku_avg": "http://lms.bailuntec.com/api/order/transfer/avglist",
"BrowseLogSetting": { "BrowseLogSetting": {
"Url": "http://saas.admin.bailuntec.com/Api/Ssoadmin/operationloginfo/addoperationloginfo", "Url": "http://saas.admin.bailuntec.com/Api/Ssoadmin/operationloginfo/addoperationloginfo",
"CanLog": "yes" "CanLog": "yes"
......
...@@ -550,9 +550,9 @@ namespace AutoTurnOver.Services ...@@ -550,9 +550,9 @@ namespace AutoTurnOver.Services
/// <summary> /// <summary>
/// 回货速改推送 (分页推送) /// 回货速改推送 (分页推送)
/// </summary> /// </summary>
public static List<ShortagePush_Item_RequestDto> ReturnGoodsPush(List<dc_return_goods_push> datas, string platform) public static List<ShortagePush_Item_RequestDto> ReturnGoodsPush(List<dc_return_goods_push> original_datas_datas, string platform)
{ {
var datas = original_datas_datas.GroupBy(s => new { s.bailun_sku, s.warehouse_code }).Select(s=>s.FirstOrDefault()).ToList();
var err_datas = new List<ShortagePush_Item_RequestDto>(); var err_datas = new List<ShortagePush_Item_RequestDto>();
if (datas.Count <= 0) return new List<ShortagePush_Item_RequestDto>(); if (datas.Count <= 0) return new List<ShortagePush_Item_RequestDto>();
int page = 1; int page = 1;
......
...@@ -7,6 +7,9 @@ using AutoTurnOver.Utility; ...@@ -7,6 +7,9 @@ using AutoTurnOver.Utility;
using System.Linq; using System.Linq;
using AutoTurnOver.Models.Base; using AutoTurnOver.Models.Base;
using AutoTurnOver.Models.Report; using AutoTurnOver.Models.Report;
using AutoTurnOver.Models.auto;
using AutoTurnOver.DB;
using Dapper;
namespace AutoTurnOver.Services namespace AutoTurnOver.Services
{ {
...@@ -710,6 +713,164 @@ namespace AutoTurnOver.Services ...@@ -710,6 +713,164 @@ namespace AutoTurnOver.Services
} }
return table; return table;
} }
public DataTable SalesDayConfigImport(Stream fileInfo, UserData user)
{
var data_set = EPPlusHelper.ReadExcel(fileInfo);
var table = data_set.Tables[0];
if (!table.Columns.Contains("导入结果")) table.Columns.Add("导入结果");
if (!table.Columns.Contains("导入异常")) table.Columns.Add("导入异常");
var warehouse_list = DB.common.ListWareHouse(null,null);
DateTime now = DateTime.Now;
int index = 1;
foreach (DataRow row in table.Rows)
{
index++;
try
{
var bailun_sku = row["sku"].ToString();
var warehouse_code = row["仓库编码"].ToString();
var date_str = row["日期"].ToString();
var sales_str = row["销量"].ToString();
var action = row["操作"].ToString();
if (string.IsNullOrWhiteSpace(bailun_sku)) throw new Exception("SKU必填");
if (string.IsNullOrWhiteSpace(warehouse_code)) throw new Exception("warehouse_code必填");
var warehouse_data = warehouse_list.SingleOrDefault(s => s.warehouse_code.Equals(warehouse_code, StringComparison.OrdinalIgnoreCase));
if (warehouse_data == null) { throw new Exception("仓库在系统中找不到"); }
var warehouse_name = warehouse_data.warehouse_name;
if (action == "作废")
{
var count = MyMySqlConnection._connection.Execute(" delete from sales_day_config where bailun_sku_warehouse_code=@bailun_sku_warehouse_code ",new {
bailun_sku_warehouse_code = $"{bailun_sku}{warehouse_code}"
});
if (count <= 0)
{
throw new Exception("数据不存在");
}
}
else
{
decimal sales = 0;
if (!decimal.TryParse(sales_str, out sales))
{
throw new Exception("销量格式异常");
}
DateTime date = DateTime.Now;
if (!DateTime.TryParse(date_str, out date))
{
throw new Exception("时间格式异常");
}
var new_data = new sales_day_config_input_dto
{
bailun_sku = bailun_sku,
warehouse_code = warehouse_code,
sales = sales,
date = date
};
DB.db_config.SaveSalesDayConfig(new_data, user);
}
row["导入结果"] = "成功";
row["导入异常"] = "";
}
catch (Exception ex)
{
row["导入结果"] = "失败";
row["导入异常"] = ex.Message;
}
}
return table;
}
/// <summary>
/// 默认头程方式
/// </summary>
/// <param name="fileInfo"></param>
/// <param name="user"></param>
/// <returns></returns>
public DataTable HeadConfigImport(Stream fileInfo, UserData user)
{
var data_set = EPPlusHelper.ReadExcel(fileInfo);
var table = data_set.Tables[0];
if (!table.Columns.Contains("导入结果")) table.Columns.Add("导入结果");
if (!table.Columns.Contains("导入异常")) table.Columns.Add("导入异常");
var warehouse_list = DB.common.ListWareHouse(null,null);
DateTime now = DateTime.Now;
var logs = ApiUtility.ShipLogisticsList();
int index = 1;
foreach (DataRow row in table.Rows)
{
index++;
try
{
var bailun_sku = row["SKU"].ToString();
var warehouse_code = row["仓库编码"].ToString();
var head_transport = row["头程运输方式"].ToString();
var logistics_code = row["渠道"].ToString();
if (string.IsNullOrWhiteSpace(bailun_sku)) throw new Exception("SKU必填");
if (string.IsNullOrWhiteSpace(warehouse_code)) throw new Exception("warehouse_code必填");
var warehouse_data = warehouse_list.SingleOrDefault(s => s.warehouse_code.Equals(warehouse_code, StringComparison.OrdinalIgnoreCase));
if (warehouse_data == null) { throw new Exception("仓库在系统中找不到"); }
var warehouse_name = warehouse_data.warehouse_name;
if (!string.IsNullOrWhiteSpace(logistics_code))
{
var log_data = logs.SingleOrDefault(s => s.Line_Code.Equals(logistics_code, StringComparison.OrdinalIgnoreCase));
if (log_data == null) { throw new Exception("渠道在系统中找不到"); }
}
if (string.IsNullOrWhiteSpace(head_transport))
{
throw new Exception("运输方式必填");
}
else
{
if(head_transport!="空运" && head_transport!="海运" && head_transport != "铁路运输")
{
throw new Exception("运输方式异常: 目前只支持 (空运、海运、铁路运输)");
}
}
var new_data = new batch_set_head_transport_input_dto
{
head_transport = head_transport,
logistics_code = logistics_code,
ids = new List<string> {
(MyMySqlConnection._connection_read_only.QueryFirstOrDefault<int?>(" select * from dc_auto_turnover where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code ",new{
bailun_sku = bailun_sku,
warehouse_code = warehouse_code
})??0).ToString()
}
};
DB.db_config.BatchSetHeadTransport(new_data, user);
row["导入结果"] = "成功";
row["导入异常"] = "";
}
catch (Exception ex)
{
row["导入结果"] = "失败";
row["导入异常"] = ex.Message;
}
}
return table;
}
#endregion #endregion
...@@ -831,6 +992,17 @@ namespace AutoTurnOver.Services ...@@ -831,6 +992,17 @@ namespace AutoTurnOver.Services
return DB.db_config.SaveCashFlow(m); return DB.db_config.SaveCashFlow(m);
} }
public string SaveSalesDayConfig(sales_day_config_input_dto m,UserData user)
{
return DB.db_config.SaveSalesDayConfig(m, user);
}
public string SaveSalesDayConfigDelete(int id )
{
return DB.db_config.SaveSalesDayConfigDelete(id);
}
public dc_report_cash_flow_config GetCashFlowById(int id) public dc_report_cash_flow_config GetCashFlowById(int id)
......
using AutoTurnOver.DB; using AutoTurnOver.DB;
using AutoTurnOver.Models; using AutoTurnOver.Models;
using AutoTurnOver.Models.ApiDto; using AutoTurnOver.Models.ApiDto;
using AutoTurnOver.Models.auto;
using Bailun.ServiceFabric; using Bailun.ServiceFabric;
using Dapper; using Dapper;
using System; using System;
...@@ -24,6 +25,8 @@ namespace AutoTurnOver.Services ...@@ -24,6 +25,8 @@ namespace AutoTurnOver.Services
if (mainID == null) throw new Exception("创建采购建议失败"); if (mainID == null) throw new Exception("创建采购建议失败");
purchase_advise.ImportDetailed(mainID.Value,date); purchase_advise.ImportDetailed(mainID.Value,date);
// 把
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -32,6 +35,10 @@ namespace AutoTurnOver.Services ...@@ -32,6 +35,10 @@ namespace AutoTurnOver.Services
} }
/// <summary> /// <summary>
/// 获取采购建议列表 /// 获取采购建议列表
/// </summary> /// </summary>
......
...@@ -192,33 +192,34 @@ namespace AutoTurnOver.Services ...@@ -192,33 +192,34 @@ namespace AutoTurnOver.Services
// 计算平均海运调拨天数 // 计算平均海运调拨天数
// 查询最近5次海运(已完成)记录 // 查询最近5次海运(已完成)记录
//var transport1List = AveragePurchase.GetTransportList(skuItem.bailun_sku, skuItem.warehouse_code, "海运", "", _seed_count); //var transport1List = AveragePurchase.GetTransportList(skuItem.bailun_sku, skuItem.warehouse_code, "海运", "", _seed_count);
var transport1List = ApiUtility.GetLmsOrderTransfer(new Models.ApiDto.api_lms_order_transfer_sku_requst_dto //var transport1List = ApiUtility.GetLmsOrderTransfer(new Models.ApiDto.api_lms_order_transfer_sku_requst_dto
{ //{
bailun_sku = skuItem.bailun_sku, // bailun_sku = skuItem.bailun_sku,
warehouse_code = skuItem.warehouse_code, // warehouse_code = skuItem.warehouse_code,
orders = _seed_count, // orders = 10,
transfer_type = 2 // transfer_type = 2
}); //});
if (transport1List != null && transport1List.Count() >= 1) //if (transport1List != null && transport1List.Count() >= 1)
{ //{
dataWarehouse.transfer_type_1_days = (decimal)transport1List.Sum(s => (s.put_time - s.shipping_time).TotalDays) / transport1List.Count(); // dataWarehouse.transfer_type_1_days = (decimal)transport1List.Sum(s => (s.sign_time - s.shipping_time).TotalDays) / transport1List.Count();
} // dataWarehouse.transfer_type_1_days = (decimal)transport1List.Sum(s => (s.put_time - s.sign_time).TotalDays) / transport1List.Count();
//}
// 计算平均空运调拨天数 // 计算平均空运调拨天数
// 查询最近5次空运(已完成)记录 // 查询最近5次空运(已完成)记录
//var transport2List = AveragePurchase.GetTransportList(skuItem.bailun_sku, skuItem.warehouse_code, "空运", "", _seed_count); //var transport2List = AveragePurchase.GetTransportList(skuItem.bailun_sku, skuItem.warehouse_code, "空运", "", _seed_count);
var transport2List = ApiUtility.GetLmsOrderTransfer(new Models.ApiDto.api_lms_order_transfer_sku_requst_dto //var transport2List = ApiUtility.GetLmsOrderTransfer(new Models.ApiDto.api_lms_order_transfer_sku_requst_dto
{ //{
bailun_sku = skuItem.bailun_sku, // bailun_sku = skuItem.bailun_sku,
warehouse_code = skuItem.warehouse_code, // warehouse_code = skuItem.warehouse_code,
orders = _seed_count, // orders = _seed_count,
transfer_type = 3 // transfer_type = 3
}); //});
if (transport2List != null && transport2List.Count() >= 1) //if (transport2List != null && transport2List.Count() >= 1)
{ //{
dataWarehouse.transfer_type_2_days = (decimal)transport2List.Sum(s => (s.put_time - s.shipping_time).TotalDays) / transport2List.Count(); // dataWarehouse.transfer_type_2_days = (decimal)transport2List.Sum(s => (s.put_time - s.shipping_time).TotalDays) / transport2List.Count();
} //}
//头程天数 //头程天数
// 查询是否有默认渠道 // 查询是否有默认渠道
...@@ -245,7 +246,7 @@ namespace AutoTurnOver.Services ...@@ -245,7 +246,7 @@ namespace AutoTurnOver.Services
{ {
bailun_sku = skuItem.bailun_sku, bailun_sku = skuItem.bailun_sku,
warehouse_code = skuItem.warehouse_code, warehouse_code = skuItem.warehouse_code,
orders = _seed_count, orders = 10,
logistics_code = dc_base_head_transport_config_data.logistics_code, logistics_code = dc_base_head_transport_config_data.logistics_code,
transfer_type = transfer_type transfer_type = transfer_type
}); });
......
...@@ -544,7 +544,7 @@ namespace AutoTurnOver.Services ...@@ -544,7 +544,7 @@ namespace AutoTurnOver.Services
} }
public void ShortagePushEbay(bool is_all = false) public void ShortagePushEbay(bool is_all = false,bool is_all_haiwai = false)
{ {
try try
...@@ -566,7 +566,7 @@ namespace AutoTurnOver.Services ...@@ -566,7 +566,7 @@ namespace AutoTurnOver.Services
try try
{ {
List<dc_auto_shortage_push> datas = new List<dc_auto_shortage_push>(); List<dc_auto_shortage_push> datas = new List<dc_auto_shortage_push>();
datas.AddRange(report.NotChinaShortagePush(rule1, "ebay", is_all)); datas.AddRange(report.NotChinaShortagePush(rule1, "ebay", is_all_haiwai));
var err_datas = ApiServices.ShortagePush(datas, "ebay"); var err_datas = ApiServices.ShortagePush(datas, "ebay");
// 记录推送状态 // 记录推送状态
report.AddShortagePush(datas.Where(s => !err_datas.Any(e => e.warehouseCode == s.warehouse_code && s.bailun_sku == e.sku))); report.AddShortagePush(datas.Where(s => !err_datas.Any(e => e.warehouseCode == s.warehouse_code && s.bailun_sku == e.sku)));
......
...@@ -21,7 +21,7 @@ namespace AutoTurnOver.Controllers ...@@ -21,7 +21,7 @@ namespace AutoTurnOver.Controllers
public ActionResult<RequestResultDto> Test() public ActionResult<RequestResultDto> Test()
{ {
return new RequestResultDto { success = true, data = return new RequestResultDto { success = true, data =
HttpHelper.Request("http://10.0.3.13/api/Logistics/ApiLogistics/GetPlatOfficialLine?PlatName=aliexpress&PlatSite=US&EndCountry=US&Skus=&WeightKg=0.015&Size=7,4,1&ElectrifiedType=1&SellMoney=1.6000&Currency=USD&OfficialLine=&postWay=&distribution=&logisticsId=0&EnterZip=&isIgnoreVolumeWeight=True&ruleStartPoint=1", RequestType.GET, timeout: 1000 * 60 * 60 * 24) HttpHelper.Request("http://lms.bailuntec.com/api/Logistics/ApiLogistics/GetPlatOfficialLine?PlatName=aliexpress&PlatSite=US&EndCountry=US&Skus=&WeightKg=0.015&Size=7,4,1&ElectrifiedType=1&SellMoney=1.6000&Currency=USD&OfficialLine=&postWay=&distribution=&logisticsId=0&EnterZip=&isIgnoreVolumeWeight=True&ruleStartPoint=1", RequestType.GET, timeout: 1000 * 60 * 60 * 24)
}; };
} }
......
...@@ -5,6 +5,7 @@ using System.Linq; ...@@ -5,6 +5,7 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using AutoTurnOver.Common; using AutoTurnOver.Common;
using AutoTurnOver.Models; using AutoTurnOver.Models;
using AutoTurnOver.Models.auto;
using AutoTurnOver.Models.Report; using AutoTurnOver.Models.Report;
using AutoTurnOver.Utility; using AutoTurnOver.Utility;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
...@@ -955,6 +956,7 @@ namespace AutoTurnOver.Controllers ...@@ -955,6 +956,7 @@ namespace AutoTurnOver.Controllers
[HttpPost] [HttpPost]
[UseAction]
[BrowseLog("Bailun_aims", "触发【百伦自动周转系统】->【周转表】->【设置sku默认头程物流】->操作", 1)] [BrowseLog("Bailun_aims", "触发【百伦自动周转系统】->【周转表】->【设置sku默认头程物流】->操作", 1)]
public JsonResult BatchSetHeadTransport([FromBody]batch_set_head_transport_input_dto m) public JsonResult BatchSetHeadTransport([FromBody]batch_set_head_transport_input_dto m)
{ {
...@@ -969,5 +971,97 @@ namespace AutoTurnOver.Controllers ...@@ -969,5 +971,97 @@ namespace AutoTurnOver.Controllers
} }
} }
[HttpPost]
[UseAction]
[BrowseLog("Bailun_aims", "触发【百伦自动周转系统】->【周转表】->【手工配置销量】操作", 1)]
public JsonResult SaveSalesDayConfig([FromBody]sales_day_config_input_dto m)
{
var result = new Services.ConfigServices().SaveSalesDayConfig(m, AutoUtility.GetUser());
return new JsonResult(result);
}
[HttpGet]
[UseAction]
[BrowseLog("Bailun_aims", "触发【百伦自动周转系统】->【周转表】->【手工配置销量】删除", 1)]
public JsonResult SaveSalesDayConfigDelete(int id)
{
var result = new Services.ConfigServices().SaveSalesDayConfigDelete(id);
return new JsonResult(result);
}
/// <summary>
/// 导入
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
[HttpPost]
[UseAction]
[BrowseLog("Bailun_aims", "触发【百伦自动周转系统】->【周转表】->【销量导入】->【导入】操作", 1)]
public async Task<ActionResult<RequestResultDto>> SalesDayConfigImport(IFormFile file)
{
try
{
var user = AutoUtility.GetUser();
var dataTable = new Services.ConfigServices().SalesDayConfigImport(file.OpenReadStream(), user);
var fileName = AppContext.BaseDirectory + $@"Result\销量(手动)导入结果.csv";
CsvFileHelper.SaveCSV(dataTable, fileName);
var memory = new MemoryStream();
using (var stream = new FileStream(fileName, FileMode.Open))
{
stream.CopyTo(memory);
}
memory.Position = 0;
var fileData = await QiNiuCloudHelper.UploadAsync(memory, $"{user.UserName}-{DateTime.Now.ToString("yyyyMMddHHmmss")}销量(手动)导入结果.csv");
return new RequestResultDto { success = true, data = fileData };
}
catch (Exception ex)
{
return new RequestResultDto { success = false, message = ex.Message, err_data = ex.StackTrace };
}
}
/// <summary>
/// 导入
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
[HttpPost]
//[UseAction]
[BrowseLog("Bailun_aims", "触发【百伦自动周转系统】->【周转表】->【默认头程方式】->【导入】操作", 1)]
public async Task<ActionResult<RequestResultDto>> HeadConfigImport(IFormFile file)
{
try
{
var user = AutoUtility.GetUser();
var dataTable = new Services.ConfigServices().HeadConfigImport(file.OpenReadStream(), user);
var fileName = AppContext.BaseDirectory + $@"Result\默认头程方式导入结果.csv";
CsvFileHelper.SaveCSV(dataTable, fileName);
var memory = new MemoryStream();
using (var stream = new FileStream(fileName, FileMode.Open))
{
stream.CopyTo(memory);
}
memory.Position = 0;
var fileData = await QiNiuCloudHelper.UploadAsync(memory, $"{user.UserName}-{DateTime.Now.ToString("yyyyMMddHHmmss")}默认头程方式导入结果.csv");
return new RequestResultDto { success = true, data = fileData };
}
catch (Exception ex)
{
return new RequestResultDto { success = false, message = ex.Message, err_data = ex.StackTrace };
}
}
} }
} }
\ No newline at end of file
...@@ -50,11 +50,17 @@ namespace AutoTurnOver.Controllers ...@@ -50,11 +50,17 @@ namespace AutoTurnOver.Controllers
{ {
bailun_sku_warehouse_code = $"{sku}{warehousecode}" bailun_sku_warehouse_code = $"{sku}{warehousecode}"
}); });
// 提前查询销量配置
var sales_day_config_datas = MyMySqlConnection._connection_read_only.Query<sales_day_config>(" select * from sales_day_config where bailun_sku_warehouse_code=@bailun_sku_warehouse_code ", new
{
bailun_sku_warehouse_code = $"{sku}{warehousecode}"
});
//[0.13, 0.12, 0.11, 0.11, 0.1, 0.09, 0.09, 0.08, 0.08, 0.07, 0.06, 0.06, 0.05, 0.04, 0.04, 0.03, 0.02, 0.02, 0.01, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] //[0.13, 0.12, 0.11, 0.11, 0.1, 0.09, 0.09, 0.08, 0.08, 0.07, 0.06, 0.06, 0.05, 0.04, 0.04, 0.03, 0.02, 0.02, 0.01, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
var date = new List<string>(); var date = new List<string>();
var today = DateTime.Now.AddDays(-7); var today = DateTime.Now.AddDays(-7);
var weeks = new List<dynamic>(); var weeks = new List<dynamic>();
var sales_day_configs = new List<dynamic>();
for (var i = 0; i < count; i++) for (var i = 0; i < count; i++)
{ {
var dateI = today.AddDays(i); var dateI = today.AddDays(i);
...@@ -63,7 +69,9 @@ namespace AutoTurnOver.Controllers ...@@ -63,7 +69,9 @@ namespace AutoTurnOver.Controllers
for (var i = -7; i < count; i++) for (var i = -7; i < count; i++)
{ {
var dateI = today.AddDays(i); var dateI = today.AddDays(i);
var date_str = dateI.ToString("yyyy-MM-dd");
var weekItem = dc_base_week_coefficient_datas.FirstOrDefault(s => s.week == (int)dateI.DayOfWeek); var weekItem = dc_base_week_coefficient_datas.FirstOrDefault(s => s.week == (int)dateI.DayOfWeek);
if (weekItem != null) if (weekItem != null)
{ {
weeks.Add(new { date = dateI.ToString("MM/dd"), formula = $" ( {weekItem.formula} )",val= $"{weekItem.coefficient}" }); weeks.Add(new { date = dateI.ToString("MM/dd"), formula = $" ( {weekItem.formula} )",val= $"{weekItem.coefficient}" });
...@@ -72,6 +80,15 @@ namespace AutoTurnOver.Controllers ...@@ -72,6 +80,15 @@ namespace AutoTurnOver.Controllers
{ {
weeks.Add(new { date = dateI.ToString("MM/dd"), formula = "-",val="-" }); weeks.Add(new { date = dateI.ToString("MM/dd"), formula = "-",val="-" });
} }
var sales_day_configItem = sales_day_config_datas.FirstOrDefault(s => s.date_str == date_str);
if (sales_day_configItem != null)
{
sales_day_configs.Add(new { date = date_str, id = sales_day_configItem.id, val = sales_day_configItem.sales });
}
else
{
sales_day_configs.Add(new { date = date_str, id = 0, val = 0});
}
} }
...@@ -120,6 +137,7 @@ namespace AutoTurnOver.Controllers ...@@ -120,6 +137,7 @@ namespace AutoTurnOver.Controllers
{ {
data = result, data = result,
weeks = weeks, weeks = weeks,
sales_day_configs = sales_day_configs,
turnoverData, turnoverData,
saleVolumeData, saleVolumeData,
days = date, days = date,
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
"Crm_Case_Order": "http://crm.bailuntec.com/api/CaseOrderList", "Crm_Case_Order": "http://crm.bailuntec.com/api/CaseOrderList",
"Crm_Message": "http://crm.bailuntec.com/api/MessageList", "Crm_Message": "http://crm.bailuntec.com/api/MessageList",
"Crm_Message_Reply": "http://crm.bailuntec.com/api/MessageReplyList", "Crm_Message_Reply": "http://crm.bailuntec.com/api/MessageReplyList",
"Lms_GetLogistics": "http://api.lms2.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics", "Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics",
"Pams_PlatformList": "http://pams.bailuntec.com/Api/GetPlatformSites?type=1", "Pams_PlatformList": "http://pams.bailuntec.com/Api/GetPlatformSites?type=1",
"Crm_Message_Custom_Template": "http://crm.bailuntec.com/api/MessageCustomTemplateList", "Crm_Message_Custom_Template": "http://crm.bailuntec.com/api/MessageCustomTemplateList",
"CRM_SendMessage": "http://kefu.bailuntec.com/api/SendMessage", "CRM_SendMessage": "http://kefu.bailuntec.com/api/SendMessage",
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
"Crm_Case_Order": "http://crm.bailuntec.com/api/CaseOrderList", "Crm_Case_Order": "http://crm.bailuntec.com/api/CaseOrderList",
"Crm_Message": "http://crm.bailuntec.com/api/MessageList", "Crm_Message": "http://crm.bailuntec.com/api/MessageList",
"Crm_Message_Reply": "http://crm.bailuntec.com/api/MessageReplyList", "Crm_Message_Reply": "http://crm.bailuntec.com/api/MessageReplyList",
"Lms_GetLogistics": "http://api.lms2.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics", "Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics",
"Pams_PlatformList": "http://pams.bailuntec.com/Api/GetPlatformSites?type=1", "Pams_PlatformList": "http://pams.bailuntec.com/Api/GetPlatformSites?type=1",
"Crm_Message_Custom_Template": "http://crm.bailuntec.com/api/MessageCustomTemplateList", "Crm_Message_Custom_Template": "http://crm.bailuntec.com/api/MessageCustomTemplateList",
"CRM_SendMessage": "http://kefu.bailuntec.com/api/SendMessage", "CRM_SendMessage": "http://kefu.bailuntec.com/api/SendMessage",
......
...@@ -15,6 +15,7 @@ namespace ShortagePush ...@@ -15,6 +15,7 @@ namespace ShortagePush
try try
{ {
//new ReportServices().ShortagePushEbay(true);
//new ReportServices().ReturnGoodsPush(); //new ReportServices().ReturnGoodsPush();
} }
catch (Exception ex) catch (Exception ex)
......
...@@ -43,9 +43,13 @@ namespace ShortagePush ...@@ -43,9 +43,13 @@ namespace ShortagePush
{ {
try try
{ {
System.Console.WriteLine($"开始推送 Ebay 改零数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"); System.Console.WriteLine($"开始推送 Ebay - 增量 改零数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
new ReportServices().ShortagePushEbay(); new ReportServices().ShortagePushEbay();
System.Console.WriteLine($"结束推送 Ebay 改零数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"); System.Console.WriteLine($"结束推送 Ebay -增量 改零数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
System.Console.WriteLine($"开始推送 Ebay - 全量 改零数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
new ReportServices().ShortagePushEbay(true);
System.Console.WriteLine($"结束推送 Ebay - 全量 改零数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
System.Console.WriteLine($"开始推送 Ebay 回货数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"); System.Console.WriteLine($"开始推送 Ebay 回货数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
new ReportServices().ReturnGoodsPushEaby(); new ReportServices().ReturnGoodsPushEaby();
......
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