|
@@ -41,6 +41,7 @@ namespace Vinno.vCloud.Common.FIS.AfterSales
|
|
|
private bool _hasReceivedApiInfo;
|
|
|
private readonly object _progressLock = new object();
|
|
|
private string _patchCode;
|
|
|
+ private RemoteMaintenanceType _currentRemoteMaintenanceType;
|
|
|
|
|
|
private MasterInfo _master;
|
|
|
|
|
@@ -117,9 +118,58 @@ namespace Vinno.vCloud.Common.FIS.AfterSales
|
|
|
Logger.WriteLineError($"AfterSalesV2 Handle PushDevicePatchToDeviceNotification Error:{ex}");
|
|
|
}
|
|
|
break;
|
|
|
+
|
|
|
+ case NotificationTypeEnum.GetRemoteLogToDeviceNotification:
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (e.Params is GetRemoteLogToDeviceNotification getRemoteLogToDeviceNotification)
|
|
|
+ {
|
|
|
+ HandleGetRemoteLogToDeviceNotification(getRemoteLogToDeviceNotification);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ Logger.WriteLineError($"AfterSalesV2 Handle GetRemoteLogToDeviceNotification Error:{ex}");
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ case NotificationTypeEnum.DevicePrinterRequestNotification:
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (e.Params is DevicePrinterRequestNotification devicePrinterRequestNotification)
|
|
|
+ {
|
|
|
+ HandleDevicePrinterRequestNotification(devicePrinterRequestNotification);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ Logger.WriteLineError($"AfterSalesV2 Handle DevicePrinterRequestNotification Error:{ex}");
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void HandleDevicePrinterRequestNotification(DevicePrinterRequestNotification devicePrinterRequestNotification)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ private void HandleGetRemoteLogToDeviceNotification(GetRemoteLogToDeviceNotification getRemoteLogToDeviceNotification)
|
|
|
+ {
|
|
|
+ Logger.WriteLineInfo($"AfterSalesV2 GetRemoteLogToDeviceNotification Receive");
|
|
|
+ if (_master == null)
|
|
|
+ {
|
|
|
+ Logger.WriteLineError("HandleGetRemoteLogToDeviceNotification Error,Current Master is Null");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var parameters = new List<AdditionParameter>
|
|
|
+ {
|
|
|
+ new AdditionParameter("BeginTime","DateTime",getRemoteLogToDeviceNotification.StartTime.ToString()),
|
|
|
+ new AdditionParameter("EndTime","DateTime",getRemoteLogToDeviceNotification.EndTime.ToString()),
|
|
|
+ };
|
|
|
+ var remoteMaintenanceInfo = new RemoteMaintenanceInfo(RemoteMaintenanceType.GetLog, _master?.UserId, parameters);
|
|
|
+ OnRemoteMaintenanceEvent(remoteMaintenanceInfo);
|
|
|
+ }
|
|
|
+
|
|
|
private void HandlePushDevicePatchToDeviceNotification(PushDevicePatchToDeviceNotification pushDevicePatchToDeviceNotification)
|
|
|
{
|
|
|
Logger.WriteLineInfo($"AfterSalesV2 PushDevicePatchToDeviceNotification Receive");
|
|
@@ -184,8 +234,9 @@ namespace Vinno.vCloud.Common.FIS.AfterSales
|
|
|
}
|
|
|
|
|
|
private void HandleConnectStatusToDeviceNotification(ConnectStatusToDeviceNotification connectStatusToDeviceNotification)
|
|
|
+
|
|
|
{
|
|
|
- Logger.WriteLineInfo($"AfterSalesV2 ConnectStatusToDeviceNotification Receive");
|
|
|
+ Logger.WriteLineInfo($"AfterSalesV2 ConnectStatusToDeviceNotification Receive,ControlType:{connectStatusToDeviceNotification.ControlType},TransactionType:{connectStatusToDeviceNotification.TransactionType}");
|
|
|
var isConsultationLiveService = connectStatusToDeviceNotification.TransactionType == TransactionTypeEnum.Consultion;
|
|
|
switch (connectStatusToDeviceNotification.ControlType)
|
|
|
{
|
|
@@ -334,6 +385,7 @@ namespace Vinno.vCloud.Common.FIS.AfterSales
|
|
|
|
|
|
private void OnRemoteMaintenanceEvent(RemoteMaintenanceInfo remoteMaintenanceInfo)
|
|
|
{
|
|
|
+ _currentRemoteMaintenanceType = remoteMaintenanceInfo.RemoteMaintenanceType;
|
|
|
RemoteMaintenanceEvent?.Invoke(this, remoteMaintenanceInfo);
|
|
|
}
|
|
|
|
|
@@ -406,26 +458,61 @@ namespace Vinno.vCloud.Common.FIS.AfterSales
|
|
|
}
|
|
|
else if (message is ProcessReslut processResult)
|
|
|
{
|
|
|
- switch (processResult.RunTaskType)
|
|
|
+ switch (_currentRemoteMaintenanceType)
|
|
|
{
|
|
|
- case TaskType.PushPatch:
|
|
|
+ case RemoteMaintenanceType.PushPatch:
|
|
|
try
|
|
|
{
|
|
|
+ UploadDeviceDownloadPatchProgressToUserRequest uploadDeviceDownloadPatchProgressToUserRequest;
|
|
|
+ var progress = processResult.Percent;
|
|
|
if (processResult.RunTaskStatus == TaskStatus.Progressing)
|
|
|
{
|
|
|
- var progress = processResult.Percent;
|
|
|
- var uploadDeviceDownloadPatchProgressToUserRequest = new UploadDeviceDownloadPatchProgressToUserRequest
|
|
|
+ uploadDeviceDownloadPatchProgressToUserRequest = new UploadDeviceDownloadPatchProgressToUserRequest
|
|
|
{
|
|
|
Token = _token,
|
|
|
- Progress = (int)progress,
|
|
|
+ Progress = (int)(progress * 100),
|
|
|
UserCode = _master?.UserId,
|
|
|
PatchCode = _patchCode,
|
|
|
+ RemoteDeviceState = RemoteDeviceStateEnum.Success
|
|
|
};
|
|
|
- var result = JsonRpcHelper.UploadDeviceDownloadPatchProgressToUser(_deviceService, uploadDeviceDownloadPatchProgressToUserRequest);
|
|
|
- if (!result)
|
|
|
+ }
|
|
|
+ else if (processResult.RunTaskStatus == TaskStatus.Finished)
|
|
|
+ {
|
|
|
+ uploadDeviceDownloadPatchProgressToUserRequest = new UploadDeviceDownloadPatchProgressToUserRequest
|
|
|
{
|
|
|
- Logger.WriteLineError($"AfterSalesV2 UploadDeviceDownloadPatchProgressToUser Failed");
|
|
|
- }
|
|
|
+ Token = _token,
|
|
|
+ Progress = 100,
|
|
|
+ UserCode = _master?.UserId,
|
|
|
+ PatchCode = _patchCode,
|
|
|
+ RemoteDeviceState = RemoteDeviceStateEnum.Success
|
|
|
+ };
|
|
|
+ }
|
|
|
+ else if (processResult.Detail == DetailType.PushPatchCancel)
|
|
|
+ {
|
|
|
+ uploadDeviceDownloadPatchProgressToUserRequest = new UploadDeviceDownloadPatchProgressToUserRequest
|
|
|
+ {
|
|
|
+ Token = _token,
|
|
|
+ Progress = 0,
|
|
|
+ UserCode = _master?.UserId,
|
|
|
+ PatchCode = _patchCode,
|
|
|
+ RemoteDeviceState = RemoteDeviceStateEnum.CancelDownloadPatch,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ uploadDeviceDownloadPatchProgressToUserRequest = new UploadDeviceDownloadPatchProgressToUserRequest
|
|
|
+ {
|
|
|
+ Token = _token,
|
|
|
+ Progress = 0,
|
|
|
+ UserCode = _master?.UserId,
|
|
|
+ PatchCode = _patchCode,
|
|
|
+ RemoteDeviceState = RemoteDeviceStateEnum.DownloadPatchFail,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ var result = JsonRpcHelper.UploadDeviceDownloadPatchProgressToUser(_deviceService, uploadDeviceDownloadPatchProgressToUserRequest);
|
|
|
+ if (!result)
|
|
|
+ {
|
|
|
+ Logger.WriteLineError($"AfterSalesV2 UploadDeviceDownloadPatchProgressToUser Failed");
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
@@ -433,6 +520,63 @@ namespace Vinno.vCloud.Common.FIS.AfterSales
|
|
|
Logger.WriteLineError($"AfterSalesV2 UploadDeviceDownloadPatchProgressToUser error:{ex}");
|
|
|
}
|
|
|
break;
|
|
|
+
|
|
|
+ case RemoteMaintenanceType.GetLog:
|
|
|
+ try
|
|
|
+ {
|
|
|
+ RemoteLogResponseRequest remoteLogResponseRequest;
|
|
|
+ var progress = processResult.Percent;
|
|
|
+ if (processResult.RunTaskStatus == TaskStatus.Progressing)
|
|
|
+ {
|
|
|
+ remoteLogResponseRequest = new RemoteLogResponseRequest
|
|
|
+ {
|
|
|
+ Token = _token,
|
|
|
+ Rate = (int)(progress * 100),
|
|
|
+ UserCode = _master?.UserId,
|
|
|
+ RemoteDeviceState = RemoteDeviceStateEnum.Success
|
|
|
+ };
|
|
|
+ }
|
|
|
+ else if (processResult.RunTaskStatus == TaskStatus.Finished)
|
|
|
+ {
|
|
|
+ remoteLogResponseRequest = new RemoteLogResponseRequest
|
|
|
+ {
|
|
|
+ Token = _token,
|
|
|
+ Rate = 100,
|
|
|
+ UserCode = _master?.UserId,
|
|
|
+ RemoteDeviceState = RemoteDeviceStateEnum.Success
|
|
|
+ };
|
|
|
+ }
|
|
|
+ else if (processResult.Detail == DetailType.GetLogCancel)
|
|
|
+ {
|
|
|
+ remoteLogResponseRequest = new RemoteLogResponseRequest
|
|
|
+ {
|
|
|
+ Token = _token,
|
|
|
+ Rate = 0,
|
|
|
+ UserCode = _master?.UserId,
|
|
|
+ RemoteDeviceState = RemoteDeviceStateEnum.DeviceCancelLogDownload
|
|
|
+ };
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ remoteLogResponseRequest = new RemoteLogResponseRequest
|
|
|
+ {
|
|
|
+ Token = _token,
|
|
|
+ Rate = 0,
|
|
|
+ UserCode = _master?.UserId,
|
|
|
+ RemoteDeviceState = RemoteDeviceStateEnum.LogDownloaddFail,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ var result = JsonRpcHelper.ResponseRemoteLog(_deviceService, remoteLogResponseRequest);
|
|
|
+ if (!result)
|
|
|
+ {
|
|
|
+ Logger.WriteLineError($"AfterSalesV2 ResponseRemoteLog Failed");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ Logger.WriteLineError($"AfterSalesV2 ResponseRemoteLog error:{ex}");
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|