Commit d08eb7ff by 泽锋 李

fix

parent 58c639f7
......@@ -114,28 +114,28 @@ namespace AutoTurnOver.DB
try
{
var parameter_str = $"?LineCodes={data.LineCodes}";
parameter_str += $"endCountries={data.endCountries}";
parameter_str += $"Long={data.Long}";
parameter_str += $"width={data.width}";
parameter_str += $"high={data.high}";
parameter_str += $"weightKg={data.weightKg}";
parameter_str += $"startPoint={data.startPoint}";
parameter_str += $"warehouseNo={data.warehouseNo}";
parameter_str += $"&endCountries={data.endCountries}";
parameter_str += $"&Long={data.Long}";
parameter_str += $"&width={data.width}";
parameter_str += $"&high={data.high}";
parameter_str += $"&weightKg={data.weightKg}";
parameter_str += $"&startPoint={data.startPoint}";
//parameter_str += $"&warehouseNo={data.warehouseNo}";
//parameter_str += $"orderPriceCNY={data.orderPriceCNY}";
parameter_str += $"platform={data.platform}";
parameter_str += $"Site={data.Site}";
parameter_str += $"&platform={data.platform}";
parameter_str += $"&Site={data.Site}";
//查询采购建议明细
string url = ConfigHelper.GetValue("ApiLogisticsGetFilterLogisticsAssignLine");
string resultStr = HttpHelper.Request(url, RequestType.GET, parameter_str, timeout: 1000 * 60 * 60 * 24);
string resultStr = HttpHelper.Request(url+ parameter_str, RequestType.GET, timeout: 1000 * 60 * 60 * 24);
var result = resultStr.ToObj<api_logistic_query_result_dto>();
if (result == null || result.successLines == null || result.successLines.Count <= 0)
if (result == null || result.Data == null || result.Data.successLines == null || result.Data.successLines.Count <= 0)
{
throw new Exception("未查询到物流费用");
}
else
{
return result.successLines[0];
return result.Data.successLines[0];
}
}
catch (Exception ex)
......
......@@ -13,6 +13,11 @@ namespace AutoTurnOver.Models.ApiDto
public string Line_Name { get; set; }
public string Company_Code { get; set; }
public string Company_Name { get; set; }
/// <summary>
/// 1-直邮 2-海外 3-头程
/// </summary>
public string Start_Point { get; set; }
}
public class LmsResultDto<T>
......
......@@ -131,15 +131,20 @@ namespace AutoTurnOver.Models.ApiDto
{
public bool Success { get; set; }
public string ErrorMessage { get; set; }
public string Data { get; set; }
public data_dto Data { get; set; }
public class data_dto
{
public List<line_dto> successLines { get; set; }
public List<line_dto> failLines { get; set; }
}
public class line_dto
{
public string Line_Code { get; set; }
public string LineName { get; set; }
public decimal FootFee { get; set; }
public decimal TotalPrices { get; set; }
public decimal HeadFee { get; set; }
public string ErrorMsg { get; set; }
......
using System;
using AutoTurnOver.Models.Base;
using System;
using System.Collections.Generic;
using System.Text;
......@@ -39,12 +40,14 @@ namespace AutoTurnOver.Models.Report
/// 头程物流
/// </summary>
public string transfer_logistics_code { get; set; }
public string transfer_logistics_name { get; set; }
/// <summary>
/// 尾程物流
/// </summary>
public string tail_logistics_code { get; set; }
public string tail_logistics_name { get; set; }
/// <summary>
/// 尾程物流
/// 退款率
/// </summary>
public decimal refund_ratio { get; set; }
/// <summary>
......@@ -74,8 +77,80 @@ namespace AutoTurnOver.Models.Report
public decimal @long { get; set; }
public decimal weight_kg { get; set; }
public decimal width { get; set; }
public DateTime update_time { get; set; }
}
public class dc_report_cash_flow_forecast_task_info_dto
{
public List<report_cash_flow_view_dto> views { get; set; }
public List<turnover_dto> turnovers { get; set; }
public class turnover_dto
{
public string item_title { get; set; }
public List<int> types { get; set; }
public List<date_dto> dates { get; set; }
public class date_dto
{
public string date_title { get; set; }
public DateTime btime { get; set; }
public DateTime etime { get; set; }
public decimal val { get; set; }
}
}
}
public class report_cash_flow_view_forecast_task_search_dto
{
public int task_id { get; set; }
}
public class dc_report_cash_flow_forecast_task_dto: dc_report_cash_flow_forecast_task
{
public string warehouse_name { get; set; }
public string status_str { get
{
return ((dc_report_cash_flow_forecast_task_status)status).ToString();
} }
}
public class dc_report_cash_flow_forecast_task_date_dto
{
public string btime { get; set; }
public string etime { get; set; }
}
public class dc_report_cash_flow_forecast_task_input_dto: dc_report_cash_flow_forecast_task_dto
{
public string btime { get; set; }
public string etime { get; set; }
public List<sale_dto> sales { get; set; }
public class sale_dto
{
public DateTime date { get; set; }
public decimal val { get; set; }
}
}
public enum dc_report_cash_flow_forecast_task_status
{
已提交=0,
计算中=1,
计算完成=2,
计算异常=3
}
public class dc_report_cash_flow_forecast_task_search_dto
{
public string bailun_sku { get; set; }
}
public class dc_report_cash_flow_forecast_task_sale
......@@ -145,11 +220,25 @@ namespace AutoTurnOver.Models.Report
public string occur_time_year_month_no { get; set; }
}
public class dc_report_cash_flow_forecast_turnover
{
public int id { get; set; }
public DateTime date { get; set; }
/// <summary>
/// 预测数值
/// </summary>
public decimal val { get; set; }
public int type { get; set; }
}
/// <summary>
/// 虚拟周转模型,用来虚拟下单
/// </summary>
public class invented_turnover_model
{
public int id { get; set; }
public int task_id { get; set; }
public DateTime date { get; set; }
public string date_str { get { return date.ToString("yyyy-MM-dd"); } }
......
......@@ -16,6 +16,27 @@ namespace AutoTurnOver.Purchase.AverageTarget
protected override Task ExecuteAsync(CancellationToken stoppingToken)
{
_timer = new Timer(DoWork, null, TimeSpan.Zero, TimeSpan.FromMinutes(1));
Task.Factory.StartNew(() =>
{
while (true)
{
try
{
Console.WriteLine($"开始 计算预测现金流,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
report_cash_flow_forecast_dao.Calculation();
Console.WriteLine($"结束 计算预测现金流,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Thread.Sleep(10 * 1000);
}
});
return Task.CompletedTask;
}
......
......@@ -23,7 +23,7 @@ namespace AutoTurnOver.Purchase.AverageTarget
Console.WriteLine("采购平均值计算任务启动...");
// 创建采购计划
//Console.WriteLine($"开始同步sku刊登状态,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
daily.SynchroPPSSkuStatus();
//Console.WriteLine($"结束同步sku刊登状态,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
......
......@@ -3,5 +3,6 @@
"Default": "server=gz-cdb-kp7s5i79.sql.tencentcdb.com;port=61691;database=bailun_datacenter;uid=root;password=#7kfnymAM$Y9-Ntf;"
},
"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"
}
......@@ -3,5 +3,6 @@
"Default": "server=10.0.8.15;port=3306;database=bailun_datacenter;uid=root;password=#7kfnymAM$Y9-Ntf;"
},
"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"
}
......@@ -3,5 +3,6 @@
"Default": "server=10.0.8.15;port=3306;database=bailun_datacenter;uid=root;password=#7kfnymAM$Y9-Ntf;"
},
"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"
}
\ No newline at end of file
using AutoTurnOver.Models;
using AutoTurnOver.Models.Report;
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Text;
namespace AutoTurnOver.Services
{
public class ForecastTaskServices
{
#region 配置页面
public List<dc_report_cash_flow_forecast_task_dto> Page(dc_report_cash_flow_forecast_task_search_dto m, int offset, int limit, ref int total)
{
return DB.report_cash_flow_forecast_dao.Page(m, offset, limit, ref total);
}
public void Save(dc_report_cash_flow_forecast_task_input_dto m)
{
DB.report_cash_flow_forecast_dao.Save(m);
}
public dc_report_cash_flow_forecast_task GetById(int id)
{
return DB.report_cash_flow_forecast_dao.GetById(id);
}
#endregion
public List<dynamic> GetInfo(report_cash_flow_view_forecast_task_search_dto search)
{
var order_list = DB.report_cash_flow_forecast_dao.GetInfo(search).views;
List<dynamic> datas = new List<dynamic>();
foreach (var item in order_list)
{
dynamic o = new ExpandoObject();
o.date_type = string.Join(",", item.date_type);
o.date_type_str = item.date_type_str;
o.remarks = item.remarks;
foreach (var dat_item in item.dates)
{
var dic = (IDictionary<string, object>)o;
dic["occur_" + (dat_item.date_title)] = new { val = Math.Round(dat_item.occur_val, 2), btime = dat_item.btime, etime = dat_item.etime, data_type = item.date_type };
if (
item.date_type.Contains((int)dc_report_cash_flow_log_data_type_enum.销售数量)
//|| item.date_type==(int)dc_report_cash_flow_log_data_type_enum.利润
//|| item.date_type == (int)dc_report_cash_flow_log_data_type_enum.退款
//|| item.date_type == (int)dc_report_cash_flow_log_data_type_enum.平台费用
//|| item.date_type == (int)dc_report_cash_flow_log_data_type_enum.释放销售成本
//|| item.date_type == (int)dc_report_cash_flow_log_data_type_enum.释放头程费用
)
{
}
else
{
dic["pay_" + (dat_item.date_title)] = new { val = Math.Round(dat_item.pay_val, 2), btime = dat_item.btime, etime = dat_item.etime, data_type = item.date_type };
}
}
datas.Add(o);
}
return datas;
} public dc_report_cash_flow_forecast_task_date_dto GetDate(int id)
{
return DB.report_cash_flow_forecast_dao.GetDate(id);
}
}
}
......@@ -31,7 +31,7 @@ namespace AutoTurnOver.Controllers
/// </summary>
/// <returns></returns>
[HttpGet]
public JsonResult ListWareHouse(string type,int? areaId)
public JsonResult ListWareHouse(string type, int? areaId)
{
......@@ -137,7 +137,8 @@ namespace AutoTurnOver.Controllers
return new JsonResult(list.Select(p => new
{
id = p.Line_Code,
text = p.Line_Code + " - " + p.Line_Name
text = p.Line_Code + " - " + p.Line_Name,
type = p.Start_Point
}));
}
catch (Exception ex)
......@@ -200,7 +201,8 @@ namespace AutoTurnOver.Controllers
{
try
{
var datas = ApiServices.GetCategoryAll().Select(s=> new {
var datas = ApiServices.GetCategoryAll().Select(s => new
{
id = s.C_ID,
pId = s.C_PARENTID,
name = s.C_CNAME,
......@@ -227,7 +229,8 @@ namespace AutoTurnOver.Controllers
{
try
{
var datas = ApiServices.GetNewCategoryAll().Select(s => new {
var datas = ApiServices.GetNewCategoryAll().Select(s => new
{
id = s.id,
pId = s.parentId,
name = s.name,
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AutoTurnOver.Models.Report;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace AutoTurnOver.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class ForecastTaskController : ControllerBase
{
#region 配置页面
[HttpGet]
public JsonResult Page(int limit, int offset, string order, string sort, string bailun_sku)
{
var m = new dc_report_cash_flow_forecast_task_search_dto
{
bailun_sku = bailun_sku
};
var total = 0;
var service = new Services.ForecastTaskServices();
var list = service.Page(m, offset, limit, ref total);
return new JsonResult(new
{
rows = list,
total = total,
});
}
[HttpPost]
public JsonResult Save([FromBody]dc_report_cash_flow_forecast_task_input_dto m)
{
try
{
new Services.ForecastTaskServices().Save(m);
return new JsonResult(new
{
success =true
});
}
catch (Exception ex)
{
return new JsonResult(new
{
success = false,
message =ex.Message,
stack_trace = ex.StackTrace
});
}
}
[HttpGet]
public JsonResult GetById(int id)
{
var m = new Services.ForecastTaskServices().GetById(id);
return new JsonResult(m);
}
#endregion
[HttpGet]
public JsonResult GetInfo(int id)
{
var list = new Services.ForecastTaskServices().GetInfo(new report_cash_flow_view_forecast_task_search_dto {task_id = id });
return new JsonResult(new
{
rows = list,
total = 0,
});
}
[HttpGet]
public JsonResult GetDate(int id)
{
var m = new Services.ForecastTaskServices().GetDate(id);
return new JsonResult(m);
}
}
}
\ 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