|
@@ -33,6 +33,7 @@ using EVCB_OCPP.Packet.Messages.Reservation;
|
|
|
using EVCB_OCPP.Packet.Messages.SmartCharging;
|
|
|
using System.Threading;
|
|
|
using System.Net.Http;
|
|
|
+using Newtonsoft.Json.Converters;
|
|
|
|
|
|
namespace TestTool.RemoteTriggerAPP
|
|
|
{
|
|
@@ -41,12 +42,14 @@ namespace TestTool.RemoteTriggerAPP
|
|
|
/// </summary>
|
|
|
public partial class MainWindow : Window
|
|
|
{
|
|
|
+
|
|
|
string action = "";
|
|
|
List<UploadFile> publishes = new List<UploadFile>();
|
|
|
FTPClient UploadClient = new FTPClient(@"ftp://test.evsocket.phihong.com.cn", "testocpp", "testocpp");
|
|
|
- string chargingProfilePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "chargingProfile.json");
|
|
|
- string dataTransferPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "dataTransfer.json");
|
|
|
+ string chargingProfilePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SetChargingProfile.json");
|
|
|
+ string dataTransferPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DataTransfer.json");
|
|
|
int selectedPublish = -1;
|
|
|
+ bool isDestroyMode = false;
|
|
|
public MainWindow()
|
|
|
{
|
|
|
|
|
@@ -63,193 +66,211 @@ namespace TestTool.RemoteTriggerAPP
|
|
|
|
|
|
private void UxSubmitBtn_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
+ if (isDestroyMode)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ string actualAction = action.Split('_')[0];
|
|
|
+ var uuid = Guid.NewGuid().ToString();
|
|
|
+ WritetoDB(uuid,null, actualAction, GetDestroyVersionData(actualAction));
|
|
|
+ uxMsgTb.Text = string.Format("Send Actions: {0} UUID:{1}", actualAction, uuid);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ MessageBox.Show(ex.ToString());
|
|
|
+ }
|
|
|
|
|
|
- switch (action)
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- #region Core Profile
|
|
|
- case "ChangeAvailability_Inoperative":
|
|
|
- {
|
|
|
- SetChangeAvailability_Inoperative();
|
|
|
- }
|
|
|
- break;
|
|
|
- case "ChangeAvailability_Operative":
|
|
|
- {
|
|
|
- SetChangeAvailability_Operative();
|
|
|
- }
|
|
|
- break;
|
|
|
- case "DataTransfer":
|
|
|
- {
|
|
|
- var request = VerifyDataTransfer(dataTransferPath);
|
|
|
- SetDataTransfer(request);
|
|
|
- }
|
|
|
- break;
|
|
|
- case "GetConfiguration":
|
|
|
- {
|
|
|
- if (uxConfigKeyTb.Text == "")
|
|
|
+ switch (action)
|
|
|
+ {
|
|
|
+ #region Core Profile
|
|
|
+ case "ChangeAvailability_Inoperative":
|
|
|
+ {
|
|
|
+ SetChangeAvailability_Inoperative();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "ChangeAvailability_Operative":
|
|
|
{
|
|
|
- SetGetConfiguration_ALL();
|
|
|
+ SetChangeAvailability_Operative();
|
|
|
}
|
|
|
- else
|
|
|
+ break;
|
|
|
+ case "DataTransfer":
|
|
|
{
|
|
|
- SetGetConfiguration();
|
|
|
+ var request = VerifyDataTransfer(dataTransferPath);
|
|
|
+ SetDataTransfer(request);
|
|
|
}
|
|
|
+ break;
|
|
|
+ case "GetConfiguration":
|
|
|
+ {
|
|
|
+ if (uxConfigKeyTb.Text == "")
|
|
|
+ {
|
|
|
+ SetGetConfiguration_ALL();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ SetGetConfiguration();
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- break;
|
|
|
- case "ChangeConfiguration":
|
|
|
- {
|
|
|
- SetChangeConfiguration();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "ChangeConfiguration":
|
|
|
+ {
|
|
|
+ SetChangeConfiguration();
|
|
|
|
|
|
- }
|
|
|
- break;
|
|
|
- case "ClearCache":
|
|
|
- {
|
|
|
- SetClearCache();
|
|
|
- }
|
|
|
- break;
|
|
|
- case "RemoteStartTransaction":
|
|
|
- {
|
|
|
- SetRemoteStartTransaction();
|
|
|
- }
|
|
|
- break;
|
|
|
- case "RemoteStartTransaction_ChargingProfile":
|
|
|
- {
|
|
|
- var chargingProfile = VerifyChargingProfile(chargingProfilePath);
|
|
|
- if (chargingProfile != null)
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "ClearCache":
|
|
|
{
|
|
|
- SetRemoteStartTransaction(chargingProfile);
|
|
|
+ SetClearCache();
|
|
|
}
|
|
|
- else
|
|
|
+ break;
|
|
|
+ case "RemoteStartTransaction":
|
|
|
{
|
|
|
- uxMsgTb.Text = "Please check chargingProfile.json exist in " + AppDomain.CurrentDomain.BaseDirectory;
|
|
|
+ SetRemoteStartTransaction();
|
|
|
}
|
|
|
+ break;
|
|
|
+ case "RemoteStartTransaction_ChargingProfile":
|
|
|
+ {
|
|
|
+ var chargingProfile = VerifyChargingProfile(chargingProfilePath);
|
|
|
+ if (chargingProfile != null)
|
|
|
+ {
|
|
|
+ SetRemoteStartTransaction(chargingProfile);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ uxMsgTb.Text = "Please check chargingProfile.json exist in " + AppDomain.CurrentDomain.BaseDirectory;
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- break;
|
|
|
- case "RemoteStopTransaction":
|
|
|
- {
|
|
|
- SetRemoteStopTransaction();
|
|
|
- }
|
|
|
- break;
|
|
|
- case "HardReset":
|
|
|
- {
|
|
|
- SetHardReset();
|
|
|
- }
|
|
|
- break;
|
|
|
- case "SoftReset":
|
|
|
- {
|
|
|
- SetSoftReset();
|
|
|
- }
|
|
|
- break;
|
|
|
- case "UnlockConnector":
|
|
|
- {
|
|
|
- SetUnlockConnector();
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- #endregion
|
|
|
- #region Local Authorization
|
|
|
- case "GetLocalListVersion":
|
|
|
- {
|
|
|
- GetLocalListVersion();
|
|
|
- }
|
|
|
- break;
|
|
|
- case "SendLocalAuthorizationList_Full":
|
|
|
- {
|
|
|
- SendLocalAuthorizationList(true);
|
|
|
- }
|
|
|
- break;
|
|
|
- case "SendLocalAuthorizationList_Diff":
|
|
|
- {
|
|
|
- SendLocalAuthorizationList(false);
|
|
|
- }
|
|
|
- break;
|
|
|
- #endregion
|
|
|
- case "GetDiagnostics_FTP":
|
|
|
- {
|
|
|
- GetDiagnostics(true);
|
|
|
- }
|
|
|
- break;
|
|
|
- case "GetDiagnostics_HTTP":
|
|
|
- {
|
|
|
- GetDiagnostics(false);
|
|
|
- }
|
|
|
- break;
|
|
|
- case "ReserveNow":
|
|
|
- {
|
|
|
- ReserveNow();
|
|
|
- }
|
|
|
- break;
|
|
|
- case "CancelReservation":
|
|
|
- {
|
|
|
- CancelReservation();
|
|
|
- }
|
|
|
- break;
|
|
|
- case "ClearChargingProfile":
|
|
|
- {
|
|
|
- ClearChargingProfile();
|
|
|
- }
|
|
|
- break;
|
|
|
- case "GetCompositeSchedule":
|
|
|
- {
|
|
|
- GetCompositeSchedule();
|
|
|
- }
|
|
|
- break;
|
|
|
- case "SetChargingProfile":
|
|
|
- {
|
|
|
- var chargingProfile = VerifyChargingProfile(chargingProfilePath);
|
|
|
- if (chargingProfile != null)
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "RemoteStopTransaction":
|
|
|
+ {
|
|
|
+ SetRemoteStopTransaction();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "Reset_HardReset":
|
|
|
{
|
|
|
- SetChargingProfile(chargingProfile);
|
|
|
+ SetHardReset();
|
|
|
}
|
|
|
- else
|
|
|
+ break;
|
|
|
+ case "Reset_SoftReset":
|
|
|
{
|
|
|
- uxMsgTb.Text = "Please check chargingProfile.json exist in " + AppDomain.CurrentDomain.BaseDirectory;
|
|
|
+ SetSoftReset();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "UnlockConnector":
|
|
|
+ {
|
|
|
+ SetUnlockConnector();
|
|
|
}
|
|
|
|
|
|
- //SetChargingProfile(new SetChargingProfileRequest()
|
|
|
- //{
|
|
|
- // connectorId = 0,
|
|
|
- // csChargingProfiles = new csChargingProfiles()
|
|
|
- // {
|
|
|
- // chargingProfileId = 1,
|
|
|
- // chargingProfileKind = ChargingProfileKindType.Recurring,
|
|
|
- // chargingProfilePurpose = ChargingProfilePurposeType.ChargePointMaxProfile,
|
|
|
- // chargingSchedule = new ChargingSchedule()
|
|
|
- // {
|
|
|
- // chargingRateUnit = ChargingRateUnitType.W,
|
|
|
- // chargingSchedulePeriod = new List<ChargingSchedulePeriod>()
|
|
|
- // {
|
|
|
- // new ChargingSchedulePeriod(){ startPeriod=0, limit=int.Parse(uxConfigValueTb.Text)}
|
|
|
- // },
|
|
|
-
|
|
|
-
|
|
|
- // },
|
|
|
- // recurrencyKind = RecurrencyKindType.Daily,
|
|
|
- // stackLevel = 1,
|
|
|
-
|
|
|
- // }
|
|
|
- //});
|
|
|
+ break;
|
|
|
+ #endregion
|
|
|
+ #region Local Authorization
|
|
|
+ case "GetLocalListVersion":
|
|
|
+ {
|
|
|
+ GetLocalListVersion();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "SendLocalAuthorizationList_Full":
|
|
|
+ {
|
|
|
+ SendLocalAuthorizationList(true);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "SendLocalAuthorizationList_Diff":
|
|
|
+ {
|
|
|
+ SendLocalAuthorizationList(false);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ #endregion
|
|
|
+ case "GetDiagnostics_FTP":
|
|
|
+ {
|
|
|
+ GetDiagnostics(true);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "GetDiagnostics_HTTP":
|
|
|
+ {
|
|
|
+ GetDiagnostics(false);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "ReserveNow":
|
|
|
+ {
|
|
|
+ ReserveNow();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "CancelReservation":
|
|
|
+ {
|
|
|
+ CancelReservation();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "ClearChargingProfile":
|
|
|
+ {
|
|
|
+ ClearChargingProfile();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "GetCompositeSchedule":
|
|
|
+ {
|
|
|
+ GetCompositeSchedule();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "SetChargingProfile":
|
|
|
+ {
|
|
|
+ var chargingProfile = VerifyChargingProfile(chargingProfilePath);
|
|
|
+ if (chargingProfile != null)
|
|
|
+ {
|
|
|
+ SetChargingProfile(chargingProfile);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ uxMsgTb.Text = "Please check chargingProfile.json exist in " + AppDomain.CurrentDomain.BaseDirectory;
|
|
|
+ }
|
|
|
+
|
|
|
+ //SetChargingProfile(new SetChargingProfileRequest()
|
|
|
+ //{
|
|
|
+ // connectorId = 0,
|
|
|
+ // csChargingProfiles = new csChargingProfiles()
|
|
|
+ // {
|
|
|
+ // chargingProfileId = 1,
|
|
|
+ // chargingProfileKind = ChargingProfileKindType.Recurring,
|
|
|
+ // chargingProfilePurpose = ChargingProfilePurposeType.ChargePointMaxProfile,
|
|
|
+ // chargingSchedule = new ChargingSchedule()
|
|
|
+ // {
|
|
|
+ // chargingRateUnit = ChargingRateUnitType.W,
|
|
|
+ // chargingSchedulePeriod = new List<ChargingSchedulePeriod>()
|
|
|
+ // {
|
|
|
+ // new ChargingSchedulePeriod(){ startPeriod=0, limit=int.Parse(uxConfigValueTb.Text)}
|
|
|
+ // },
|
|
|
+
|
|
|
+
|
|
|
+ // },
|
|
|
+ // recurrencyKind = RecurrencyKindType.Daily,
|
|
|
+ // stackLevel = 1,
|
|
|
+
|
|
|
+ // }
|
|
|
+ //});
|
|
|
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- #region Trigger Profile
|
|
|
- case "TriggerMessage_BootNotification":
|
|
|
- case "TriggerMessage_DiagnosticsStatusNotification":
|
|
|
- case "TriggerMessage_FirmwareStatusNotification":
|
|
|
- case "TriggerMessage_Heartbeat":
|
|
|
- case "TriggerMessage_MeterValues":
|
|
|
- case "TriggerMessage_StatusNotification":
|
|
|
- {
|
|
|
- SetRemoteTrigger(action);
|
|
|
- }
|
|
|
- break;
|
|
|
- #endregion
|
|
|
- default:
|
|
|
- break;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ #region Trigger Profile
|
|
|
+ case "TriggerMessage_BootNotification":
|
|
|
+ case "TriggerMessage_DiagnosticsStatusNotification":
|
|
|
+ case "TriggerMessage_FirmwareStatusNotification":
|
|
|
+ case "TriggerMessage_Heartbeat":
|
|
|
+ case "TriggerMessage_MeterValues":
|
|
|
+ case "TriggerMessage_StatusNotification":
|
|
|
+ {
|
|
|
+ SetRemoteTrigger(action);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ #endregion
|
|
|
+ default:
|
|
|
+ break;
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void SetDataTransfer(DataTransferRequest request)
|
|
@@ -438,7 +459,7 @@ namespace TestTool.RemoteTriggerAPP
|
|
|
var request = new GetDiagnosticsRequest()
|
|
|
{
|
|
|
|
|
|
- location = new Uri(ftp ? "ftp://evseocpp:evseocpp@test.evsocket.phihong.com.cn/" : "http://test.evsocket.phihong.com.cn:9003/api/v1/file/"),
|
|
|
+ location = new Uri(ftp ? "ftp://evseocpp:evseocpp@ocpp.phihong.com.tw/" : "http://ocpp.phihong.com.tw:9003/api/v1/file/"),
|
|
|
retries = 1,
|
|
|
retryInterval = 30,
|
|
|
startTime = DateTime.Now.AddHours(-1).ToUniversalTime(),
|
|
@@ -516,18 +537,62 @@ namespace TestTool.RemoteTriggerAPP
|
|
|
// }
|
|
|
//});
|
|
|
|
|
|
- //request.localAuthorizationList.Add(new AuthorizationData()
|
|
|
- //{
|
|
|
- // idTag = "772690F5",
|
|
|
- // idTagInfo = new IdTagInfo()
|
|
|
- // {
|
|
|
- // parentIdTag = "0000000000000000001",
|
|
|
- // expiryDate = DateTime.UtcNow.AddMonths(1),
|
|
|
- // status = AuthorizationStatus.Accepted
|
|
|
- // }
|
|
|
- //});
|
|
|
+ request.localAuthorizationList.Add(new AuthorizationData()
|
|
|
+ {
|
|
|
+ idTag = "AA",
|
|
|
+ idTagInfo = new IdTagInfo()
|
|
|
+ {
|
|
|
+ parentIdTag = "SuperVisor",
|
|
|
+ expiryDate = DateTime.UtcNow.AddMinutes(5),
|
|
|
+ status = AuthorizationStatus.Accepted
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ request.localAuthorizationList.Add(new AuthorizationData()
|
|
|
+ {
|
|
|
+ idTag = "BB",
|
|
|
+ idTagInfo = new IdTagInfo()
|
|
|
+ {
|
|
|
+ parentIdTag = "SuperVisor",
|
|
|
+ expiryDate = DateTime.UtcNow.AddMinutes(5),
|
|
|
+ status = AuthorizationStatus.Accepted
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- for (int i = 0; i < size; i++)
|
|
|
+ request.localAuthorizationList.Add(new AuthorizationData()
|
|
|
+ {
|
|
|
+ idTag = "CC",
|
|
|
+ idTagInfo = new IdTagInfo()
|
|
|
+ {
|
|
|
+ parentIdTag = "SuperVisor",
|
|
|
+ expiryDate = DateTime.UtcNow.AddMinutes(5),
|
|
|
+ status = AuthorizationStatus.Accepted
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ request.localAuthorizationList.Add(new AuthorizationData()
|
|
|
+ {
|
|
|
+ idTag = "DD",
|
|
|
+ idTagInfo = new IdTagInfo()
|
|
|
+ {
|
|
|
+ parentIdTag = "SuperVisor",
|
|
|
+ expiryDate = DateTime.UtcNow.AddMonths(-1),
|
|
|
+ status = AuthorizationStatus.Invalid
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ request.localAuthorizationList.Add(new AuthorizationData()
|
|
|
+ {
|
|
|
+ idTag = "EE",
|
|
|
+ idTagInfo = new IdTagInfo()
|
|
|
+ {
|
|
|
+ parentIdTag = "SuperVisor",
|
|
|
+ expiryDate = DateTime.UtcNow.AddMonths(-1),
|
|
|
+ status = AuthorizationStatus.Invalid
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ for (int i = 0; i < size - request.localAuthorizationList.Count(); i++)
|
|
|
{
|
|
|
request.localAuthorizationList.Add(new AuthorizationData()
|
|
|
{
|
|
@@ -814,7 +879,7 @@ namespace TestTool.RemoteTriggerAPP
|
|
|
|
|
|
|
|
|
|
|
|
- private void WritetoDB(string uuid, IRequest request)
|
|
|
+ private void WritetoDB(string uuid, IRequest request, string action = "", string destroyData = "")
|
|
|
{
|
|
|
using (var db = new MainDBContext())
|
|
|
{
|
|
@@ -823,21 +888,21 @@ namespace TestTool.RemoteTriggerAPP
|
|
|
CreatedOn = DateTime.Now.ToUniversalTime(),
|
|
|
ChargeBoxId = uxChargeBoxIdTb.Text,
|
|
|
SerialNo = uuid,
|
|
|
- RequestContent = JsonConvert.SerializeObject(request, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore, Formatting = Formatting.None }),
|
|
|
+ RequestContent = !string.IsNullOrEmpty(destroyData) ? destroyData : JsonConvert.SerializeObject(request, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore, Formatting = Formatting.None }),
|
|
|
EVSE_Status = 0,
|
|
|
Status = 0,
|
|
|
RequestType = 1,
|
|
|
- Action = request.Action.ToString()
|
|
|
+ Action = !string.IsNullOrEmpty(destroyData) ? action : request.Action.ToString()
|
|
|
|
|
|
});
|
|
|
|
|
|
db.ServerMessage.Add(new ServerMessage()
|
|
|
{
|
|
|
ChargeBoxId = uxChargeBoxIdTb.Text,
|
|
|
- CreatedBy = "TestTool",
|
|
|
+ CreatedBy = !string.IsNullOrEmpty(destroyData) ? "Destroyer" : "TestTool",
|
|
|
CreatedOn = DateTime.Now.ToUniversalTime(),
|
|
|
- OutAction = request.Action.ToString(),
|
|
|
- OutRequest = JsonConvert.SerializeObject(request, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore, Formatting = Formatting.None }),
|
|
|
+ OutAction = !string.IsNullOrEmpty(destroyData) ? action : request.Action.ToString(),
|
|
|
+ OutRequest = !string.IsNullOrEmpty(destroyData) ? destroyData : JsonConvert.SerializeObject(request, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore, Formatting = Formatting.None }),
|
|
|
SerialNo = uuid,
|
|
|
InMessage = string.Empty
|
|
|
|
|
@@ -893,18 +958,18 @@ namespace TestTool.RemoteTriggerAPP
|
|
|
ufObj.FileName = md5 + ufObj.FileExtensionName;
|
|
|
ufObj.FilePath = "~/UploadFiles/Fw/" + ufObj.FileName;
|
|
|
ufObj.FileSize = size;
|
|
|
- ufObj.FileMD5 = md5;
|
|
|
+ ufObj.FileMD5 = md5;
|
|
|
ufObj.OriginName = System.IO.Path.GetFileName(uxUploadFileTb.Text);
|
|
|
- ufObj.FileUrl = new Uri(Properties.Settings.Default.FilePreUrl + ufObj.FilePath.Replace("~/", "")).ToString();
|
|
|
+ ufObj.FileUrl = new Uri(Properties.Settings.Default.FilePreUrl + ufObj.FilePath.Replace("~/", "")).ToString();
|
|
|
ufObj.VendorId = "TestTool";
|
|
|
- ufObj.ModelName= "TestTool";
|
|
|
+ ufObj.ModelName = "TestTool";
|
|
|
ufObj.ModuleId = 0;
|
|
|
|
|
|
using (var db = new MainDBContext())
|
|
|
{
|
|
|
db.UploadFile.Add(ufObj);
|
|
|
db.SaveChanges();
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
string filePath = uxUploadFileTb.Text;
|
|
@@ -929,7 +994,7 @@ namespace TestTool.RemoteTriggerAPP
|
|
|
private async Task UploadTask(string filePath, string fileName)
|
|
|
{
|
|
|
|
|
|
- bool uploadResult = UploadClient.FtpUploadBroken(filePath, @"ftp://test.evsocket.phihong.com.cn/" + fileName);
|
|
|
+ bool uploadResult = UploadClient.FtpUploadBroken(filePath, @"ftp://ocpp.phihong.com.tw/" + fileName);
|
|
|
|
|
|
await Dispatcher.BeginInvoke(new Action(() =>
|
|
|
{
|
|
@@ -990,9 +1055,9 @@ namespace TestTool.RemoteTriggerAPP
|
|
|
ufObj.FileName = md5 + ufObj.FileExtensionName;
|
|
|
ufObj.FilePath = "~/UploadFiles/Fw/" + ufObj.FileName;
|
|
|
ufObj.FileSize = size;
|
|
|
- ufObj.FileMD5 = md5;
|
|
|
+ ufObj.FileMD5 = md5;
|
|
|
ufObj.OriginName = System.IO.Path.GetFileName(uxUploadFileTb.Text);
|
|
|
- ufObj.FileUrl = new Uri(Properties.Settings.Default.FTPFilePreUrl + ufObj.FileName).ToString();
|
|
|
+ ufObj.FileUrl = new Uri(Properties.Settings.Default.FTPFilePreUrl + ufObj.FileName).ToString();
|
|
|
ufObj.VendorId = "TestTool";
|
|
|
ufObj.ModelName = "TestTool";
|
|
|
ufObj.ModuleId = 0;
|
|
@@ -1001,7 +1066,7 @@ namespace TestTool.RemoteTriggerAPP
|
|
|
{
|
|
|
db.UploadFile.Add(ufObj);
|
|
|
db.SaveChanges();
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1030,12 +1095,12 @@ namespace TestTool.RemoteTriggerAPP
|
|
|
{
|
|
|
string prefix = i.FileUrl.StartsWith("ftp") ? "FTP" : "HTTP";
|
|
|
sb.Clear();
|
|
|
- sb.Append(string.Format("[{0}]", prefix));
|
|
|
+ sb.Append(string.Format("[{0}]", prefix));
|
|
|
sb.Append("_上傳日期:");
|
|
|
sb.Append(i.CreatedOn.ToString());
|
|
|
sb.Append("_檔名:");
|
|
|
sb.Append(i.OriginName);
|
|
|
-
|
|
|
+
|
|
|
uxPublishCb.Items.Add(sb.ToString());
|
|
|
uxPublishCb.SelectedIndex = 0;
|
|
|
}
|
|
@@ -1089,7 +1154,7 @@ namespace TestTool.RemoteTriggerAPP
|
|
|
{
|
|
|
|
|
|
var machine = db.Machine.Where(x => x.ChargeBoxId == uxChargeBoxIdTb.Text).FirstOrDefault();
|
|
|
- machine.FW_AssignedVersion = null;
|
|
|
+ machine.FW_AssignedVersion = null;
|
|
|
db.SaveChanges();
|
|
|
}
|
|
|
|
|
@@ -1101,9 +1166,53 @@ namespace TestTool.RemoteTriggerAPP
|
|
|
{
|
|
|
Properties.Settings.Default.ChargeBoxId = uxChargeBoxIdTb.Text;
|
|
|
Properties.Settings.Default.Save();
|
|
|
-
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private string GetDestroyVersionData(string action)
|
|
|
+ {
|
|
|
+ string result = "";
|
|
|
+ try
|
|
|
+ {
|
|
|
+ string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, action + ".json");
|
|
|
+ var request = JsonConvert.DeserializeObject(File.ReadAllText(path));
|
|
|
+ result = JsonConvert.SerializeObject(request);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ uxMsgTb.Text += "解析檔案發生問題 " + ex.ToString();
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ private void uxDestroyCb_Checked(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ isDestroyMode = true;
|
|
|
+ uxConnectorIdTb.IsEnabled = false;
|
|
|
+ uxReservationTb.IsEnabled = false;
|
|
|
+ uxIdTagTb.IsEnabled = false;
|
|
|
+ uxParentIdTagTb.IsEnabled = false;
|
|
|
+ uxTransactionIdTb.IsEnabled = false;
|
|
|
+ uxLocalListSizeTb.IsEnabled = false;
|
|
|
+ uxConfigKeyTb.IsEnabled = false;
|
|
|
+ uxConfigValueTb.IsEnabled = false;
|
|
|
+ uxExpiryTimeTb.IsEnabled = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void uxDestroyCb_Unchecked(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ isDestroyMode = false;
|
|
|
+ uxConnectorIdTb.IsEnabled = true;
|
|
|
+ uxReservationTb.IsEnabled = true;
|
|
|
+ uxIdTagTb.IsEnabled = true;
|
|
|
+ uxParentIdTagTb.IsEnabled = true;
|
|
|
+ uxTransactionIdTb.IsEnabled = true;
|
|
|
+ uxLocalListSizeTb.IsEnabled = true;
|
|
|
+ uxConfigKeyTb.IsEnabled = true;
|
|
|
+ uxConfigValueTb.IsEnabled = true;
|
|
|
+ uxExpiryTimeTb.IsEnabled = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|