Commit 079584c4 by 泽锋 李

子母sku支持配置主sku

parent bddfb803
......@@ -241,6 +241,51 @@ where t1.mother_sku_warehouse_code in @mother_sku_warehouse_codes ", new
}
}
/// <summary>
/// 设置主sku
/// </summary>
/// <param name="input_data"></param>
public static void SetMainMap(remove_map_input_dto input_data, UserData user)
{
var conn = MyMySqlConnection._connection;
conn.Open();
using (var t = conn.BeginTransaction())
{
try
{
foreach (var item in input_data.map_ids)
{
var map_data = conn.QueryFirstOrDefault<dc_base_mother_sku_map_dto>(" select t1.*,t2.warehouse_name from dc_base_mother_sku_map as t1 left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code where t1.id=@id ", new { id = item });
conn.Insert(new dc_base_mother_sku_log
{
action = $"设置主sku 【{map_data.bailun_sku}】 【{map_data.warehouse_code}】 【{map_data.warehouse_name}】 ",
warehouse_code = map_data.mother_sku_warehouse_code,
create_date = DateTime.Now,
create_user = user.UserName,
sku = map_data.mother_sku,
sku_warehouse_code = map_data.mother_sku_warehouse_code
});
conn.Execute(" update dc_base_mother_sku_map set is_main=0 where mother_sku_warehouse_code=@mother_sku_warehouse_code ", new { mother_sku_warehouse_code = map_data.mother_sku_warehouse_code });
conn.Execute(" update dc_base_mother_sku_map set is_main=1 where id=@id ", new { id = item });
//ResetStorageCapacity(map_data.mother_sku, map_data.mother_warehouse_code, user);
}
t.Commit();
}
catch (Exception ex)
{
t.Rollback();
}
}
}
/// <summary>
/// 批量设置母sku
......@@ -298,7 +343,8 @@ where t1.mother_sku_warehouse_code in @mother_sku_warehouse_codes ", new
mother_sku = mother_data.sku,
mother_sku_warehouse_code = mother_data.sku_warehouse_code,
mother_warehouse_code = mother_data.warehouse_code,
bailun_sku_warehouse_code = $"{trunData.bailun_sku}{trunData.warehouse_code}"
bailun_sku_warehouse_code = $"{trunData.bailun_sku}{trunData.warehouse_code}",
is_main = input_data.is_main
});
}
......
......@@ -34,6 +34,11 @@ namespace AutoTurnOver.Models
public string bailun_sku { get; set; }
public string warehouse_code { get; set; }
public string bailun_sku_warehouse_code { get; set; }
/// <summary>
/// 是否主sku
/// </summary>
public int is_main { get; set; }
}
public class dc_base_mother_sku_log
{
......@@ -100,5 +105,6 @@ namespace AutoTurnOver.Models
{
public List<int> ids { get; set; }
public int mother_id { get; set; }
public int is_main { get; set; }
}
}
......@@ -36,6 +36,10 @@ namespace AutoTurnOver.Services
{
dc_base_mother_sku_dao.RemoveMap(data, user);
}
public void SetMainMap(remove_map_input_dto data, UserData user)
{
dc_base_mother_sku_dao.SetMainMap(data, user);
}
public void BatchSet(batch_set_input_dto input_data, UserData user)
{
......@@ -69,6 +73,7 @@ namespace AutoTurnOver.Services
var month_warehouse_code = row["母仓库编码"].ToString();
var bailun_sku = row["子SKU"].ToString();
var warehouse_code = row["子仓库编码"].ToString();
var is_main = row["是否主sku"].ToString();
if (string.IsNullOrWhiteSpace(mother_bailun_sku)) throw new Exception("母SKU必填");
if (string.IsNullOrWhiteSpace(month_warehouse_code)) throw new Exception("母warehouse_code必填");
......@@ -96,7 +101,7 @@ namespace AutoTurnOver.Services
dc_base_mother_sku_dao.Save(new dc_base_mother_sku()
{
warehouse_code = month_warehouse_code,
sku = mother_bailun_sku
sku = mother_bailun_sku,
}, user);
......@@ -114,7 +119,8 @@ namespace AutoTurnOver.Services
}) ?? 0,
ids = new List<int> {
trun_data_id
}
},
is_main = (is_main=="是"?1:0)
}, user);
......
......@@ -115,6 +115,22 @@ namespace AutoTurnOver.Controllers
}
[HttpPost]
[BrowseLog("Bailun_aims", "触发【百伦自动周转系统】->【自动周转列表】->【设置母sku】->【保存】操作", 1)]
public JsonResult SetMainMap([FromBody]remove_map_input_dto m)
{
try
{
var user = AutoUtility.GetUser();
new Services.MotherSkuServices().SetMainMap(m, user);
return new JsonResult(new { success =true});
}
catch (Exception ex)
{
return new JsonResult(new { success = false,message = ex.Message });
}
}
[HttpPost]
[BrowseLog("Bailun_aims", "触发【百伦自动周转系统】->【自动周转列表】->【设置母sku】->【保存】操作", 1)]
public JsonResult BatchSet([FromBody]batch_set_input_dto m)
{
try
......
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