Commit 28fe0ea4 by lizefeng

异常突增配置支持只配置仓库类型

parent 85e36b41
...@@ -1369,6 +1369,10 @@ and start_date<=@end_date and end_date>=@start_date ...@@ -1369,6 +1369,10 @@ and start_date<=@end_date and end_date>=@start_date
public static string SaveUprushConfig(Models.dc_auto_uprush_config m, string username) public static string SaveUprushConfig(Models.dc_auto_uprush_config m, string username)
{ {
if (string.IsNullOrWhiteSpace(m.warehouse_code))
{
m.warehouse_code = "";
}
var obj = _connection.QueryFirstOrDefault<Models.dc_auto_uprush_config>("select * from dc_auto_uprush_config where id=" + m.id); var obj = _connection.QueryFirstOrDefault<Models.dc_auto_uprush_config>("select * from dc_auto_uprush_config where id=" + m.id);
if (obj == null) if (obj == null)
{ {
...@@ -1380,15 +1384,29 @@ and start_date<=@end_date and end_date>=@start_date ...@@ -1380,15 +1384,29 @@ and start_date<=@end_date and end_date>=@start_date
obj.id = m.id; obj.id = m.id;
obj.warehouse_code = m.warehouse_code; obj.warehouse_code = m.warehouse_code;
obj.percentage = m.percentage; obj.percentage = m.percentage;
obj.hq_type = m.hq_type;
// 检查该数据是否有存在 // 检查该数据是否有存在
if (!string.IsNullOrWhiteSpace(m.warehouse_code))
{
var oldData = _connection.QueryFirstOrDefault(" select * from dc_auto_uprush_config where warehouse_code=@warehouse_code and id!=@id ", new { m.warehouse_code, m.id }); var oldData = _connection.QueryFirstOrDefault(" select * from dc_auto_uprush_config where warehouse_code=@warehouse_code and id!=@id ", new { m.warehouse_code, m.id });
if (oldData != null) if (oldData != null)
{ {
return $" 仓库:【{m.warehouse_code}】已经配置过了 "; return $" 仓库:【{m.warehouse_code}】已经配置过了 ";
} }
}
// 检查该数据是否有存在
if (!string.IsNullOrWhiteSpace(m.hq_type))
{
var oldData = _connection.QueryFirstOrDefault(" select * from dc_auto_uprush_config where hq_type=@hq_type and id!=@id ", new { m.hq_type, m.id });
if (oldData != null)
{
return $" 仓库类型:【{m.hq_type}】已经配置过了 ";
}
}
try try
{ {
......
...@@ -16,6 +16,8 @@ namespace AutoTurnOver.Models ...@@ -16,6 +16,8 @@ namespace AutoTurnOver.Models
/// 增长百分比 /// 增长百分比
/// </summary> /// </summary>
public decimal percentage { get; set; } public decimal percentage { get; set; }
public string hq_type { get; set; }
} }
public class dc_auto_uprush_config_dto : dc_auto_uprush_config public class dc_auto_uprush_config_dto : dc_auto_uprush_config
......
...@@ -716,17 +716,21 @@ namespace AutoTurnOver.Services ...@@ -716,17 +716,21 @@ namespace AutoTurnOver.Services
public string SaveUprushConfig(Models.dc_auto_uprush_config m, string username) public string SaveUprushConfig(Models.dc_auto_uprush_config m, string username)
{ {
if (string.IsNullOrWhiteSpace(m.warehouse_code)) if (string.IsNullOrWhiteSpace(m.warehouse_code) && string.IsNullOrWhiteSpace(m.hq_type))
{ {
return "请选择仓库!"; return "请选择仓库或仓库类型!";
} }
if (!string.IsNullOrWhiteSpace(m.warehouse_code))
{
// 查询百伦sku // 查询百伦sku
var objWarehouse = DB.common.GetWareHouseByCode(m.warehouse_code); var objWarehouse = DB.common.GetWareHouseByCode(m.warehouse_code);
if (objWarehouse == null) if (objWarehouse == null)
{ {
return "系统找不到该仓库。"; return "系统找不到该仓库。";
} }
}
return DB.db_config.SaveUprushConfig(m, username); return DB.db_config.SaveUprushConfig(m, username);
} }
......
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