|
|
@@ -71,37 +71,74 @@ namespace BPA.SAAS.Manage.Application.Device.Services |
|
|
|
Status = CommonStatus.ENABLE |
|
|
|
}).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); |
|
|
|
var Product = _db.Queryable<BPA_Product>().Where(x => x.Id == inputDto.ProductId).First(); |
|
|
|
#region 添加默认功能和topics |
|
|
|
List<BPA_ProductTopics> list = new(); |
|
|
|
var goodspushtopics = new BPA_ProductTopics() |
|
|
|
{ |
|
|
|
Topics = " /" + Product.Key + "/" + inputDto.Vesion + "/${deviceKey}/defaul/goodspush", |
|
|
|
TopicsType = 2, |
|
|
|
TopicsType = TopicsTypeEnum.SUBSCRIBE, |
|
|
|
Description = "商品数据下发", |
|
|
|
ProductId = inputDto.ProductId, |
|
|
|
ProductVesionId = res.Id, |
|
|
|
Name = "商品数据下发", |
|
|
|
IsDefault = true |
|
|
|
}; |
|
|
|
var goodspushtopics_reply = new BPA_ProductTopics() |
|
|
|
{ |
|
|
|
Topics = " /" + Product.Key + "/" + inputDto.Vesion + "/${deviceKey}/defaul/goodspush_reply", |
|
|
|
TopicsType = TopicsTypeEnum.PUBLISH, |
|
|
|
Description = "响应商品数据下发", |
|
|
|
ProductId = inputDto.ProductId, |
|
|
|
ProductVesionId = res.Id, |
|
|
|
Name = "商品数据下发", |
|
|
|
IsDefault = true |
|
|
|
}; |
|
|
|
var batchingpushtopics = new BPA_ProductTopics() |
|
|
|
{ |
|
|
|
Topics = " /" + Product.Key + "/" + inputDto.Vesion + "/${deviceKey}/defaul/batvhingpush", |
|
|
|
TopicsType = 2, |
|
|
|
TopicsType = TopicsTypeEnum.PUBLISH, |
|
|
|
Description = "物料数据下发", |
|
|
|
ProductId = inputDto.ProductId, |
|
|
|
ProductVesionId = res.Id, |
|
|
|
Name = "物料数据下发", |
|
|
|
IsDefault = true |
|
|
|
}; |
|
|
|
var batchingpushtopics_reply = new BPA_ProductTopics() |
|
|
|
{ |
|
|
|
Topics = " /" + Product.Key + "/" + inputDto.Vesion + "/${deviceKey}/defaul/batvhingpush_reply", |
|
|
|
TopicsType = TopicsTypeEnum.SUBSCRIBE, |
|
|
|
Description = "响应物料数据下发", |
|
|
|
ProductId = inputDto.ProductId, |
|
|
|
ProductVesionId = res.Id, |
|
|
|
Name = "物料数据下发", |
|
|
|
IsDefault = true |
|
|
|
}; |
|
|
|
var chnologypushtopics = new BPA_ProductTopics() |
|
|
|
{ |
|
|
|
Topics = " /" + Product.Key + "/" + inputDto.Vesion + "/${deviceKey}/defaul/chnologypush", |
|
|
|
TopicsType = 2, |
|
|
|
TopicsType = TopicsTypeEnum.PUBLISH, |
|
|
|
Description = "工艺数据下发", |
|
|
|
ProductId = inputDto.ProductId, |
|
|
|
ProductVesionId = res.Id, |
|
|
|
Name = "工艺数据下发", |
|
|
|
IsDefault = true |
|
|
|
}; |
|
|
|
var chnologypushtopics_reply = new BPA_ProductTopics() |
|
|
|
{ |
|
|
|
Topics = " /" + Product.Key + "/" + inputDto.Vesion + "/${deviceKey}/defaul/chnologypush_reply", |
|
|
|
TopicsType = TopicsTypeEnum.SUBSCRIBE, |
|
|
|
Description = "响应工艺数据下发", |
|
|
|
ProductId = inputDto.ProductId, |
|
|
|
Name = "工艺数据下发", |
|
|
|
ProductVesionId = res.Id, |
|
|
|
IsDefault = true |
|
|
|
}; |
|
|
|
list.Add(goodspushtopics); |
|
|
|
list.Add(goodspushtopics_reply); |
|
|
|
list.Add(batchingpushtopics); |
|
|
|
list.Add(batchingpushtopics_reply); |
|
|
|
list.Add(chnologypushtopics); |
|
|
|
list.Add(chnologypushtopics_reply); |
|
|
|
await _db.Insertable(list).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); |
|
|
|
List<BPA_ProductFunction> ProductFunctionlist = new(); |
|
|
|
var goodsProductFunction = new BPA_ProductFunction() |
|
|
@@ -109,40 +146,79 @@ namespace BPA.SAAS.Manage.Application.Device.Services |
|
|
|
Id=Guid.NewGuid().ToString(), |
|
|
|
CreateAt= DateTime.Now, |
|
|
|
DataType = "", |
|
|
|
Type = 1, |
|
|
|
Type = FunctionTypeEnum.SERVER, |
|
|
|
Name = "商品数据下发", |
|
|
|
Description = "商品数据下发", |
|
|
|
ProductId = inputDto.ProductId, |
|
|
|
DeviceVersionKey = res.Id, |
|
|
|
IsDefault = true |
|
|
|
}; |
|
|
|
var goodsProductFunction_reply = new BPA_ProductFunction() |
|
|
|
{ |
|
|
|
Id = Guid.NewGuid().ToString(), |
|
|
|
CreateAt = DateTime.Now, |
|
|
|
DataType = "", |
|
|
|
Type = FunctionTypeEnum.SERVER, |
|
|
|
Name = "响应商品数据下发", |
|
|
|
Description = "响应商品数据下发", |
|
|
|
ProductId = inputDto.ProductId, |
|
|
|
DeviceVersionKey = res.Id, |
|
|
|
IsDefault = true |
|
|
|
}; |
|
|
|
var batchingProductFunction = new BPA_ProductFunction() |
|
|
|
{ |
|
|
|
Id = Guid.NewGuid().ToString(), |
|
|
|
CreateAt = DateTime.Now, |
|
|
|
DataType = "", |
|
|
|
Type = 1, |
|
|
|
Type = FunctionTypeEnum.SERVER, |
|
|
|
Name = "物料数据下发", |
|
|
|
Description = "物料数据下发", |
|
|
|
ProductId = inputDto.ProductId, |
|
|
|
DeviceVersionKey = res.Id, |
|
|
|
IsDefault = true |
|
|
|
}; |
|
|
|
var batchingProductFunction_reply = new BPA_ProductFunction() |
|
|
|
{ |
|
|
|
Id = Guid.NewGuid().ToString(), |
|
|
|
CreateAt = DateTime.Now, |
|
|
|
DataType = "", |
|
|
|
Type = FunctionTypeEnum.SERVER, |
|
|
|
Name = "响应物料数据下发", |
|
|
|
Description = "响应物料数据下发", |
|
|
|
ProductId = inputDto.ProductId, |
|
|
|
DeviceVersionKey = res.Id, |
|
|
|
IsDefault = true |
|
|
|
}; |
|
|
|
var chnologyProductFunction = new BPA_ProductFunction() |
|
|
|
{ |
|
|
|
Id = Guid.NewGuid().ToString(), |
|
|
|
CreateAt = DateTime.Now, |
|
|
|
DataType = "", |
|
|
|
Type = 1, |
|
|
|
Type = FunctionTypeEnum.SERVER, |
|
|
|
Name = "工艺数据下发", |
|
|
|
Description = "工艺数据下发", |
|
|
|
ProductId = inputDto.ProductId, |
|
|
|
DeviceVersionKey = res.Id, |
|
|
|
IsDefault = true |
|
|
|
}; |
|
|
|
var chnologyProductFunction_reply = new BPA_ProductFunction() |
|
|
|
{ |
|
|
|
Id = Guid.NewGuid().ToString(), |
|
|
|
CreateAt = DateTime.Now, |
|
|
|
DataType = "", |
|
|
|
Type = FunctionTypeEnum.SERVER, |
|
|
|
Name = "响应工艺数据下发", |
|
|
|
Description = "响应工艺数据下发", |
|
|
|
ProductId = inputDto.ProductId, |
|
|
|
DeviceVersionKey = res.Id, |
|
|
|
IsDefault = true |
|
|
|
}; |
|
|
|
ProductFunctionlist.Add(goodsProductFunction); |
|
|
|
ProductFunctionlist.Add(goodsProductFunction_reply); |
|
|
|
ProductFunctionlist.Add(batchingProductFunction); |
|
|
|
ProductFunctionlist.Add(batchingProductFunction_reply); |
|
|
|
ProductFunctionlist.Add(chnologyProductFunction); |
|
|
|
ProductFunctionlist.Add(chnologyProductFunction_reply); |
|
|
|
await _db.Insertable(ProductFunctionlist).ExecuteCommandAsync(); |
|
|
|
List<BPA_ProductFunctionAction> ProductFunctionActionlist = new(); |
|
|
|
var goodsProductFunctionActionlist = new BPA_ProductFunctionAction() |
|
|
@@ -173,6 +249,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services |
|
|
|
ProductFunctionActionlist.Add(batchingProductFunctionActionlist); |
|
|
|
ProductFunctionActionlist.Add(chnologyProductFunctionActionlist); |
|
|
|
await _db.Insertable(ProductFunctionActionlist).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); |
|
|
|
#endregion |
|
|
|
_db.Ado.CommitTran(); |
|
|
|
return res != null; |
|
|
|
} |
|
|
|