Parcourir la source

提交

master
gwbvipvip il y a 9 mois
Parent
révision
6809facd5a
5 fichiers modifiés avec 92 ajouts et 80 suppressions
  1. +1
    -1
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/MaterialServices.cs
  2. +1
    -1
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Services/IMaterialServices.cs
  3. +88
    -78
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Services/MaterialService.cs
  4. +1
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/ThirdpartyPush/Services/IThirdpartyPushService.cs
  5. +1
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/ThirdpartyPush/Services/ThirdpartyPushService.cs

+ 1
- 1
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/MaterialServices.cs Voir le fichier

@@ -42,7 +42,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service
/// <param name="InputDto"></param>
/// <returns></returns>
[HttpPost("/api/ExternalPlatform/Material/AddMaterial")]
public async Task<bool> AddMaterial(BaseRequestDto<MaterialCreateDto> InputDto)
public async Task<string> AddMaterial(BaseRequestDto<MaterialCreateDto> InputDto)
{
return await _materialServices.AddMaterial(InputDto);
}


+ 1
- 1
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Services/IMaterialServices.cs Voir le fichier

@@ -28,7 +28,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service
/// </summary>
/// <param name="InputDto"></param>
/// <returns></returns>
Task<bool> AddMaterial(BaseRequestDto<MaterialCreateDto> inputDto);
Task<string> AddMaterial(BaseRequestDto<MaterialCreateDto> inputDto);

/// <summary>
/// 删除物料


+ 88
- 78
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Services/MaterialService.cs Voir le fichier

