Commit f068a928 by lizefeng

新增周转表 产品名称模糊搜索

parent 845346ac
...@@ -134,6 +134,11 @@ where 1=1 "; ...@@ -134,6 +134,11 @@ where 1=1 ";
sql += " and t3.area_id=" + m.warehousearea; sql += " and t3.area_id=" + m.warehousearea;
sqlCount += " and t3.area_id=" + m.warehousearea; sqlCount += " and t3.area_id=" + m.warehousearea;
} }
if (!string.IsNullOrWhiteSpace(m.sku_prefix))
{
sql += " and dat.bailun_sku like '" + m.sku_prefix + "%'";
sqlCount += " and dat.bailun_sku like '" + m.sku_prefix + "%'";
}
if (!string.IsNullOrEmpty(m.bailun_sku)) if (!string.IsNullOrEmpty(m.bailun_sku))
{ {
sql += " and dat.bailun_sku = '" + m.bailun_sku + "'"; sql += " and dat.bailun_sku = '" + m.bailun_sku + "'";
......
...@@ -24,6 +24,8 @@ namespace AutoTurnOver.Models.ApiDto ...@@ -24,6 +24,8 @@ namespace AutoTurnOver.Models.ApiDto
/// </summary> /// </summary>
public int type { get; set; } public int type { get; set; }
public string bp_remark { get; set; }
/// <summary> /// <summary>
/// 采购计划单sku /// 采购计划单sku
/// </summary> /// </summary>
......
...@@ -266,6 +266,11 @@ namespace AutoTurnOver.Models ...@@ -266,6 +266,11 @@ namespace AutoTurnOver.Models
public string bailun_sku { get; set; } public string bailun_sku { get; set; }
/// <summary> /// <summary>
/// sku 前缀
/// </summary>
public string sku_prefix { get; set; }
/// <summary>
/// 仓库编码 /// 仓库编码
/// </summary> /// </summary>
public string warehouse_code { get; set; } public string warehouse_code { get; set; }
......
...@@ -131,13 +131,10 @@ namespace AutoTurnOver.Services ...@@ -131,13 +131,10 @@ namespace AutoTurnOver.Services
/// 把最新一批的采购单推送到采购系统 /// 把最新一批的采购单推送到采购系统
/// </summary> /// </summary>
/// <param name="mainId"></param> /// <param name="mainId"></param>
public static void PushBuySys(List<dc_auto_purchase_advise_detailed_dto> datas,UserData user) public static void PushBuySys(List<dc_auto_purchase_advise_detailed_dto> datas, UserData user)
{ {
lock (_push_lock) lock (_push_lock)
{ {
MySqlConnection conn = connectionHelper._connection;
conn.Open();
IDbTransaction transaction = conn.BeginTransaction();
try try
{ {
//查询最近一个采购建议 //查询最近一个采购建议
...@@ -158,7 +155,8 @@ namespace AutoTurnOver.Services ...@@ -158,7 +155,8 @@ namespace AutoTurnOver.Services
bp_sendtype = 1, bp_sendtype = 1,
bp_sendfromCode = item.Key, bp_sendfromCode = item.Key,
type = item.Any(s => s.type == 2) ? 2 : item.Any(s => s.type == 1) ? 1 : 3, type = item.Any(s => s.type == 2) ? 2 : item.Any(s => s.type == 1) ? 1 : 3,
bi_buyplandetail = new List<bi_buyplandetail>() bi_buyplandetail = new List<bi_buyplandetail>(),
bp_remark = $"用户{user.UserName} 在 aims 操作推送"
}; };
data.bi_buyplandetail = item.Select(s => new bi_buyplandetail data.bi_buyplandetail = item.Select(s => new bi_buyplandetail
...@@ -167,32 +165,26 @@ namespace AutoTurnOver.Services ...@@ -167,32 +165,26 @@ namespace AutoTurnOver.Services
bd_price = s.unit_price, bd_price = s.unit_price,
bd_sku = s.bailun_sku bd_sku = s.bailun_sku
}).ToList(); }).ToList();
//把采购数量没有填的都补上 建议采购数
conn.Execute(" update dc_auto_purchase_advise_detailed set quantity_actual=quantity_final_advise where quantity_actual<=0 and id in @ids ", new { ids = datas.Select(s => s.id).ToList() }, transaction);
var result = ApiServices.PushBuyPlan(data); var result = ApiServices.PushBuyPlan(data);
if (result.IsSuccessed) if (result.IsSuccessed)
{ {
//把采购数量没有填的都补上 建议采购数
connectionHelper._connection.Execute(" update dc_auto_purchase_advise_detailed set quantity_actual=quantity_final_advise where quantity_actual<=0 and id in @ids ", new { ids = item.Select(s => s.id).ToList() });
// 把相关的采购明细都标记成已推送 // 把相关的采购明细都标记成已推送
conn.Execute(" update dc_auto_purchase_advise_detailed set ispush=1,plan_nos=@plan_nos,push_user_name=@push_user_name where id in @ids ", new { ids = item.Select(s => s.id).ToArray(), plan_nos = result.planNo, push_user_name = user.UserName }); connectionHelper._connection.Execute(" update dc_auto_purchase_advise_detailed set ispush=1,plan_nos=@plan_nos,push_user_name=@push_user_name where id in @ids ", new { ids = item.Select(s => s.id).ToArray(), plan_nos = result.planNo, push_user_name = user.UserName });
} }
planNos.Add(result.planNo); planNos.Add(result.planNo);
} }
//conn.Execute(" update dc_auto_purchase_advise set buy_sys_plan_no=CONCAT(buy_sys_plan_no,@buy_sys_plan_no),push_time=@push_time where where @detailed_ids ", new { buy_sys_plan_no = string.Join(",", planNos), push_time = now, detailed_ids = item.Select(s => s.id).ToArray() }, transaction);
transaction.Commit();
} }
catch (Exception) catch (Exception)
{ {
transaction.Rollback();
conn.Close();
throw; throw;
} }
} }
} }
} }
......
...@@ -28,12 +28,13 @@ namespace AutoTurnOver.Controllers ...@@ -28,12 +28,13 @@ namespace AutoTurnOver.Controllers
/// <param name="pagesize">每页记录数</param> /// <param name="pagesize">每页记录数</param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public JsonResult List(int limit, int offset, string order, string sort, string sku, int? IsRedundant, int? IsStockOut, string warehousecode, string warehousetype, int? warehousearea, bool? hasDefectConfig, string product_inner_code, string sku_name, string product_code, bool? hasAadvise = null, string categoryIds = null, int? monitor_status = null) public JsonResult List(int limit, int offset, string order, string sort, string sku, string sku_prefix, int? IsRedundant, int? IsStockOut, string warehousecode, string warehousetype, int? warehousearea, bool? hasDefectConfig, string product_inner_code, string sku_name, string product_code, bool? hasAadvise = null, string categoryIds = null, int? monitor_status = null)
{ {
var m = new Condition_AutoTurnOver var m = new Condition_AutoTurnOver
{ {
bailun_sku = sku, bailun_sku = sku,
sku_prefix = sku_prefix,
out_of_stock = IsStockOut, out_of_stock = IsStockOut,
redundancy = IsRedundant, redundancy = IsRedundant,
warehouse_code = warehousecode, warehouse_code = warehousecode,
...@@ -91,11 +92,12 @@ namespace AutoTurnOver.Controllers ...@@ -91,11 +92,12 @@ namespace AutoTurnOver.Controllers
}); });
} }
public JsonResult ListSumFooter(int limit, int offset, string order, string sort, string sku, int? IsRedundant, int? IsStockOut, string warehousecode, string warehousetype, int? warehousearea, bool? hasDefectConfig, string product_inner_code, string sku_name, string product_code, bool? hasAadvise = null, string categoryIds = null, int? monitor_status = null) public JsonResult ListSumFooter(int limit, int offset, string order, string sort, string sku,string sku_prefix, int? IsRedundant, int? IsStockOut, string warehousecode, string warehousetype, int? warehousearea, bool? hasDefectConfig, string product_inner_code, string sku_name, string product_code, bool? hasAadvise = null, string categoryIds = null, int? monitor_status = null)
{ {
var m = new Condition_AutoTurnOver var m = new Condition_AutoTurnOver
{ {
bailun_sku = sku, bailun_sku = sku,
sku_prefix = sku_prefix,
out_of_stock = IsStockOut, out_of_stock = IsStockOut,
redundancy = IsRedundant, redundancy = IsRedundant,
warehouse_code = warehousecode, warehouse_code = warehousecode,
...@@ -122,11 +124,12 @@ namespace AutoTurnOver.Controllers ...@@ -122,11 +124,12 @@ namespace AutoTurnOver.Controllers
/// <param name="sku"></param> /// <param name="sku"></param>
/// <param name="warehousecode"></param> /// <param name="warehousecode"></param>
/// <returns></returns> /// <returns></returns>
public FileResult Export(int limit, int offset, string order, string sort, string sku, int? IsRedundant, int? IsStockOut, string warehousecode, string warehousetype, int? warehousearea, bool? hasDefectConfig, string product_inner_code, string sku_name, string product_code, bool? hasAadvise = null, string categoryIds = null, int? monitor_status = null) public FileResult Export(int limit, int offset, string order, string sort, string sku,string sku_prefix, int? IsRedundant, int? IsStockOut, string warehousecode, string warehousetype, int? warehousearea, bool? hasDefectConfig, string product_inner_code, string sku_name, string product_code, bool? hasAadvise = null, string categoryIds = null, int? monitor_status = null)
{ {
var m = new Condition_AutoTurnOver var m = new Condition_AutoTurnOver
{ {
bailun_sku = sku, bailun_sku = sku,
sku_prefix = sku_prefix,
out_of_stock = IsStockOut, out_of_stock = IsStockOut,
redundancy = IsRedundant, redundancy = IsRedundant,
warehouse_code = warehousecode, warehouse_code = warehousecode,
......
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