Commit 5af9047b by 泽锋 李

fix

parent 922d8c3f
......@@ -22,6 +22,7 @@ namespace AutoGeneratePurchaseAdvise
//PurchaseAdviseServices.AutoPushBuySys(6);
//PurchaseAdviseServices.AutoPushBuySys(4);
//PurchaseAdviseServices.AutoPushBuySys(6);
}
catch (Exception ex)
{
......
......@@ -57,6 +57,28 @@ namespace AutoTurnOver.DB
});
}
public static List<LmsShipLogisticsDto> ShipLogisticsListHead()
{
string url = ConfigHelper.GetValue("Lms_GetLogistics");
string resultStr = HttpHelper.Request(url + "?startPoint=3", 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 RedisHelper.Get(RedisConsts.Lms_GetLogisticsHead, () =>
//{
//});
}
public static List<LmsShipLogisticsDto> RealTimeShipLogisticsList()
{
string url = ConfigHelper.GetValue("Lms_GetLogistics");
......
......@@ -1582,7 +1582,7 @@ and start_date<=@end_date and end_date>=@start_date
{
var sql = @"select t1.*,t3.warehouse_name from dc_auto_sales_forecast_config as t1 left join dc_base_warehouse as t3 on t1.warehouse_code = t3.warehouse_code where 1 = 1 ";
DynamicParameters parameters = new DynamicParameters();
if (m.is_delete!=null)
if (m.is_delete != null)
{
sql += " and t1.is_delete=@is_delete ";
parameters.Add("is_delete", m.is_delete);
......@@ -1679,7 +1679,7 @@ and start_date<=@end_date and end_date>=@start_date
var data = _connection.QueryFirstOrDefault<dc_auto_sales_forecast_config_dto>("select * from dc_auto_sales_forecast_config where id=@id ", new { id = id });
data.bailun_skus = string.Join(",", _connection.Query<string>(" select bailun_sku from dc_auto_sales_forecast_sku_config where config_id=@config_id ", new { config_id = id }).ToList());
data.product_codes = string.Join(",", _connection.Query<string>(" select product_code from dc_auto_sales_forecast_product_code_config where config_id=@config_id ", new { config_id = id }).ToList());
data.stages = _connection.Query<dc_auto_sales_forecast_stage_config>(" select * from dc_auto_sales_forecast_stage_config where config_id=@config_id ", new { config_id = id }).OrderBy(s=>s.index).ToList();
data.stages = _connection.Query<dc_auto_sales_forecast_stage_config>(" select * from dc_auto_sales_forecast_stage_config where config_id=@config_id ", new { config_id = id }).OrderBy(s => s.index).ToList();
return data;
}
......@@ -1690,7 +1690,7 @@ and start_date<=@end_date and end_date>=@start_date
/// <param name="id"></param>
public static void DelSalesForecastConfig(int id)
{
_connection.Execute(" update dc_auto_sales_forecast_config set is_delete=1,delete_time=now() where id=@id and is_delete=0 ", new { id = id});
_connection.Execute(" update dc_auto_sales_forecast_config set is_delete=1,delete_time=now() where id=@id and is_delete=0 ", new { id = id });
}
#endregion
......@@ -1730,7 +1730,7 @@ and start_date<=@end_date and end_date>=@start_date
try
{
m.platform_type = (m.platform_type??"");
m.platform_type = (m.platform_type ?? "");
m.web_stite = (m.web_stite ?? "");
if (m.id > 0)
{
......@@ -1914,7 +1914,7 @@ where 1 = 1 ";
if (m.id > 0)
{
var old_data = _connection.QueryFirstOrDefault<dc_auto_return_goods_config>("select * from dc_auto_return_goods_config where id=@id ",new { id = m.id});
var old_data = _connection.QueryFirstOrDefault<dc_auto_return_goods_config>("select * from dc_auto_return_goods_config where id=@id ", new { id = m.id });
if (old_data == null)
{
throw new Exception("数据不存在");
......@@ -1928,7 +1928,7 @@ where 1 = 1 ";
else
{
m.create_date = DateTime.Now;
m.create_user = user.UserName ;
m.create_user = user.UserName;
var result = _connection.Insert<dc_auto_return_goods_config>(m);
return result.HasValue && result.Value > 0 ? "" : "提交异常,请重试!";
......@@ -1948,5 +1948,51 @@ where 1 = 1 ";
#endregion
/// <summary>
/// 批量设置默认头程渠道
/// </summary>
public static void BatchSetHeadTransport(batch_set_head_transport_input_dto input_data, UserData user)
{
foreach (var bailun_sku in input_data.bailun_sku)
{
// 查询是否已经有数据
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 is_delete=0 limit 1 ", new
{
bailun_sku
});
if (dc_base_head_transport_config_old_data != null)
{
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_user = user.UserAccount;
_connection.Update(dc_base_head_transport_config_old_data);
}
_connection.Insert(new dc_base_head_transport_config
{
create_date = DateTime.Now,
delete_user = "",
delete_date = null,
bailun_sku = bailun_sku,
create_user = user.UserAccount,
head_transport = input_data.head_transport??"",
is_delete = 0,
logistics_code = input_data.logistics_code
});
var logistics_name = "";
if(string.IsNullOrWhiteSpace(input_data.logistics_code))
{
logistics_name = ApiUtility.ShipLogisticsList().FirstOrDefault(s => s.Line_Code == input_data.logistics_code).Line_Name;
}
_connection.Execute(" update dc_auto_turnover set head_transport_type=@head_transport_type,head_transport_logistics_code=@head_transport_logistics_code where bailun_sku=@bailun_sku ",new {
head_transport_type = input_data.head_transport??"",
head_transport_logistics_code = logistics_name,
bailun_sku = bailun_sku
});
}
}
}
}
......@@ -495,9 +495,6 @@ from dc_auto_turnover as dat
return _connection.QueryFirstOrDefault<dc_auto_config_promotion>("select * from dc_auto_config_promotion where id=" + id);
}
#endregion
#region 预估库存
......
......@@ -18,6 +18,11 @@ namespace AutoTurnOver.Models.ApiDto
/// 1-直邮 2-海外 3-头程
/// </summary>
public string Start_Point { get; set; }
/// <summary>
/// 运输方式 0-不限 1-陆运 2-空运 3-海运
/// </summary>
public int? TransportType { get; set; }
}
public class LmsResultDto<T>
......
......@@ -272,6 +272,16 @@ namespace AutoTurnOver.Models
public decimal history_fourteenday_sales_ebay { get; set; }
public decimal history_thirtyday_sales_ebay { get; set; }
/// <summary>
/// 默认发送的头程渠道 运输方式
/// </summary>
public string head_transport_type { get; set; }
/// <summary>
/// 默认发送的头程运输渠道
/// </summary>
public string head_transport_logistics_code { get; set; }
}
public class Condition_AutoTurnOver
......@@ -415,6 +425,8 @@ namespace AutoTurnOver.Models
public class dc_auto_turnover_list_dto
{
public string head_transport_type { get; set; }
public string head_transport_logistics_code { get; set; }
/// <summary>
/// 销量预测规则
/// </summary>
......
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models
{
public class dc_base_head_transport_config
{
public int id { get; set; }
public string bailun_sku { get; set; }
public string head_transport { get; set; }
public string logistics_code { get; set; }
public DateTime create_date { get; set; }
public string create_user { get; set; }
public int is_delete { get; set; }
public DateTime? delete_date { get; set; }
public string delete_user { get; set; }
}
/// <summary>
/// 批量设置 默认头程
/// </summary>
public class batch_set_head_transport_input_dto
{
public string head_transport { get; set; }
public string logistics_code { get; set; }
public List<string> bailun_sku { get; set; }
}
}
......@@ -187,7 +187,7 @@ namespace AutoTurnOver.Services
}
catch (Exception ex)
{
throw new Exception(" 采购推送操作异常: "+ ex.Message) ;
throw new Exception(" 采购推送操作异常: " + ex.Message);
}
}
......@@ -357,13 +357,67 @@ namespace AutoTurnOver.Services
{
try
{
if (string.IsNullOrWhiteSpace(name)) return ShipLogisticsList();
return ShipLogisticsList().Where(s =>
var datas = ShipLogisticsList();
if (!string.IsNullOrWhiteSpace(name))
{
datas = datas.Where(s =>
(s.Line_Code ?? "").Contains(name, StringComparison.OrdinalIgnoreCase)
||
(s.Line_Name ?? "").Contains(name, StringComparison.OrdinalIgnoreCase)
).ToList();
}
return datas;
}
catch (Exception ex)
{
report.AddError(new dc_task_error_log
{
date = DateTime.Now,
message = ex.Message,
stack_trace = ex.StackTrace,
task_name = "ahipLogistics_api"
});
throw;
}
}
public static List<LmsShipLogisticsDto> ShipLogisticsListHead(string name,string type)
{
try
{
var datas = ApiUtility.ShipLogisticsListHead();
if (!string.IsNullOrWhiteSpace(name))
{
datas = datas.Where(s =>
(s.Line_Code ?? "").Contains(name, StringComparison.OrdinalIgnoreCase)
||
(s.Line_Name ?? "").Contains(name, StringComparison.OrdinalIgnoreCase)
).ToList();
}
if (!string.IsNullOrWhiteSpace(type))
{
var type_int = 0;
if (type == "空运")
{
type_int = 2;
}
else if (type == "海运")
{
type_int = 3;
}
else if (type == "陆运")
{
type_int = 1;
}
datas = datas.Where(s=>s.TransportType==type_int).ToList();
}
return datas;
}
catch (Exception ex)
{
report.AddError(new dc_task_error_log
......@@ -444,7 +498,7 @@ namespace AutoTurnOver.Services
/// <summary>
/// 缺货推送 (分页推送)
/// </summary>
public static List<ShortagePush_Item_RequestDto> ShortagePush(List<dc_auto_shortage_push> datas,string platform)
public static List<ShortagePush_Item_RequestDto> ShortagePush(List<dc_auto_shortage_push> datas, string platform)
{
var err_datas = new List<ShortagePush_Item_RequestDto>();
......@@ -456,7 +510,7 @@ namespace AutoTurnOver.Services
{
var result = ShortagePushApi(new ShortagePush_RequestDto
{
platform= platform,
platform = platform,
skuType = 1,
amisSkuInfos = datas.Skip((page - 1) * rows).Take(rows).Select(s => new ShortagePush_Item_RequestDto
{
......@@ -595,7 +649,7 @@ namespace AutoTurnOver.Services
{
string url = ConfigHelper.GetValue("SkuSys_CategoryList");
string resultStr = HttpHelper.Request(url + $"?level={level}",RequestType.GET, timeout: 1000 * 60 * 60 * 24);
string resultStr = HttpHelper.Request(url + $"?level={level}", RequestType.GET, timeout: 1000 * 60 * 60 * 24);
var result = resultStr.ToObj<saas_api_result<List<bailun_category_new_dto>>>();
if (result == null)
{
......
......@@ -896,5 +896,15 @@ namespace AutoTurnOver.Services
#endregion
/// <summary>
/// 批量设置默认头程运输方式
/// </summary>
/// <param name="input_data"></param>
/// <param name="user"></param>
public void BatchSetHeadTransport(batch_set_head_transport_input_dto input_data, UserData user)
{
DB.db_config.BatchSetHeadTransport(input_data, user);
}
}
}
......@@ -8,6 +8,7 @@ namespace AutoTurnOver.Utility
{
public static string Pams_GetAccountToken = "Pams_GetAccountToken";
public static string Lms_GetLogistics = "Lms_GetLogistics";
public static string Lms_GetLogisticsHead = "Lms_GetLogisticsHead";
public static string Pams_PlatformList = "Pams_PlatformList";
public static string platform_type_website = "platform_type_website";
}
......
......@@ -154,7 +154,23 @@ namespace AutoTurnOver.Controllers
{
throw;
}
}
public JsonResult ShipLogisticsListHead(string name,string type)
{
try
{
var list = ApiServices.ShipLogisticsListHead(name, type);
return new JsonResult(list.Select(p => new
{
id = p.Line_Code,
text = p.Line_Code + " - " + p.Line_Name,
type = p.Start_Point
}));
}
catch (Exception ex)
{
throw;
}
}
public JsonResult LogisticsCompanyList()
......
......@@ -952,5 +952,22 @@ namespace AutoTurnOver.Controllers
}
#endregion
[HttpPost]
[BrowseLog("Bailun_aims", "触发【百伦自动周转系统】->【周转表】->【设置sku默认头程物流】->操作", 1)]
public JsonResult BatchSetHeadTransport([FromBody]batch_set_head_transport_input_dto m)
{
try
{
new Services.ConfigServices().BatchSetHeadTransport(m, AutoUtility.GetUser());
return new JsonResult("");
}
catch (Exception ex)
{
return new JsonResult(ex.Message);
}
}
}
}
\ No newline at end of file
......@@ -24,7 +24,7 @@
"Crm_Case_Order": "http://crm.bailuntec.com/api/CaseOrderList",
"Crm_Message": "http://crm.bailuntec.com/api/MessageList",
"Crm_Message_Reply": "http://crm.bailuntec.com/api/MessageReplyList",
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics",
"Lms_GetLogistics": "http://api.lms2.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics",
"Pams_PlatformList": "http://pams.bailuntec.com/Api/GetPlatformSites?type=1",
"Crm_Message_Custom_Template": "http://crm.bailuntec.com/api/MessageCustomTemplateList",
"CRM_SendMessage": "http://kefu.bailuntec.com/api/SendMessage",
......
......@@ -24,7 +24,7 @@
"Crm_Case_Order": "http://crm.bailuntec.com/api/CaseOrderList",
"Crm_Message": "http://crm.bailuntec.com/api/MessageList",
"Crm_Message_Reply": "http://crm.bailuntec.com/api/MessageReplyList",
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics",
"Lms_GetLogistics": "http://api.lms2.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics",
"Pams_PlatformList": "http://pams.bailuntec.com/Api/GetPlatformSites?type=1",
"Crm_Message_Custom_Template": "http://crm.bailuntec.com/api/MessageCustomTemplateList",
"CRM_SendMessage": "http://kefu.bailuntec.com/api/SendMessage",
......
......@@ -24,7 +24,7 @@
"Crm_Case_Order": "http://crm.bailuntec.com/api/CaseOrderList",
"Crm_Message": "http://crm.bailuntec.com/api/MessageList",
"Crm_Message_Reply": "http://crm.bailuntec.com/api/MessageReplyList",
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics",
"Lms_GetLogistics": "http://api.lms2.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics",
"Pams_PlatformList": "http://pams.bailuntec.com/Api/GetPlatformSites?type=1",
"Crm_Message_Custom_Template": "http://crm.bailuntec.com/api/MessageCustomTemplateList",
"CRM_SendMessage": "http://kefu.bailuntec.com/api/SendMessage",
......
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