@@ -68,7 +68,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service
/// </summary>
/// <param name="InputDto"></param>
/// <returns></returns>
public async Task<bool> AddMaterial(BaseRequestDto<MaterialCreateDto> inputDto)
public async Task<string> AddMaterial(BaseRequestDto<MaterialCreateDto> inputDto)
{
try
{
@@ -129,93 +129,103 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service
throw Oops.Oh(ErrorCodeEnum.Code1002);
}

var input = new List<PushDeviceDto>();
#region 下发数据到设备


if (inputDto.StoreIdList != null && inputDto.StoreIdList.Count > 0)
if (inputDto.IsPush)
{
input = await SqlSugarDb.Db.Queryable<BPA_DeviceInfo, BPA_Product,BPA_ProductVesion>((a, b,c) => new JoinQueryInfos(
JoinType.Left, a.ProductId == b.Id,
JoinType.Left,a.ProductVersionId==c.Id
))
.Where((a, b, c) => inputDto.StoreIdList.Contains(a.StopId))
.Select((a, b,c) => new PushDeviceDto
{
deviceAutoKey = a.AutoKey,
deviceId = a.Id,
deviceName = a.DeviceName,
messageId = CurrentUser.MessageId,
productKey = b.Key,
productName = b.Name,
productVersion = c.Vesion,
type = 2
var input = new List<PushDeviceDto>();

})
.ToListAsync();
if (inputDto.StoreIdList != null && inputDto.StoreIdList.Count > 0)
{
input = await SqlSugarDb.Db.Queryable<BPA_DeviceInfo, BPA_Product, BPA_ProductVesion>((a, b, c) => new JoinQueryInfos(
JoinType.Left, a.ProductId == b.Id,
JoinType.Left, a.ProductVersionId == c.Id
))
.Where((a, b, c) => inputDto.StoreIdList.Contains(a.StopId))
.Select((a, b, c) => new PushDeviceDto
{
deviceAutoKey = a.AutoKey,
deviceId = a.Id,
deviceName = a.DeviceName,
messageId = CurrentUser.MessageId,
productKey = b.Key,
productName = b.Name,
productVersion = c.Vesion,
type = 2

}
})
.ToListAsync();

if (inputDto.DeviceIdList != null && inputDto.DeviceIdList.Count > 0)
{
input = await SqlSugarDb.Db.Queryable<BPA_DeviceInfo, BPA_Product, BPA_ProductVesion>((a, b,c) => new JoinQueryInfos(
JoinType.Left, a.ProductId == b.Id,
JoinType.Left,a.ProductVersionId==c.Id))
.Where((a, b,c) => inputDto.DeviceIdList.Contains(a.Id))
.Select((a, b,c) => new PushDeviceDto
{
deviceAutoKey = a.AutoKey,
deviceId = a.Id,
deviceName = a.DeviceName,
messageId = CurrentUser.MessageId,
productKey = b.Key,
productName = b.Name,
productVersion =c.Vesion,
type = 2,
})
.ToListAsync();
}
}

//4.添加记录
foreach (var item in input)
{
await _thirdpartyPushService.AddThirdpartyPushRecord(new Core.System.BPA_ThirdpartyPushRecord()
if (inputDto.DeviceIdList != null && inputDto.DeviceIdList.Count > 0)
{
CallbackUrl = inputDto.CallbackUrl,
GroupId = CurrentUser.GroupId,
Id = Guid.NewGuid().ToString(),
IsPush = false,
MessageId = CurrentUser.MessageId,
PushDevice =item.deviceId,
PushData = materialData.Id,
Status=1,
Type = 2,
});
item.data = JsonConvert.SerializeObject(new List<PushDataBatchingDto>()
input = await SqlSugarDb.Db.Queryable<BPA_DeviceInfo, BPA_Product, BPA_ProductVesion>((a, b, c) => new JoinQueryInfos(
JoinType.Left, a.ProductId == b.Id,
JoinType.Left, a.ProductVersionId == c.Id))
.Where((a, b, c) => inputDto.DeviceIdList.Contains(a.Id))
.Select((a, b, c) => new PushDeviceDto
{
deviceAutoKey = a.AutoKey,
deviceId = a.Id,
deviceName = a.DeviceName,
messageId = CurrentUser.MessageId,
productKey = b.Key,
productName = b.Name,
productVersion = c.Vesion,
type = 2,
})
.ToListAsync();
}

//4.添加记录
foreach (var item in input)
{
new()
await _thirdpartyPushService.AddThirdpartyPushRecord(new Core.System.BPA_ThirdpartyPushRecord()
{
Aittribute= materialData.Aittribute,
AutoKey= materialData.AutoKey,
Code=materialData.Code,
ForeignKeyRe= materialData.ForeignKeyRe,
Id=materialData.Id,
Name= materialData.Batching_Name,
netrecovery= materialData.netrecovery,
outstockUint= materialData.outstockUint,
Price= materialData.Price,
proportion= materialData.proportion,
Specs= materialData.Specs,
StockUint= materialData.StockUint,
StockUintName= materialData.StockUint,
TypeID= materialData.TypeID,

}
});
CallbackUrl = inputDto.CallbackUrl,
GroupId = CurrentUser.GroupId,
Id = Guid.NewGuid().ToString(),
IsPush = false,
MessageId = CurrentUser.MessageId,
PushDevice = item.deviceId,
PushData = materialData.Id,
Status = 1,
Type = 2,
});
item.data = JsonConvert.SerializeObject(new List<PushDataBatchingDto>()
{
new()
{
Aittribute= materialData.Aittribute,
AutoKey= materialData.AutoKey,
Code=materialData.Code,
ForeignKeyRe= materialData.ForeignKeyRe,
Id=materialData.Id,
Name= materialData.Batching_Name,
netrecovery= materialData.netrecovery,
outstockUint= materialData.outstockUint,
Price= materialData.Price,
proportion= materialData.proportion,
Specs= materialData.Specs,
StockUint= materialData.StockUint,
StockUintName= materialData.StockUint,
TypeID= materialData.TypeID,
}
});
}
SqlSugarDb.Db.Ado.CommitTran();
//5.发送mq
await _thirdpartyPushService.PushDevice(input);
}
SqlSugarDb.Db.Ado.CommitTran();
//5.发送mq
await _thirdpartyPushService.PushDevice(input);
return true;
else
{
SqlSugarDb.Db.Ado.CommitTran();
}

#endregion

return materialData.Id;
}
catch (Exception e)
{


+ 1
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/ThirdpartyPush/Services/IThirdpartyPushService.cs Voir le fichier

@@ -33,6 +33,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.ThirdpartyPush.S
/// <returns></returns>
Task<bool> UpdateThirdpartyPushRecord(ThirdpartyPushRecordDto inputDto);


/// <summary>
/// 更具店铺获取设备
/// </summary>


+ 1
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/ThirdpartyPush/Services/ThirdpartyPushService.cs Voir le fichier

@@ -91,6 +91,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.ThirdpartyPush.S

}


/// <summary>
/// 更具店铺获取设备
/// </summary>


Chargement…
Annuler
Enregistrer