Merge branch 'develop'
This commit is contained in:
Vendored
+4
-4
@@ -10,10 +10,10 @@ pipeline {
|
||||
|
||||
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
|
||||
script {
|
||||
withEnv(['NEXT_BUILD_NUMBER=220']) {
|
||||
// env.versionNumber = VersionNumber(versionNumberString : '1.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
||||
env.versionNumber = VersionNumber(versionNumberString : '1.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.versionNumberBeta = VersionNumber(versionNumberString : '1.3.${BUILD_DATE_FORMATTED, "yyMM"}-beta.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
withEnv(['NEXT_BUILD_NUMBER=221']) {
|
||||
// env.versionNumber = VersionNumber(versionNumberString : '2.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
||||
env.versionNumber = VersionNumber(versionNumberString : '2.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.versionNumberBeta = VersionNumber(versionNumberString : '2.0.${BUILD_DATE_FORMATTED, "yyMM"}-beta.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.APP_NAME = 'MConnectSDK'
|
||||
}
|
||||
}
|
||||
|
||||
+16
-16
@@ -6,28 +6,28 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace MConnectSDK
|
||||
{
|
||||
public enum ActStatus
|
||||
public enum ACTIVITY_STATUS
|
||||
{
|
||||
Defined = 0,
|
||||
ToDo,
|
||||
Assigned,
|
||||
Done
|
||||
DEFINED = 0,
|
||||
TO_DO,
|
||||
ASSIGNED,
|
||||
DONE
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum tipologie di manutenzione gestite
|
||||
/// </summary>
|
||||
public enum CMS_MAINTENANCE_TYPE
|
||||
public enum MAINTENANCE_TYPE
|
||||
{
|
||||
EXP_DATE = 0,
|
||||
MACHINE_INTERVAL = 1,
|
||||
TIME_INTERVAL = 2
|
||||
MACHINE_INTERVAL = 1, //ACTIVE_TIME
|
||||
TIME_INTERVAL = 2 //HOUR
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum unità di misura gestite
|
||||
/// </summary>
|
||||
public enum CMS_MAINTENANCE_UNIT_OF_MEASURE
|
||||
public enum MAINTENANCE_UNIT_OF_MEASURE
|
||||
{
|
||||
mm = 0,
|
||||
D = 1,
|
||||
@@ -35,19 +35,19 @@ namespace MConnectSDK
|
||||
M = 3
|
||||
}
|
||||
|
||||
public enum OpStatus
|
||||
public enum OP_STATUS
|
||||
{
|
||||
ToDo = 0,
|
||||
Done
|
||||
TO_DO = 0,
|
||||
DONE
|
||||
}
|
||||
|
||||
public enum OpType
|
||||
public enum OP_TYPE
|
||||
{
|
||||
Ordinary = 0,
|
||||
Scheduled
|
||||
ORDINARY = 0,
|
||||
SCHEDULED
|
||||
}
|
||||
|
||||
public enum SdkErrors
|
||||
public enum SDK_REPLY
|
||||
{
|
||||
NO_ERROR = 0,
|
||||
ERR_CLOUD_NOT_FOUND,
|
||||
|
||||
@@ -90,6 +90,11 @@ namespace MConnectSDK
|
||||
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// Versione delle API
|
||||
/// <summary>
|
||||
public string ApiVersion;
|
||||
|
||||
/// <summary>
|
||||
/// ID univoco dell'HMI per piattaforma MaestroConnect
|
||||
/// <summary>
|
||||
@@ -252,6 +257,41 @@ namespace MConnectSDK
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// URL pagina per ENROLL/ATTIVAZIONE (parametrico)
|
||||
/// <summary>
|
||||
protected string pageUrlActivation
|
||||
{
|
||||
get
|
||||
{
|
||||
string activationUrl = $"{BaseUrl}/{organizationCode}/machines/{MachineID}/activation";
|
||||
return activationUrl;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// URL pagina per ASSEGNAZIONE (parametrica)
|
||||
/// <summary>
|
||||
protected string pageUrlAssignment
|
||||
{
|
||||
get
|
||||
{
|
||||
string assignmentUrl = "";
|
||||
// definizione in base alla ApiVersion
|
||||
if (ApiVersion == "v1")
|
||||
{
|
||||
assignmentUrl = $"{BaseUrl}/{organizationCode}/machines/{MachineID}/assignment";
|
||||
}
|
||||
else if (ApiVersion == "v2")
|
||||
{
|
||||
assignmentUrl = $"{BaseUrl}-v2/{organizationCode}/machines/{MachineID}/assignment";
|
||||
}
|
||||
return assignmentUrl;
|
||||
}
|
||||
}
|
||||
|
||||
// LEGACY to remove after v2 release
|
||||
#if false
|
||||
/// <summary>
|
||||
/// URL pagina per check enroll (parametrico)
|
||||
/// <summary>
|
||||
@@ -260,12 +300,18 @@ namespace MConnectSDK
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
//string shortBaseUrl = BaseUrl.Replace("/api", "");
|
||||
string shortBaseUrl = RemoveFromEnd(BaseUrl, "/api");
|
||||
answ = $"{shortBaseUrl}/clients/{organizationCode}/machines/{MachineID}";
|
||||
if (ApiVersion == "v1")
|
||||
{
|
||||
answ = $"{BaseUrl}/{organizationCode}/machines/{MachineID}";
|
||||
}
|
||||
else if (ApiVersion == "v2")
|
||||
{
|
||||
answ = $"{BaseUrl}-v2/{organizationCode}/machines/{MachineID}";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// URL pagina per Download Immagini ( https://firebasestorage.googleapis.com/v0/b/scm-mconnect.appspot.com/o/ )
|
||||
@@ -726,6 +772,7 @@ namespace MConnectSDK
|
||||
var config = mapping.Children["conf"];
|
||||
|
||||
// imposto val da file YAML...
|
||||
ApiVersion = config["ApiVersion"].ToString();
|
||||
MachineID = config["MachineID"].ToString();
|
||||
ClientID = config["Client_ID"].ToString();
|
||||
// URL base x le chiamate REALI
|
||||
@@ -791,8 +838,10 @@ namespace MConnectSDK
|
||||
answ.Source = SourceType.CLOUD;
|
||||
}
|
||||
answ.CallResultOk = (answ.CloudStatusOk || answ.LocalStatusOk);
|
||||
// x capire SE sia enrolled --> faccio chiamata di verifica...
|
||||
|
||||
// x capire SE sia enrolled --> faccio chiamata di verifica... (prima activation, ora licenza)
|
||||
answ.IsHmiEnrolled = checkEnroll();
|
||||
|
||||
// rispondo!
|
||||
return answ;
|
||||
}
|
||||
@@ -1069,6 +1118,8 @@ namespace MConnectSDK
|
||||
// controllo preliminare ping/cloud..
|
||||
if (pingOk && cloudOk)
|
||||
{
|
||||
// LEGACY to remove after v2 release
|
||||
#if false
|
||||
// controllo con la chiamata della clientInfo...
|
||||
var taskCliInfo = Task.Run(() => GetClientStatusAsync());
|
||||
taskCliInfo.Wait();
|
||||
@@ -1084,7 +1135,7 @@ namespace MConnectSDK
|
||||
var currStatus = reqStatus;
|
||||
if (resp.statusCode != 404)
|
||||
{
|
||||
if (resp.result != null && (resp.result.OrganizationCode.ToUpper() == organizationCode.ToUpper()))
|
||||
if (resp.result != null && (resp.result.OrganizationCode.Equals(organizationCode, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
// registro che è OK x AUTH
|
||||
currStatus.IsHmiEnrolled = true;
|
||||
@@ -1097,6 +1148,19 @@ namespace MConnectSDK
|
||||
Log.Instance.Error($"Errore in fase di checkEnroll: {Environment.NewLine}{taskRes.Result}");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// verifica licenza da cui so che è enrolled
|
||||
var currStatus = reqStatus;
|
||||
var currLicense = GetLicenseMConnect();
|
||||
// se fosse 404 --> null quindi NO buono
|
||||
if (currLicense != null)
|
||||
{
|
||||
// verifico attiva licenza = enrolled
|
||||
currStatus.IsHmiEnrolled = currLicense.IsActive;
|
||||
answ = true;
|
||||
reqStatus = currStatus;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -1133,6 +1197,60 @@ namespace MConnectSDK
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Get list of all operation for current machine
|
||||
/// </summary>
|
||||
/// <param name="OperationsList"></param>
|
||||
/// <returns></returns>
|
||||
public static SDK_REPLY Download(out List<Maintenance.Operation> OperationsList)
|
||||
{
|
||||
SDK_REPLY currError = SDK_REPLY.NO_ERROR;
|
||||
OperationsList = new List<Maintenance.Operation>();
|
||||
|
||||
return currError;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get operation full details
|
||||
/// </summary>
|
||||
/// <param name="OperationId"></param>
|
||||
/// <param name="SingleOperation"></param>
|
||||
/// <returns></returns>
|
||||
public static SDK_REPLY GetSingle(string OperationId, out Maintenance.Operation SingleOperation)
|
||||
{
|
||||
SDK_REPLY currError = SDK_REPLY.NO_ERROR;
|
||||
SingleOperation = new Maintenance.Operation();
|
||||
|
||||
return currError;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update single operation
|
||||
/// </summary>
|
||||
/// <param name="OperationId"></param>
|
||||
/// <param name="progressPercent"></param>
|
||||
/// <param name="dueUntilDays"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public static SDK_REPLY Update(string OperationId, int progressPercent, int dueUntilDays, string userId)
|
||||
{
|
||||
SDK_REPLY currError = SDK_REPLY.NO_ERROR;
|
||||
|
||||
return currError;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Upload list of operations
|
||||
/// </summary>
|
||||
/// <param name="OperationsList"></param>
|
||||
/// <returns></returns>
|
||||
public static SDK_REPLY Upload(List<Maintenance.Operation> OperationsList)
|
||||
{
|
||||
SDK_REPLY currError = SDK_REPLY.NO_ERROR;
|
||||
|
||||
return currError;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua vera chiamata enroll
|
||||
/// <summary>
|
||||
@@ -1140,18 +1258,41 @@ namespace MConnectSDK
|
||||
/// <returns>{ext}<returns>
|
||||
public string doEnroll()
|
||||
{
|
||||
string answ = "";
|
||||
// LEGACY to remove after v2 release
|
||||
#if false
|
||||
// effettuo call DI ENROLL
|
||||
Uri callUri = new Uri(pageUrlCheckEnroll);
|
||||
#endif
|
||||
string answ = "";
|
||||
// predispongo le URI di chiamata
|
||||
Uri callUriAssig = new Uri(pageUrlAssignment);
|
||||
Uri callUriActiv = new Uri(pageUrlActivation);
|
||||
var payload = "";
|
||||
HttpContent callCont = new StringContent(payload, Encoding.UTF8, "application/json");
|
||||
|
||||
// controllo preliminare ping/cloud..
|
||||
if (pingOk && cloudOk)
|
||||
{
|
||||
// LEGACY to remove after v2 release
|
||||
#if false
|
||||
// attivazione/assegnazione legacy
|
||||
var taskRes = Task.Run(() => Utils.putAsync(callUri, callCont, verifResp.access_token));
|
||||
taskRes.Wait();
|
||||
answ = taskRes.Result;
|
||||
#endif
|
||||
|
||||
// V2: nuova procedura in 2 step assegnazione / attivazione
|
||||
var taskResAssign = Task.Run(() => Utils.postUriAsync(callUriAssig, callCont, verifResp.access_token));
|
||||
taskResAssign.Wait();
|
||||
answ = taskResAssign.Result;
|
||||
// se ha creato
|
||||
if (answ == "201")
|
||||
{
|
||||
// step 2: ATTIVAZIONE
|
||||
var taskResActiv = Task.Run(() => Utils.postUriAsync(callUriAssig, callCont, verifResp.access_token));
|
||||
taskResActiv.Wait();
|
||||
answ = taskResActiv.Result;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -1227,6 +1368,20 @@ namespace MConnectSDK
|
||||
ML.redFlushKey(_currParam.module + "*", _currParam.defaultDb);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get list of activities for specific operation<
|
||||
/// </summary>
|
||||
/// <param name="OperationId"></param>
|
||||
/// <param name="ActivitiesList"></param>
|
||||
/// <returns></returns>
|
||||
public SDK_REPLY GetActivities(string OperationId, out List<Maintenance.Activity> ActivitiesList)
|
||||
{
|
||||
SDK_REPLY currError = SDK_REPLY.NO_ERROR;
|
||||
ActivitiesList = new List<Maintenance.Activity>();
|
||||
|
||||
return currError;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera status del client
|
||||
/// <summary>
|
||||
@@ -1469,6 +1624,12 @@ namespace MConnectSDK
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rimozione suffisso da stringa
|
||||
/// </summary>
|
||||
/// <param name="fullString"></param>
|
||||
/// <param name="suffix"></param>
|
||||
/// <returns></returns>
|
||||
public string RemoveFromEnd(string fullString, string suffix)
|
||||
{
|
||||
string answ = fullString;
|
||||
@@ -1693,7 +1854,7 @@ namespace MConnectSDK
|
||||
// controllo SE sia stato autorizzato
|
||||
if (enrollResp != null && enrollResp.statusCode == 200)
|
||||
{
|
||||
if (enrollResp.result.OrganizationCode.ToUpper() == organizationCode.ToUpper())
|
||||
if (enrollResp.result.OrganizationCode.Equals(organizationCode, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
sb.AppendLine("--------------------------------------------------");
|
||||
sb.AppendLine(string.Format("{0:HH.mm.ss.fff} | ENROLL DONE", DateTime.Now));
|
||||
|
||||
+108
-53
@@ -6,24 +6,30 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace MConnectSDK
|
||||
{
|
||||
public class Maintenance
|
||||
public static class Maintenance
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public static double ConvertInMinutes(double number, CMS_MAINTENANCE_UNIT_OF_MEASURE unit)
|
||||
/// <summary>
|
||||
/// COnverto from UoM to minutes
|
||||
/// </summary>
|
||||
/// <param name="number"></param>
|
||||
/// <param name="unit"></param>
|
||||
/// <returns></returns>
|
||||
public static double ConvertInMinutes(double number, MAINTENANCE_UNIT_OF_MEASURE unit)
|
||||
{
|
||||
switch (unit)
|
||||
{
|
||||
case CMS_MAINTENANCE_UNIT_OF_MEASURE.mm:
|
||||
case MAINTENANCE_UNIT_OF_MEASURE.mm:
|
||||
return number;
|
||||
|
||||
case CMS_MAINTENANCE_UNIT_OF_MEASURE.H:
|
||||
case MAINTENANCE_UNIT_OF_MEASURE.H:
|
||||
return number * 60;
|
||||
|
||||
case CMS_MAINTENANCE_UNIT_OF_MEASURE.D:
|
||||
case MAINTENANCE_UNIT_OF_MEASURE.D:
|
||||
return number * (24 * 60);
|
||||
|
||||
case CMS_MAINTENANCE_UNIT_OF_MEASURE.M:
|
||||
case MAINTENANCE_UNIT_OF_MEASURE.M:
|
||||
return (30 * number) * (24 * 60);
|
||||
|
||||
default:
|
||||
@@ -31,20 +37,26 @@ namespace MConnectSDK
|
||||
}
|
||||
}
|
||||
|
||||
public static double ConvertInUmeas(double number, CMS_MAINTENANCE_UNIT_OF_MEASURE unit)
|
||||
/// <summary>
|
||||
/// Convert from minutes to desider UoM
|
||||
/// </summary>
|
||||
/// <param name="number"></param>
|
||||
/// <param name="unit"></param>
|
||||
/// <returns></returns>
|
||||
public static double ConvertInUmeas(double number, MAINTENANCE_UNIT_OF_MEASURE unit)
|
||||
{
|
||||
switch (unit)
|
||||
{
|
||||
case CMS_MAINTENANCE_UNIT_OF_MEASURE.mm:
|
||||
case MAINTENANCE_UNIT_OF_MEASURE.mm:
|
||||
return number;
|
||||
|
||||
case CMS_MAINTENANCE_UNIT_OF_MEASURE.H:
|
||||
case MAINTENANCE_UNIT_OF_MEASURE.H:
|
||||
return number / 60;
|
||||
|
||||
case CMS_MAINTENANCE_UNIT_OF_MEASURE.D:
|
||||
case MAINTENANCE_UNIT_OF_MEASURE.D:
|
||||
return number / (24 / 60);
|
||||
|
||||
case CMS_MAINTENANCE_UNIT_OF_MEASURE.M:
|
||||
case MAINTENANCE_UNIT_OF_MEASURE.M:
|
||||
return (30 / number) / (24 / 60);
|
||||
|
||||
default:
|
||||
@@ -52,44 +64,6 @@ namespace MConnectSDK
|
||||
}
|
||||
}
|
||||
|
||||
public SdkErrors DownloadOperations(out List<Operation> OperationsList)
|
||||
{
|
||||
SdkErrors currError = SdkErrors.NO_ERROR;
|
||||
OperationsList = new List<Operation>();
|
||||
|
||||
return currError;
|
||||
}
|
||||
|
||||
public SdkErrors GetActivity(out List<Activity> ActivitiesList)
|
||||
{
|
||||
SdkErrors currError = SdkErrors.NO_ERROR;
|
||||
ActivitiesList = new List<Activity>();
|
||||
|
||||
return currError;
|
||||
}
|
||||
|
||||
public SdkErrors GetOperation(string OperationId, out Operation SingleOperation)
|
||||
{
|
||||
SdkErrors currError = SdkErrors.NO_ERROR;
|
||||
SingleOperation = new Operation();
|
||||
|
||||
return currError;
|
||||
}
|
||||
|
||||
public SdkErrors UpdateOperationStatus(string OperationId, int progressPercent, int dueUntilDays, string userId)
|
||||
{
|
||||
SdkErrors currError = SdkErrors.NO_ERROR;
|
||||
|
||||
return currError;
|
||||
}
|
||||
|
||||
public SdkErrors UploadOperations(List<Operation> OperationsList)
|
||||
{
|
||||
SdkErrors currError = SdkErrors.NO_ERROR;
|
||||
|
||||
return currError;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Public Classes
|
||||
@@ -101,11 +75,44 @@ namespace MConnectSDK
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Unique key (generated byMConnect)
|
||||
/// </summary>
|
||||
public string ActivityId { get; set; } = "";
|
||||
public string ParentOperationId { get; set; } = "";
|
||||
public ActStatus Status { get; set; } = ActStatus.Defined;
|
||||
|
||||
/// <summary>
|
||||
/// Parent Operation key
|
||||
/// </summary>
|
||||
public string OperationId { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Status of activity
|
||||
/// </summary>
|
||||
public ACTIVITY_STATUS Status { get; set; } = ACTIVITY_STATUS.DEFINED;
|
||||
|
||||
/// <summary>
|
||||
/// User that made activity
|
||||
/// </summary>
|
||||
public string User { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// List of current (pending) activity for the amchine
|
||||
/// </summary>
|
||||
/// <param name="ActivitiesList"></param>
|
||||
/// <returns></returns>
|
||||
public SDK_REPLY GetCurrent(out List<Activity> ActivitiesList)
|
||||
{
|
||||
SDK_REPLY currError = SDK_REPLY.NO_ERROR;
|
||||
ActivitiesList = new List<Activity>();
|
||||
|
||||
return currError;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -115,14 +122,62 @@ namespace MConnectSDK
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Description of operation (optional)
|
||||
/// </summary>
|
||||
public string Description { get; set; } = "";
|
||||
|
||||
public string GroupId { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Key for localization inside machine (optional)
|
||||
/// </summary>
|
||||
public string LocationKey { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// MachineId (MConnect after enroll)
|
||||
/// </summary>
|
||||
public string MachineId { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Unique Code for indicating Maintenance (mandatory, created by HMI)
|
||||
/// </summary>
|
||||
public string MaintenanceCode { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Model (optional)
|
||||
/// </summary>
|
||||
public string Model { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Name of operation (optional)
|
||||
/// </summary>
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Unique Code (create by HMI)
|
||||
/// </summary>
|
||||
public string OperationCode { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Unique key (generated byMConnect)
|
||||
/// </summary>
|
||||
public string OperationId { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Priority
|
||||
/// </summary>
|
||||
public double priority { get; set; } = 0;
|
||||
public OpStatus Status { get; set; } = OpStatus.ToDo;
|
||||
public OpType Type { get; set; } = OpType.Ordinary;
|
||||
|
||||
/// <summary>
|
||||
/// Operation status
|
||||
/// </summary>
|
||||
public OP_STATUS Status { get; set; } = OP_STATUS.TO_DO;
|
||||
|
||||
/// <summary>
|
||||
/// Operation type
|
||||
/// </summary>
|
||||
public OP_TYPE Type { get; set; } = OP_TYPE.ORDINARY;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
+35
-1
@@ -1108,11 +1108,45 @@ namespace MConnectSDK
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Instance.Error($"EXC in getImageAsync: {Environment.NewLine}{exc}");
|
||||
Log.Instance.Error($"EXC in postUriAsync: {Environment.NewLine}{exc}");
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chiamata POST asyncrona + token
|
||||
/// </summary>
|
||||
/// <param name="reqUri">URI della chiamata</param>
|
||||
/// <param name="callCont">contenuto della chiamata</param>
|
||||
/// <param name="oauthToken">token da passare come bearer</param>
|
||||
/// <returns></returns>
|
||||
public static async Task<string> postUriAsync(Uri reqUri, HttpContent callCont, string oauthToken)
|
||||
{
|
||||
Log.Instance.Info($"[postUriAsync]: Calling reqUri: {reqUri} | callCont Token: {oauthToken} | callCont: {callCont}");
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
// ... Use HttpClient.
|
||||
using (HttpClient client = new HttpClient() { Timeout = TimeSpan.FromMinutes(2) })
|
||||
{
|
||||
if (oauthToken != "")
|
||||
{
|
||||
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + oauthToken);
|
||||
}
|
||||
using (HttpResponseMessage response = await client.PostAsync(reqUri, callCont).ConfigureAwait(false))
|
||||
{
|
||||
// converto s stringa
|
||||
answ = $"{(int)response.StatusCode}";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Instance.Error($"EXC in postUriAsync + token: {Environment.NewLine}{exc}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua PUT async della REST API indicata
|
||||
/// </summary>
|
||||
|
||||
@@ -12,4 +12,4 @@ conf:
|
||||
Redis:
|
||||
ConnectionString: "127.0.0.1,abortConnect=false,ssl=false"
|
||||
DbIndex: 1
|
||||
Module: "MCC"
|
||||
Module: "MCC"
|
||||
|
||||
Reference in New Issue
Block a user