Commit ba530339 by 泽锋 李

新增缺货规则配置

parent 30e1a7db
...@@ -92,6 +92,23 @@ namespace AutoTurnOver.DB ...@@ -92,6 +92,23 @@ namespace AutoTurnOver.DB
return _connection.Query<supplier_dto>(sql,new { suppliers_name = $"%{name}%" }).AsList(); return _connection.Query<supplier_dto>(sql,new { suppliers_name = $"%{name}%" }).AsList();
} }
} }
/// <summary>
/// 查询供应商 2
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static List<supplier_dto> SearchSupplier2(string name)
{
if (string.IsNullOrWhiteSpace(name))
{
return new List<supplier_dto>();
}
else
{
var sql = " select `name` as 'name',id as 'id' from dc_base_supplier where `name` like @suppliers_name ";
return _connection.Query<supplier_dto>(sql,new { suppliers_name = $"%{name}%" }).AsList();
}
}
/// <summary> /// <summary>
/// 查询采购员 /// 查询采购员
......
...@@ -1836,41 +1836,60 @@ where 1 = 1 "; ...@@ -1836,41 +1836,60 @@ where 1 = 1 ";
} }
//public static string SaveReturnGoodsConfig(dc_auto_return_goods_config m) public static string SaveReturnGoodsConfig(dc_auto_return_goods_config m, UserData user)
//{ {
// try try
// { {
// var commData = companyList.SingleOrDefault(s => m.company_code.Equals(s.Company_Code));
// if (commData == null) if (!string.IsNullOrWhiteSpace(m.suppliers_name))
// { {
// throw new Exception("系统异常 供应商不存在"); var supplierData = _connection.QueryFirstOrDefault<dc_base_supplier>(" select * from dc_base_supplier where `name`=@name ", new { name = m.suppliers_name });
// } if (supplierData == null)
// m.company_name = commData.Company_Name; {
// if (m.id > 0) throw new Exception("系统异常 供应商不存在");
// { }
// var result = _connection.Update<dc_report_logistics_company_config>(m); m.suppliers_id = supplierData.id;
}
// return result > 0 ? "" : "保存异常,请重试!"; else
// } {
// else m.suppliers_id = 0;
// { }
// var result = _connection.Insert<dc_report_logistics_company_config>(m);
// return result.HasValue && result.Value > 0 ? "" : "提交异常,请重试!"; 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});
// catch (Exception ex) if (old_data == null)
// { {
// return ex.Message; throw new Exception("数据不存在");
// } }
//} m.create_date = old_data.create_date;
m.create_user = old_data.create_user;
var result = _connection.Update<dc_auto_return_goods_config>(m);
//public static dc_report_logistics_company_config GetLogisticsCompanyConfigById(int id)
//{ return result > 0 ? "" : "保存异常,请重试!";
// return _connection.QueryFirstOrDefault<dc_report_logistics_company_config>("select * from dc_report_logistics_company_config where id=" + id); }
//} else
{
m.create_date = DateTime.Now;
m.create_user = user.UserName ;
var result = _connection.Insert<dc_auto_return_goods_config>(m);
return result.HasValue && result.Value > 0 ? "" : "提交异常,请重试!";
}
}
catch (Exception ex)
{
return ex.Message;
}
}
public static dc_auto_return_goods_config_dto GetReturnGoodsConfigById(int id)
{
return _connection.QueryFirstOrDefault<dc_auto_return_goods_config_dto>("select * from dc_auto_return_goods_config where id=" + id);
}
#endregion #endregion
......
...@@ -90,7 +90,7 @@ left join dc_base_tort as t8 on dat.bailun_sku = t8.bailun_sku ...@@ -90,7 +90,7 @@ left join dc_base_tort as t8 on dat.bailun_sku = t8.bailun_sku
-- left join dc_auto_config_sku_label as t11 on dat.bailun_sku = t11.bailun_sku -- left join dc_auto_config_sku_label as t11 on dat.bailun_sku = t11.bailun_sku
left join dc_return_goods_not_push as t12 on dat.bailun_sku = t12.bailun_sku and dat.warehouse_code = t12.warehouse_code left join dc_return_goods_not_push as t12 on dat.bailun_sku = t12.bailun_sku and dat.warehouse_code = t12.warehouse_code
left join dc_mid_transit as t13 on dat.bailun_sku = t13.bailun_sku and dat.warehouse_code = t13.warehouse_code left join dc_mid_transit as t13 on dat.bailun_sku = t13.bailun_sku and dat.warehouse_code = t13.warehouse_code
left join dc_auto_sales_forecast_config as t14 on dat.dc_auto_sales_forecast_stage_config_id = t14.id left join dc_auto_sales_forecast_config as t14 on dat.dc_auto_sales_forecast_config_id = t14.id
where 1=1 "; where 1=1 ";
} }
......
...@@ -76,5 +76,6 @@ namespace AutoTurnOver.DB ...@@ -76,5 +76,6 @@ namespace AutoTurnOver.DB
new_task_synchro_log.status = 1; new_task_synchro_log.status = 1;
conn.Update(new_task_synchro_log); conn.Update(new_task_synchro_log);
} }
} }
} }
...@@ -45,10 +45,6 @@ namespace AutoTurnOver.Models ...@@ -45,10 +45,6 @@ namespace AutoTurnOver.Models
/// 仓库名称 /// 仓库名称
/// </summary> /// </summary>
public string warehouse_name { get; set; } public string warehouse_name { get; set; }
/// <summary>
/// 供应商
/// </summary>
public string suppliers_name { get; set; }
public string rule_str { get public string rule_str { get
{ {
...@@ -58,6 +54,8 @@ namespace AutoTurnOver.Models ...@@ -58,6 +54,8 @@ namespace AutoTurnOver.Models
public class dc_auto_return_goods_config_search_dto public class dc_auto_return_goods_config_search_dto
{ {
public int? offset { get; set; }
public int? limit { get; set; }
public string warehouse_code { get; set; } public string warehouse_code { get; set; }
public string warehousetype { get; set; } public string warehousetype { get; set; }
...@@ -74,10 +72,7 @@ namespace AutoTurnOver.Models ...@@ -74,10 +72,7 @@ namespace AutoTurnOver.Models
public enum dc_auto_return_goods_config_status_enum public enum dc_auto_return_goods_config_status_enum
{ {
正常 = 0, 正常 = 0,
删除 = -1, 删除 = -1
审核通过 = 1,
驳回 = -2,
已推送 = 2
} }
} }
...@@ -28,6 +28,10 @@ namespace AutoTurnOver.Services ...@@ -28,6 +28,10 @@ namespace AutoTurnOver.Services
{ {
return DB.common.SearchSupplier(name); return DB.common.SearchSupplier(name);
} }
public List<supplier_dto> SearchSupplier2(string name)
{
return DB.common.SearchSupplier2(name);
}
public List<purchase_user_dto> SearchPurchaseUser(string name) public List<purchase_user_dto> SearchPurchaseUser(string name)
{ {
......
...@@ -861,5 +861,38 @@ namespace AutoTurnOver.Services ...@@ -861,5 +861,38 @@ namespace AutoTurnOver.Services
} }
#endregion #endregion
#region 退货规则配置
public List<dc_auto_return_goods_config_dto> ReturnGoodsConfigPage(dc_auto_return_goods_config_search_dto m, int offset, int limit, ref int total)
{
return DB.db_config.ReturnGoodsConfigPage(m, offset, limit, ref total);
}
public string SaveReturnGoodsConfig(dc_auto_return_goods_config m,UserData user)
{
if (string.IsNullOrWhiteSpace(m.warehouse_code))
{
throw new Exception("请选择仓库");
}
if(m.first_inbound_days_min==0 && m.first_inbound_days_max==0)
{
throw new Exception("请填写入库天数");
}
if (m.sales_average_upper_limit == 0)
{
throw new Exception("请填写日均加权销量上限");
}
return DB.db_config.SaveReturnGoodsConfig(m,user);
}
public dc_auto_return_goods_config_dto GetReturnGoodsConfigById(int id)
{
return DB.db_config.GetReturnGoodsConfigById(id);
}
#endregion
} }
} }
...@@ -68,7 +68,6 @@ namespace AutoTurnOver.Controllers ...@@ -68,7 +68,6 @@ namespace AutoTurnOver.Controllers
return Redirect("http://sso.bailuntec.com/?returnUrl=http://aims.bailuntec.com"); return Redirect("http://sso.bailuntec.com/?returnUrl=http://aims.bailuntec.com");
} }
/// <summary> /// <summary>
/// 获取仓库国家列表 /// 获取仓库国家列表
/// </summary> /// </summary>
...@@ -79,7 +78,6 @@ namespace AutoTurnOver.Controllers ...@@ -79,7 +78,6 @@ namespace AutoTurnOver.Controllers
return new JsonResult(list); return new JsonResult(list);
} }
public JsonResult GetCategoryList() public JsonResult GetCategoryList()
{ {
var datas = ApiServices.GetCategoryList(); var datas = ApiServices.GetCategoryList();
...@@ -102,6 +100,16 @@ namespace AutoTurnOver.Controllers ...@@ -102,6 +100,16 @@ namespace AutoTurnOver.Controllers
})); }));
} }
public JsonResult SearchSupplier2(string name)
{
var list = new CommonServices().SearchSupplier2(name);
return new JsonResult(list.Select(p => new
{
id = p.name,
text = p.name
}));
}
public JsonResult SearchPurchaseUser(string name) public JsonResult SearchPurchaseUser(string name)
{ {
var list = new CommonServices().SearchPurchaseUser(name); var list = new CommonServices().SearchPurchaseUser(name);
......
...@@ -914,5 +914,43 @@ namespace AutoTurnOver.Controllers ...@@ -914,5 +914,43 @@ namespace AutoTurnOver.Controllers
} }
#endregion #endregion
#region 退货规则配置
[HttpGet]
[BrowseLog("Bailun_aims", "访问【百伦自动周转系统】->【配置】->【退货规则配置】->【搜索】页面", 0)]
public JsonResult ReturnGoodsConfigPage([FromQuery]dc_auto_return_goods_config_search_dto search)
{
var total = 0;
var service = new Services.ConfigServices();
var list = service.ReturnGoodsConfigPage(search, search.offset??0, search.limit??0, ref total);
return new JsonResult(new
{
rows = list,
total = total,
});
}
[HttpPost]
[BrowseLog("Bailun_aims", "触发【百伦自动周转系统】->【配置】->【退货规则配置】->【新增】->【保存】操作", 1)]
public JsonResult SaveReturnGoodsConfig([FromBody]dc_auto_return_goods_config m)
{
var result = new Services.ConfigServices().SaveReturnGoodsConfig(m, AutoUtility.GetUser());
return new JsonResult(result);
}
[HttpGet]
public JsonResult GetReturnGoodsConfigById(int id)
{
var m = new Services.ConfigServices().GetReturnGoodsConfigById(id);
return new JsonResult(m);
}
#endregion
} }
} }
\ 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