Commit 26e7c11b by 泽锋 李

尾程费支持根据供应商账期计算支付时间

parent ab22cdad
......@@ -35,5 +35,25 @@ namespace AutoTurnOver.DB
return;
}
public static List<LmsShipLogisticsDto> ShipLogisticsList()
{
//查询采购建议明细
return RedisHelper.Get(RedisConsts.Lms_GetLogistics, () =>
{
string url = ConfigHelper.GetValue("Lms_GetLogistics");
string resultStr = HttpHelper.Request(url, RequestType.GET, "", timeout: 1000 * 60 * 60 * 24);
var result = resultStr.ToObj<LmsResultDto<List<LmsShipLogisticsDto>>>();
if (result == null)
{
throw new Exception("lms系统异常: 未获取到数据");
}
if (!result.Success)
{
throw new Exception("lms系统异常: " + result.ErrorMessage);
}
return result.Data;
});
}
}
}
......@@ -11,6 +11,8 @@ namespace AutoTurnOver.Models.ApiDto
{
public string Line_Code { get; set; }
public string Line_Name { get; set; }
public string Company_Code { get; set; }
public string Company_Name { get; set; }
}
public class LmsResultDto<T>
......
......@@ -91,5 +91,9 @@ namespace AutoTurnOver.Models.Report
{
public DateTime? complete_time { get; set; }
public decimal cost_first { get; set; }
/// <summary>
/// 渠道编码
/// </summary>
public string logisticscode { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models.Report
{
public class dc_report_logistics_company_config
{
public int id { get; set; }
public string company_code { get; set; }
public string company_name { get; set; }
public int payment_days_type { get; set; }
public int days { get; set; }
}
public class dc_report_logistics_company_config_dto: dc_report_logistics_company_config
{
public string payment_days_type_str { get
{
return ((dc_report_logistics_company_config_payment_days_type)payment_days_type).ToString();
} }
}
/// <summary>
/// 1 = 周结 2= 月结 3 = 半结 4 = 预付 5=固定天数 6 = 现结
/// </summary>
public enum dc_report_logistics_company_config_payment_days_type
{
周结 = 1,
月结=2,
半月结 =3,
预付 = 4,
固定天数 = 5,
现结 = 6
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models
{
public class dc_base_oms_pick
{
/// <summary>
///
/// </summary>
public int id { get; set; }
/// <summary>
/// 平台订单号
/// </summary>
public string origin_order_id { get; set; }
/// <summary>
/// 账号id
/// </summary>
public int bailun_account_id { get; set; }
/// <summary>
/// 百伦订单号
/// </summary>
public string bailun_order_id { get; set; }
/// <summary>
/// 配货单号
/// </summary>
public string pick_order_id { get; set; }
/// <summary>
/// 追踪提供商
/// </summary>
public string tracking_provider { get; set; }
/// <summary>
/// 追踪单号
/// </summary>
public string tracking_order_id { get; set; }
/// <summary>
/// 百伦发货状态
/// </summary>
public string shipping_status { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? create_time { get; set; }
/// <summary>
/// 发货时间
/// </summary>
public DateTime? shipping_time { get; set; }
/// <summary>
/// 百伦SKU仓库名称
/// </summary>
public string warehouse_name { get; set; }
/// <summary>
/// 百伦SKU仓库编码
/// </summary>
public string warehouse_code { get; set; }
/// <summary>
/// 运单号
/// </summary>
public string logistics_order_id { get; set; }
/// <summary>
/// 运单线路
/// </summary>
public string logistics_order_name { get; set; }
/// <summary>
/// 数据中心创建时间
/// </summary>
public DateTime gmt_create { get; set; }
/// <summary>
/// 数据中心更新时间
/// </summary>
public DateTime gmt_modified { get; set; }
/// <summary>
/// 配货数量
/// </summary>
public int quantity_picked { get; set; }
/// <summary>
/// 发货数量
/// </summary>
public int quantity_shipped { get; set; }
/// <summary>
/// 百伦sku
/// </summary>
public string bailun_sku { get; set; }
/// <summary>
/// 申报价值,USD
/// </summary>
public decimal declare_price { get; set; }
/// <summary>
/// 运费-配货单维度
/// </summary>
public decimal cost_shipping { get; set; }
/// <summary>
/// 包装费-配货单维度
/// </summary>
public decimal cost_packaging { get; set; }
/// <summary>
/// 出库重量,KG-配货单维度
/// </summary>
public decimal outbound_weight { get; set; }
/// <summary>
/// 运费-SKU维度
/// </summary>
public decimal bailun_sku_cost_shipping { get; set; }
/// <summary>
/// 包装费-SKU维度
/// </summary>
public decimal bailun_sku_cost_packaging { get; set; }
/// <summary>
/// 出库重量,G-SKU维度
/// </summary>
public decimal bailun_sku_outbound_weight { get; set; }
/// <summary>
/// 是否被删除-数据中心添加
/// </summary>
public int has_delete { get; set; }
/// <summary>
/// 公司Id, 默认0是无意义的
/// </summary>
public int company_id { get; set; }
/// <summary>
/// 是否推送第三方仓库
/// </summary>
public int has_pushed { get; set; }
/// <summary>
/// 总费用
/// </summary>
public decimal total_fee { get; set; }
/// <summary>
/// 运输费
/// </summary>
public decimal shipping { get; set; }
/// <summary>
/// 操作费
/// </summary>
public decimal opf { get; set; }
/// <summary>
/// 燃油附加费
/// </summary>
public decimal fsc { get; set; }
/// <summary>
/// 关税
/// </summary>
public decimal dt { get; set; }
/// <summary>
/// 挂号
/// </summary>
public decimal rsf { get; set; }
/// <summary>
/// 其他费用
/// </summary>
public decimal otf { get; set; }
/// <summary>
/// 仓租
/// </summary>
public decimal whf { get; set; }
/// <summary>
/// 币种
/// </summary>
public string currency_code { get; set; }
/// <summary>
/// 转人民币-汇率
/// </summary>
public decimal wms_to_cny_exchange_rate { get; set; }
/// <summary>
/// 转美元-汇率
/// </summary>
public decimal wms_to_usd_exchange_rate { get; set; }
}
}
......@@ -56,6 +56,7 @@ namespace AutoTurnOver.Models
/// 是否作废
/// </summary>
public int is_delete { get; set; }
public DateTime? update_time { get; set; }
}
/// <summary>
......
......@@ -350,22 +350,7 @@ namespace AutoTurnOver.Services
public static List<LmsShipLogisticsDto> ShipLogisticsList()
{
//查询采购建议明细
return RedisHelper.Get(RedisConsts.Lms_GetLogistics, () =>
{
string url = ConfigHelper.GetValue("Lms_GetLogistics");
string resultStr = HttpHelper.Request(url, RequestType.GET, "", timeout: 1000 * 60 * 60 * 24);
var result = resultStr.ToObj<LmsResultDto<List<LmsShipLogisticsDto>>>();
if (result == null)
{
throw new Exception("lms系统异常: 未获取到数据");
}
if (!result.Success)
{
throw new Exception("lms系统异常: " + result.ErrorMessage);
}
return result.Data;
});
return ApiUtility.ShipLogisticsList();
}
public static List<LmsShipLogisticsDto> ShipLogisticsList(string name)
......
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Utility
{
public static class DateHelper
{
/// <summary>
/// 把秒转化成 天时分的格式
/// </summary>
/// <param name="s">秒</param>
/// <returns></returns>
public static string ToDateStr(this int s)
{
var t = new TimeSpan(0, 0, 0, s);
string str = "";
if (t.Days >= 1) { str += $"{t.Days}天"; }
if (t.Hours >= 1) { str += $"{t.Hours}时"; }
if (t.Minutes >= 1) { str += $"{t.Minutes}分"; }
if (t.Seconds >= 1) { str += $"{t.Seconds}秒"; }
return str;
}
public static string ToDateStr(this decimal s)
{
if (s <= 0) return "未设置";
int zs = (int)Math.Floor(s);
var t = new TimeSpan(0, 0, 0, zs);
string str = "";
if (t.Days >= 1) { str += $"{t.Days}天"; }
if (t.Hours >= 1) { str += $"{t.Hours}时"; }
if (t.Minutes >= 1) { str += $"{t.Minutes}分"; }
if (t.Seconds >= 1) { str += $"{t.Seconds}秒"; }
return str;
}
/// <summary>
/// 获取该时间 的零点
/// </summary>
/// <param name="d"></param>
/// <returns></returns>
public static DateTime ToDayHome(this DateTime d)
{
return DateTime.Parse(d.ToString("yyyy-MM-dd 00:00:00"));
}
/// <summary>
/// 获取该时间 的23点
/// </summary>
/// <param name="d"></param>
/// <returns></returns>
public static DateTime ToDayEnd(this DateTime d)
{
return DateTime.Parse(d.ToString("yyyy-MM-dd 23:59:59"));
}
/// <summary>
/// 获取该时间 的零点
/// </summary>
/// <param name="d"></param>
/// <returns></returns>
public static DateTime ToDayDate(this DateTime d, int hour, int minute = 0)
{
return DateTime.Parse(d.ToString($"yyyy-MM-dd {hour}:{minute}:00"));
}
//// <summary>
/// 取得某月的最后一天
/// </summary>
/// <param name="datetime">要取得月份最后一天的时间</param>
/// <returns></returns>
public static DateTime LastDayOfMonth(this DateTime datetime)
{
return datetime.AddDays(1 - datetime.Day).AddMonths(1).AddDays(-1);
}
/// <summary>
/// 得到本周第一天(以星期一为第一天)
/// </summary>
/// <param name="datetime"></param>
/// <returns></returns>
public static DateTime GetWeekFirstDayMon(this DateTime datetime)
{
//星期一为第一天
int weeknow = Convert.ToInt32(datetime.DayOfWeek);
//因为是以星期一为第一天,所以要判断weeknow等于0时,要向前推6天。
weeknow = (weeknow == 0 ? (7 - 1) : (weeknow - 1));
int daydiff = (-1) * weeknow;
//本周第一天
string FirstDay = datetime.AddDays(daydiff).ToString("yyyy-MM-dd");
return Convert.ToDateTime(FirstDay);
}
/// <summary>
/// 得到本周最后一天(以星期天为最后一天)
/// </summary>
/// <param name="datetime"></param>
/// <returns></returns>
public static DateTime GetWeekLastDaySun(this DateTime datetime)
{
//星期天为最后一天
int weeknow = Convert.ToInt32(datetime.DayOfWeek);
weeknow = (weeknow == 0 ? 7 : weeknow);
int daydiff = (7 - weeknow);
//本周最后一天
string LastDay = datetime.AddDays(daydiff).ToString("yyyy-MM-dd");
return Convert.ToDateTime(LastDay);
}
/// <summary>
/// 汉化 成小时为最小单位
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public static string SinicizationByHours(this TimeSpan time_span)
{
var total_h = time_span.TotalHours;
var val = "";
var days = Math.Floor(total_h / 24);
if (days >= 1)
{
val += $"{days}天";
}
var hours = Math.Round(total_h % 24);
val += $"{hours}小时";
return val;
}
/// <summary>
/// 时间戳转时间
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
public static DateTime StampToDateTime(this long? timeStamp_long)
{
if (timeStamp_long == null) return new DateTime(1991, 1, 1);
var timeStamp = timeStamp_long.ToString();
DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
long lTime = long.Parse(timeStamp + "0000");
TimeSpan toNow = new TimeSpan(lTime);
return dtStart.Add(toNow);
}
/// <summary>
/// 将DateTime时间格式转换为Unix时间戳格式
/// </summary>
/// <param name="time">时间</param>
/// <returns>long</returns>
public static long GetUnixTime(this DateTime time)
{
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1, 0, 0, 0, 0));
long t = (time.Ticks - startTime.Ticks) / 10000; //除10000调整为13位
return t;
}
public static string Sinicization(this DayOfWeek week)
{
switch (week)
{
case DayOfWeek.Friday:
return "周五";
case DayOfWeek.Monday:
return "周一";
case DayOfWeek.Saturday:
return "周六";
case DayOfWeek.Sunday:
return "周日";
case DayOfWeek.Thursday:
return "周四";
case DayOfWeek.Tuesday:
return "周二";
case DayOfWeek.Wednesday:
return "周三";
default:
return "";
break;
}
}
public static List<DateTime> GetDayByWeek(this DayOfWeek week, DateTime bDate, DateTime eDate)
{
var datas = new List<DateTime>();
var thisTime = bDate;
while (thisTime <= eDate)
{
if (thisTime.DayOfWeek == week)
{
datas.Add(thisTime);
}
thisTime = thisTime.AddDays(1);
}
return datas;
}
public static List<DateTime> GetDays(this DateTime bDate, DateTime eDate)
{
var datas = new List<DateTime>();
var thisTime = bDate;
while (thisTime <= eDate)
{
datas.Add(thisTime);
thisTime = thisTime.AddDays(1);
}
return datas;
}
public static decimal? DecimalRoun(this decimal val, int num)
{
return Math.Round(val, num);
}
public static decimal? DecimalRoun(this decimal? val, int num)
{
if (val == null)
{
return null;
}
return Math.Round(val.Value, num);
}
/// <summary>
/// 除法
/// </summary>
/// <param name="val1"></param>
/// <param name="val2"></param>
/// <returns></returns>
public static decimal Division(this decimal val1, decimal val2)
{
if (val1 == 0 || val2 == 0)
{
return 0M;
}
else
{
return Math.Round(val1 / val2, 4);
}
}
public static decimal Division(this int? val1, int? val2)
{
if (val1 == null || val2 == null)
{
return 0M;
}
else
{
return ((decimal)val1.Value).Division(val2.Value);
}
}
public static decimal Division(this decimal? val1, decimal? val2)
{
if (val1 == null || val2 == null)
{
return 0M;
}
else
{
return val1.Value.Division(val2.Value);
}
}
public static decimal Division(this decimal val1, decimal? val2)
{
if (val2 == null)
{
return 0M;
}
else
{
return val1.Division(val2.Value);
}
}
/// <summary>
/// 获取某个月份的 指点天数
/// </summary>
/// <param name="thime"></param>
/// <param name="day"></param>
/// <returns></returns>
public static DateTime GetMonthToday(this DateTime time, int day)
{
var lsatTime = time.LastDayOfMonth();
if (lsatTime.Day <= day)
{
return lsatTime;
}
else
{
return new DateTime(time.Year, time.Month, day);
}
}
}
}
......@@ -45,6 +45,12 @@ namespace ResetOutofstock
report_cash_flow_dao.CalculationRefundOrder(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
Console.WriteLine($"结束刷新现金流 退款数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
if (now.Hour == 01 && now.Minute == 05)
{
Console.WriteLine($"开始 刷新订单尾程费 退款数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
report_cash_flow_dao.CalculationOrderCostLogistics(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
Console.WriteLine($"结束 刷新订单尾程费 退款数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
}
public override void Dispose()
......
......@@ -14,7 +14,7 @@ namespace ResetOutofstock
{
Console.WriteLine("刷新缺货数据任务启动...");
var now = DateTime.Now;
//report_cash_flow_dao.CalculationTransferOrder(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
report_cash_flow_dao.CalculationOrderCostLogistics(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
{
services.AddHostedService<ResetOutofstockBackgrounService>();
......
......@@ -34,6 +34,26 @@ namespace ResetOutofstock
}
});
Task.Factory.StartNew(() => {
while (true)
{
try
{
Console.WriteLine($"开始 刷新现金流 订单尾程费,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
var now = DateTime.Now;
report_cash_flow_dao.CalculationOrderCostLogistics(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
Console.WriteLine($"结束 刷新现金流 订单尾程费,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Thread.Sleep(60 * 60 * 1000);
}
});
Task.Factory.StartNew(() => {
while (true)
......
......@@ -9,5 +9,6 @@
"Password": "SpaceHorse1",
"Defaultdatabase": "0"
},
"WipStockUrl": "http://mjzz.bailuntec.com/api/FullStockPageList"
"WipStockUrl": "http://mjzz.bailuntec.com/api/FullStockPageList",
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics"
}
......@@ -10,5 +10,6 @@
"Defaultdatabase": "0"
},
"PPS_ShortagePush": "http://bltpro.bailuntec.com/api/EbayTask/PushSkuEditQtyTask",
"WipStockUrl": "http://mjzz.bailuntec.com/api/FullStockPageList"
"WipStockUrl": "http://mjzz.bailuntec.com/api/FullStockPageList",
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics"
}
......@@ -3,5 +3,6 @@
"Default": "server=10.0.8.15;port=3306;database=bailun_datacenter;uid=root;password=#7kfnymAM$Y9-Ntf;"
},
"PPS_ShortagePush": "http://10.0.6.8:8002/api/EbayTask/PushSkuEditQtyTask",
"WipStockUrl": "http://mjzz.bailuntec.com/api/FullStockPageList"
"WipStockUrl": "http://mjzz.bailuntec.com/api/FullStockPageList",
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics"
}
\ No newline at end of file
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