|
|
@@ -477,59 +477,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services |
|
|
|
} |
|
|
|
var source = file.OpenReadStream(); |
|
|
|
var mapper = new Mapper(source); |
|
|
|
|
|
|
|
|
|
|
|
_db.Ado.BeginTran(); |
|
|
|
//添加 设备_烹饪工序模型 |
|
|
|
#region 添加 设备_烹饪工序模型 |
|
|
|
//ReadExcel<GoodstechnologyModel> readGoodstechnologyExcel = new(); |
|
|
|
//var GoodstechnologyModellist = readGoodstechnologyExcel.ExcelToList(source, mapper, "设备_烹饪工序模型"); |
|
|
|
//List<BPA_GoodsTechnology> GoodsTechnologyList = new(); |
|
|
|
//List<BPA_TechnologyAction> GoodsTechnologyActionList = new(); |
|
|
|
//string currennaid = ""; |
|
|
|
//for (int i = 0; i < GoodstechnologyModellist.Count; i++) |
|
|
|
//{ |
|
|
|
// if (!string.IsNullOrWhiteSpace(GoodstechnologyModellist[i].Name)) |
|
|
|
// { |
|
|
|
// BPA_GoodsTechnology item = new BPA_GoodsTechnology() |
|
|
|
// { |
|
|
|
// Id = Guid.NewGuid().ToString(), |
|
|
|
// Name = GoodstechnologyModellist[i].Name, |
|
|
|
// Status = 0, |
|
|
|
// CreateAt = DateTime.Now, |
|
|
|
// GroupId = groupId, |
|
|
|
// IsDeleted = 0, |
|
|
|
// }; |
|
|
|
// GoodsTechnologyList.Add(item); |
|
|
|
// currennaid = item.Id; |
|
|
|
// } |
|
|
|
// var actvalueary = GoodstechnologyModellist[i].ActionValue?.Split('、'); |
|
|
|
// BPA_TechnologyAction technologyAction = new() |
|
|
|
// { |
|
|
|
// Id = Guid.NewGuid().ToString(), |
|
|
|
// GoodstechnologyId = currennaid, |
|
|
|
// ActionName = GoodstechnologyModellist[i].ActionName, |
|
|
|
// ActionType = GoodstechnologyModellist[i].ActionType, |
|
|
|
// Sort = i, |
|
|
|
// GroupId = groupId, |
|
|
|
// CreateAt = DateTime.Now, |
|
|
|
// //ActionValue = GoodstechnologyModellist[i].ActionValue, |
|
|
|
// }; |
|
|
|
// List<ActionValueModel> ActionValueModelList = new(); |
|
|
|
// if (actvalueary != null) |
|
|
|
// { |
|
|
|
// foreach (var item in actvalueary) |
|
|
|
// { |
|
|
|
// ActionValueModelList.Add(new ActionValueModel() { actionValueName = item }); |
|
|
|
// } |
|
|
|
// technologyAction.ActionValue = JsonConvert.SerializeObject(ActionValueModelList); |
|
|
|
// } |
|
|
|
// GoodsTechnologyActionList.Add(technologyAction); |
|
|
|
//} |
|
|
|
//await _db.Insertable(GoodsTechnologyList).ExecuteCommandAsync(); |
|
|
|
//await _db.Insertable(GoodsTechnologyActionList).ExecuteCommandAsync(); |
|
|
|
#endregion |
|
|
|
|
|
|
|
//添加 商品_物料信息 |
|
|
|
#region 添加 商品_物料信息 |
|
|
|
|
|
|
@@ -576,7 +524,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services |
|
|
|
{ |
|
|
|
Aittribute = 0, |
|
|
|
Batching_Name = t.BatchingName, |
|
|
|
Code = Guid.NewGuid().ToString(), |
|
|
|
Code = GetNumber2(), |
|
|
|
IsDeleted = 0, |
|
|
|
netrecovery = 0, |
|
|
|
outstockUint = unit.Id, |
|
|
@@ -603,6 +551,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services |
|
|
|
if (thisitem != null) |
|
|
|
{ |
|
|
|
item2.Id = thisitem.Id; |
|
|
|
item2.GroupId = thisitem.GroupId; |
|
|
|
_db.Updateable(item2).ExecuteCommand(); |
|
|
|
} |
|
|
|
else |
|
|
@@ -641,6 +590,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services |
|
|
|
}; |
|
|
|
|
|
|
|
type=await _db.Insertable(parentType).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); |
|
|
|
parentType = type; |
|
|
|
} |
|
|
|
//属性 |
|
|
|
var goodsAttribute = await _db.Queryable<BPA_GoodsAttribute>() |
|
|
@@ -650,7 +600,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services |
|
|
|
goodsAttribute = new BPA_GoodsAttribute() |
|
|
|
{ |
|
|
|
AttributeName = "默认属性", |
|
|
|
GoodsTypeId = type.Id, |
|
|
|
GoodsTypeId = parentType.Id, |
|
|
|
IsDeleted = 0, |
|
|
|
Sort = 0, |
|
|
|
|
|
|
@@ -696,7 +646,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services |
|
|
|
var imagePath = images.FirstOrDefault(x => x.Index == index); |
|
|
|
goodsInfo.Add(new BPA_GoodsInfo() |
|
|
|
{ |
|
|
|
Code = Guid.NewGuid().ToString(), |
|
|
|
Code = GetNumber2(), |
|
|
|
CreateAt = DateTime.Now, |
|
|
|
CreateBy = userId, |
|
|
|
DefaultMate = null, |
|
|
@@ -708,7 +658,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services |
|
|
|
ImgUrl = imagePath?.ImgesPath, |
|
|
|
Name = item.Name, |
|
|
|
Sort = 0, |
|
|
|
GoodsTypeId = type.Id, |
|
|
|
GoodsTypeId = parentType.Id, |
|
|
|
Price = 0, |
|
|
|
IsAttrubute = false, |
|
|
|
IsDeleted = 0, |
|
|
@@ -732,6 +682,8 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services |
|
|
|
if (thisitem != null) |
|
|
|
{ |
|
|
|
item2.Id = thisitem.Id; |
|
|
|
item2.AutoKey = thisitem.AutoKey; |
|
|
|
item2.GroupId= thisitem.GroupId; |
|
|
|
_db.Updateable(item2).ExecuteCommand(); |
|
|
|
} |
|
|
|
else |
|
|
@@ -842,12 +794,9 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services |
|
|
|
|
|
|
|
var data = await _db.Queryable<BPA_Technology>() |
|
|
|
.Where(x => x.Name == thisName && x.DeviceVersionId == device.ProductVersionId).FirstAsync(); |
|
|
|
var data2 = new BPA_TechnologyAction(); |
|
|
|
if (data != null) |
|
|
|
{ |
|
|
|
data2 = await _db.Queryable<BPA_TechnologyAction>() |
|
|
|
.Where(x => x.ActionName == goodTechnologyModel[i].Configuration && x.TechnologyId == data.Id).FirstAsync(); |
|
|
|
} |
|
|
|
if (data == null) throw Oops.Oh("该设备还没有设置工艺基础信息"); |
|
|
|
var data2 = await _db.Queryable<BPA_TechnologyAction>() |
|
|
|
.Where(x => x.ActionName == goodTechnologyModel[i].Configuration && x.TechnologyId == data.Id).FirstAsync(); |
|
|
|
var batching = new BPA_Batching(); |
|
|
|
var IsBatch = goodTechnologyModel[i].Name != "液体料"; |
|
|
|
|
|
|
@@ -897,15 +846,15 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services |
|
|
|
|
|
|
|
var json = info.Where(x => x.chnologyId == thisItem.ChnologyId && x.index == thisItem.Index).ToList(); |
|
|
|
|
|
|
|
if (thisItem.StepName == "液体料") |
|
|
|
{ |
|
|
|
foreach (var item in json) |
|
|
|
{ |
|
|
|
var batching = await _db.Queryable<BPA_Batching>() |
|
|
|
.FirstAsync(x => x.Batching_Name == item.actionName); |
|
|
|
item.technologyactionId = batching?.Id; |
|
|
|
} |
|
|
|
} |
|
|
|
//if (thisItem.StepName == "液体料") |
|
|
|
//{ |
|
|
|
// foreach (var item in json) |
|
|
|
// { |
|
|
|
// var batching = await _db.Queryable<BPA_Batching>() |
|
|
|
// .FirstAsync(x => x.Batching_Name == item.actionName); |
|
|
|
// item.technologyactionId = batching?.Id; |
|
|
|
// } |
|
|
|
//} |
|
|
|
if (thisItem.StepName == "主料") |
|
|
|
{ |
|
|
|
var v1 = json.FirstOrDefault(x => x.actionName == "主料名称"); |
|
|
@@ -983,13 +932,13 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services |
|
|
|
} |
|
|
|
if (value.ToString().Trim() == goodsName.Trim()) |
|
|
|
{ |
|
|
|
ColumnAttribute attribute = (ColumnAttribute)item2.GetCustomAttribute(typeof(ColumnAttribute), false); |
|
|
|
return attribute?.Name; |
|
|
|
//if (item2.IsDefined(typeof(ColumnAttribute), false)) |
|
|
|
//{ |
|
|
|
// ColumnAttribute attribute = (ColumnAttribute)item2.GetCustomAttribute(typeof(ColumnAttribute), false); |
|
|
|
// return attribute.Name; |
|
|
|
//} |
|
|
|
//ColumnAttribute attribute = (ColumnAttribute)item2.GetCustomAttribute(typeof(ColumnAttribute), false); |
|
|
|
//return attribute?.Name; |
|
|
|
if (item2.IsDefined(typeof(Npoi.Mapper.Attributes.ColumnAttribute), false)) |
|
|
|
{ |
|
|
|
Npoi.Mapper.Attributes.ColumnAttribute attribute = (Npoi.Mapper.Attributes.ColumnAttribute)item2.GetCustomAttribute(typeof(Npoi.Mapper.Attributes.ColumnAttribute), false); |
|
|
|
return attribute.Name; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return ""; |
|
|
@@ -1056,7 +1005,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services |
|
|
|
{ |
|
|
|
Id = goodsTechnologyId == null ? Guid.NewGuid().ToString() : goodsTechnologyId.Id, |
|
|
|
Name = GoodstechnologyModellist[i].Name, |
|
|
|
|
|
|
|
DeviceVersionId = deviceVersion.Id |
|
|
|
}; |
|
|
|
GoodsTechnologyList.Add(item); |
|
|
@@ -1075,6 +1023,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services |
|
|
|
ActionName = GoodstechnologyModellist[i].ActionName, |
|
|
|
ActionType = CharacterConversion(GoodstechnologyModellist[i].ActionType), |
|
|
|
Sort = i, |
|
|
|
TechnologyType = GoodstechnologyModellist[i].TechnologyType == "物料" ? TechnologyEnums.Batch : TechnologyEnums.Other, |
|
|
|
CreateAt = DateTime.Now, |
|
|
|
//ActionValue = GoodstechnologyModellist[i].ActionValue, |
|
|
|
}; |
|
|
|