Library refactor, divided model by type

Added read/update metadata to the cms client
This commit is contained in:
Lucio Maranta
2018-09-27 17:30:37 +02:00
parent 013f564374
commit adfafcabd4
36 changed files with 225 additions and 150 deletions
+3 -4
View File
@@ -20,9 +20,8 @@ namespace Client.Utils
public static String CEF_LOCALES_PATH = BASE_PATH + "CEF\\Resources\\locales";
public static String CEF_EXCEPTIONLOG_PATH = BASE_PATH + "ExceptionLog";
public static String errorPageFile = BASE_PATH + "error.pg";
public static String JOB_OPENING_PATH = BASE_PATH + "TempJob\\";
public static String JOB_OPENING_PATH = "C:\\CMS\\STEP\\TMP\\clientTmpJob\\";
//Config Names
public const string CONFIG_KEY = "Config";
public const string CLIENT_CONFIG_KEY = "Client";
@@ -74,7 +73,7 @@ namespace Client.Utils
public const string KEYB_PROC_NAME = "OSK";
public const string StartingPage = "index.html";
public const string Uploadpage = "/api/file_manager/upload";
public const string UPLOAD_PAGE = "/api/file_manager/upload";
public const string UPLOAD_ADD_QUEUE = "/api/file_manager/queue/add";
public const string ConfigPage = "api/configuration/client";
public const string errorPageUrl = @"error://error/";
+126 -23
View File
@@ -27,7 +27,7 @@ namespace CMS_Client.Browser_Tools
// The first letter of All PUBLIC Variables and Methods must be Lower-Case (CEF Settings)
private MainForm mainForm;
private static readonly string[] _validExtensions = { "", ".txt", ".cnc", ".ini", ".mpf", ".spf" };
private static readonly string[] _validExtensions = { "", ".txt", ".cnc", ".ini", ".mpf", ".spf", ".job" };
private static readonly string[] _validImages = { ".jpg", ".jpeg", ".png" };
private static string jobPath = "";
@@ -66,12 +66,14 @@ namespace CMS_Client.Browser_Tools
AddFunction("openJob").Execute += openJob;
AddFunction("saveJob").Execute += saveJob;
AddFunction("newJob").Execute += newJob;
AddFunction("closeJob").Execute += closeJob;
AddFunction("closeJob").Execute += closeJob;
AddFunction("saveJobNewPath").Execute += saveJobNewPath;
AddFunction("addImageToJob").Execute += addImageToJob;
AddFunction("delImageFromJob").Execute += delImageFromJob;
AddFunction("addPPToJob").Execute += addPPToJob;
AddFunction("delPPFromJob").Execute += delPPFromJob;
AddFunction("getJobMetadata").Execute += getJobMetadata;
AddFunction("saveJobMetadata").Execute += saveJobMetadata;
}
#endregion CONSTRUCTOR_METHOD
@@ -358,7 +360,7 @@ namespace CMS_Client.Browser_Tools
//Check the arguments numbers
if (e.Arguments.Length < 1 || e.Arguments[0] == null)
{
e.SetReturnValue(Constants.Uploadpage + "INVALID_ARGUMENTS");
e.SetReturnValue(Constants.UPLOAD_PAGE + "INVALID_ARGUMENTS");
return;
}
@@ -366,7 +368,7 @@ namespace CMS_Client.Browser_Tools
fileToUpload = e.Arguments[0].StringValue;
if (!System.IO.File.Exists(fileToUpload))
{
e.SetReturnValue(Constants.Uploadpage + ";FILE_NOT_FOUND");
e.SetReturnValue(UPLOAD_PAGE + ";FILE_NOT_FOUND");
return;
}
@@ -400,13 +402,13 @@ namespace CMS_Client.Browser_Tools
//Send them
HttpResponseMessage response = httpClient.PostAsync(
"http://" + Config.ConnectionConfig.ServerUrl + ":" + Config.ConnectionConfig.ServerPort + "/" + Constants.Uploadpage,
"http://" + Config.ConnectionConfig.ServerUrl + ":" + Config.ConnectionConfig.ServerPort + "/" + Constants.UPLOAD_PAGE,
form).Result;
//Wait the answer
if (response.StatusCode == System.Net.HttpStatusCode.BadRequest)
e.SetReturnValue(Constants.Uploadpage + ";" + await response.Content.ReadAsStringAsync());
e.SetReturnValue(UPLOAD_PAGE + ";" + await response.Content.ReadAsStringAsync());
else if (response.StatusCode != System.Net.HttpStatusCode.OK)
e.SetReturnValue(Constants.Uploadpage + ";" + response.ReasonPhrase);
e.SetReturnValue(UPLOAD_PAGE + ";" + response.ReasonPhrase);
else
e.SetReturnValue("");
}
@@ -426,7 +428,7 @@ namespace CMS_Client.Browser_Tools
//Check the arguments numbers
if (e.Arguments.Length < 1 || e.Arguments[0] == null)
{
e.SetReturnValue(Constants.UPLOAD_ADD_QUEUE + "INVALID_ARGUMENTS");
e.SetReturnValue(UPLOAD_ADD_QUEUE + "INVALID_ARGUMENTS");
return;
}
@@ -436,7 +438,7 @@ namespace CMS_Client.Browser_Tools
if (!System.IO.File.Exists(fileToUpload))
{
e.SetReturnValue(Constants.UPLOAD_ADD_QUEUE + ";FILE_NOT_FOUND");
e.SetReturnValue(UPLOAD_ADD_QUEUE + ";FILE_NOT_FOUND");
return;
}
@@ -472,14 +474,14 @@ namespace CMS_Client.Browser_Tools
//Send them
HttpResponseMessage response = httpClient
.PostAsync("http://" + Config.ConnectionConfig.ServerUrl + ":" + Config.ConnectionConfig.ServerPort + "/" + Constants.UPLOAD_ADD_QUEUE,
.PostAsync("http://" + Config.ConnectionConfig.ServerUrl + ":" + Config.ConnectionConfig.ServerPort + "/" + UPLOAD_ADD_QUEUE,
form)
.Result;
//Wait the answer
if (response.StatusCode == System.Net.HttpStatusCode.BadRequest)
e.SetReturnValue(Constants.UPLOAD_ADD_QUEUE + ";" + await response.Content.ReadAsStringAsync());
e.SetReturnValue(UPLOAD_ADD_QUEUE + ";" + await response.Content.ReadAsStringAsync());
else if (response.StatusCode != System.Net.HttpStatusCode.OK)
e.SetReturnValue(Constants.UPLOAD_ADD_QUEUE + ";" + response.ReasonPhrase);
e.SetReturnValue(UPLOAD_ADD_QUEUE + ";" + response.ReasonPhrase);
else
e.SetReturnValue("");
}
@@ -663,7 +665,115 @@ namespace CMS_Client.Browser_Tools
}
}
// create job data
public void getJobMetadata(object sender, CfrV8HandlerExecuteEventArgs e)
{
// Get file path
string filePath = e.Arguments[0].StringValue;
// Check if file exists
if (!System.IO.File.Exists(filePath))
{
e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("error_file_not_found")));
return;
}
// Open zip archive
using (ZipArchive zipArchive = ZipFile.OpenRead(filePath))
{
// Setup main Fields
JobToStep jobData = new JobToStep()
{
name = Path.GetFileName(filePath),
lastEditTimestamp = new FileInfo(filePath).LastAccessTime
};
foreach (ZipArchiveEntry entry in zipArchive.Entries)
{
// Get images content without extract files
if (_validImages.Contains(Path.GetExtension(entry.Name).ToLower()))
{
using (var memoryReader = new MemoryStream())
{
entry.Open().CopyTo(memoryReader);
jobData.metadata.generics.images.Add(new ImageParam()
{
name = Path.GetFileName(entry.Name),
base64 = "data:image/" + Path.GetExtension(entry.Name).ToLower().TrimStart('.') + ";base64," + Convert.ToBase64String(memoryReader.ToArray())
});
}
}
// Metadata
else if (entry.Name.Equals(JOB_METADATA_FILENAME, StringComparison.OrdinalIgnoreCase))
{
MetadataToFile metasFromFile = new MetadataToFile();
using (var reader = new StreamReader(entry.Open()))
{
metasFromFile = JsonConvert.DeserializeObject<MetadataToFile>(reader.ReadToEnd());
if (metasFromFile == null)
{
e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("corrupted_model")));
return;
}
else
{
jobData.metadata.generics.Description = metasFromFile.Description;
jobData.metadata.generics.ExecutionTime = metasFromFile.ExecutionTime;
jobData.metadata.tools = metasFromFile.Tools;
jobData.metadata.customs = metasFromFile.Customs;
}
}
}
}
e.SetReturnValue(JsonConvert.SerializeObject(jobData));
return;
}
}
public void saveJobMetadata(object sender, CfrV8HandlerExecuteEventArgs e)
{
MetadataToFile metafile = new MetadataToFile();
// Deserialize job
JobToStep job = JsonConvert.DeserializeObject<JobToStep>(e.Arguments[1].StringValue);
if (job == null)
{
e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("corrupted_model")));
return;
}
// Set meta data
metafile.Description = job.metadata.generics.Description;
metafile.ExecutionTime = job.metadata.generics.ExecutionTime;
metafile.Tools = job.metadata.tools;
metafile.Customs = job.metadata.customs;
// Open zipArchive in update mode
using (ZipArchive zipArchive = ZipFile.Open(e.Arguments[0].StringValue, ZipArchiveMode.Update))
{
// Find metadata.json file
var file = zipArchive.Entries.Where(x => x.FullName == JOB_METADATA_FILENAME).FirstOrDefault();
if(file == null)
{
e.SetReturnValue(JsonConvert.SerializeObject(new ErrorContainer("corrupted_model")));
return;
}
// Update metadata file
using (StreamWriter streamWriter = new StreamWriter(file.Open()))
{
JsonSerializer serializer = new JsonSerializer
{
Formatting = Formatting.Indented
};
// Write
serializer.Serialize(streamWriter, metafile);
}
}
}
// Create job data
public void newJob(object sender, CfrV8HandlerExecuteEventArgs e)
{
JobToStep job = new JobToStep();
@@ -672,13 +782,12 @@ namespace CMS_Client.Browser_Tools
Directory.CreateDirectory(JOB_OPENING_PATH);
ClearTempPath();
job.name = "newjob_" + DateTime.Now.ToFileTime() + ".job";
jobPath = "";
e.SetReturnValue(JsonConvert.SerializeObject(job));
return;
}
// close job
@@ -692,10 +801,8 @@ namespace CMS_Client.Browser_Tools
e.SetReturnValue(null);
return;
}
// Save all job
public void saveJobNewPath(object sender, CfrV8HandlerExecuteEventArgs e)
{
@@ -723,6 +830,7 @@ namespace CMS_Client.Browser_Tools
metafile.ExecutionTime = job.metadata.generics.ExecutionTime;
metafile.Tools = job.metadata.tools;
metafile.Customs = job.metadata.customs;
using (StreamWriter file = System.IO.File.CreateText(JOB_OPENING_PATH + JOB_METADATA_FILENAME))
{
JsonSerializer serializer = new JsonSerializer
@@ -751,7 +859,6 @@ namespace CMS_Client.Browser_Tools
return;
}
// Save all job
public void saveJob(object sender, CfrV8HandlerExecuteEventArgs e)
{
@@ -759,7 +866,6 @@ namespace CMS_Client.Browser_Tools
SaveFileDialog jobSaveFileDialog = new SaveFileDialog();
jobSaveFileDialog.Filter = "CMS Job Files(*.JOB)|*.job|Zip Files(*.ZIP)|*.zip";
// Job deserialize
JobToStep job = JsonConvert.DeserializeObject<JobToStep>(e.Arguments[0].StringValue);
if (job == null)
@@ -768,7 +874,6 @@ namespace CMS_Client.Browser_Tools
return;
}
//check the arguments
if (e.Arguments.Count() == 0)
return;
@@ -785,9 +890,8 @@ namespace CMS_Client.Browser_Tools
e.SetReturnValue(null);
return;
}
}
if (!String.IsNullOrEmpty(jobPath))
{
//Metadata
@@ -821,7 +925,6 @@ namespace CMS_Client.Browser_Tools
return;
}
// Add an image
public void addImageToJob(object sender, CfrV8HandlerExecuteEventArgs e)
{
Binary file not shown.
+2 -2
View File
@@ -1,4 +1,5 @@
using Step.Core;
using CMS_CORE_Library.Models;
using Step.Core;
using Step.Model.DTOModels;
using Step.Model.DTOModels.ToolModels;
using Step.NC;
@@ -6,7 +7,6 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using TeamDev.SDK.MVVM;
using static CMS_CORE_Library.DataStructures;
using static Step.Model.Constants;
using static Step.Utils.ExceptionManager;
@@ -3,7 +3,7 @@ using Step.Model.DTOModels;
using System;
using System.Collections.Generic;
using System.Linq;
using static CMS_CORE_Library.DataStructures;
using static CMS_CORE_Library.Models.DataStructures;
using static Step.Config.ServerConfig;
namespace Step.Database.Controllers
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static CMS_CORE_Library.DataStructures;
using System.Linq;
using static CMS_CORE_Library.Models.DataStructures;
namespace Step.Model.DTOModels
{
@@ -17,7 +13,7 @@ namespace Step.Model.DTOModels
if (Path != item.Path)
return false;
if(IsoLines != null && item.IsoLines != null)
if (IsoLines != null && item.IsoLines != null)
if (!IsoLines.SequenceEqual(item.IsoLines))
return false;
@@ -27,4 +23,4 @@ namespace Step.Model.DTOModels
return true;
}
}
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using static CMS_CORE_Library.DataStructures;
using static CMS_CORE_Library.Models.DataStructures;
namespace Step.Model.DTOModels
{
+1 -1
View File
@@ -1,4 +1,4 @@
using static CMS_CORE_Library.DataStructures;
using static CMS_CORE_Library.Models.DataStructures;
namespace Step.Model.DTOModels
{
+2 -1
View File
@@ -1,4 +1,5 @@
using static CMS_CORE_Library.DataStructures;
using CMS_CORE_Library.Models;
using static CMS_CORE_Library.Models.DataStructures;
namespace Step.Model.DTOModels
{
+1 -1
View File
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using static CMS_CORE_Library.DataStructures;
using static CMS_CORE_Library.Models.DataStructures;
namespace Step.Model.DTOModels
{
+4 -10
View File
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static CMS_CORE_Library.DataStructures;
using static Step.Model.Constants;
using static Step.Model.Constants;
namespace Step.Model.DTOModels
{
@@ -14,7 +8,7 @@ namespace Step.Model.DTOModels
public string PartProgramName { get; set; }
public int Reps { get; set; }
public int Reps { get; set; }
public int RemainingReps { get; set; }
@@ -36,7 +30,7 @@ namespace Step.Model.DTOModels
if (Reps != item.Reps)
return false;
if (RemainingReps != item.RemainingReps)
return false;
@@ -46,4 +40,4 @@ namespace Step.Model.DTOModels
return true;
}
}
}
}
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Step.Model.DTOModels.JobModels
{
@@ -17,4 +14,4 @@ namespace Step.Model.DTOModels.JobModels
Images = new List<DTOImageParamModel>();
}
}
}
}
@@ -1,14 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Step.Model.DTOModels.JobModels
namespace Step.Model.DTOModels.JobModels
{
public class DTOImageParamModel
{
public string Name;
public string Base64;
}
}
}
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Step.Model.DTOModels.JobModels
{
@@ -18,4 +14,4 @@ namespace Step.Model.DTOModels.JobModels
SelectionList = new List<string>();
}
}
}
}
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Step.Model.DTOModels.JobModels
{
@@ -18,4 +14,4 @@ namespace Step.Model.DTOModels.JobModels
Metadata = new DTOMetadataModel();
}
}
}
}
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Step.Model.DTOModels.JobModels
{
@@ -19,4 +16,4 @@ namespace Step.Model.DTOModels.JobModels
Customs = new List<DTOJobCustomParamModel>();
}
}
}
}
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Step.Model.DTOModels.JobModels
{
@@ -19,4 +15,4 @@ namespace Step.Model.DTOModels.JobModels
Customs = new List<DTOJobCustomParamModel>();
}
}
}
}
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using CMS_CORE_Library.Models;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using static CMS_CORE_Library.DataStructures;
namespace Step.Model.DTOModels.ToolModels
{
@@ -1,4 +1,5 @@
using static CMS_CORE_Library.DataStructures;
using CMS_CORE_Library.Models;
using static CMS_CORE_Library.Models.DataStructures;
namespace Step.Model.DTOModels.ToolModels
{
@@ -1,10 +1,6 @@
using Step.Model.DatabaseModels;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Step.Model.DTOModels.ToolModels
{
@@ -80,4 +76,4 @@ namespace Step.Model.DTOModels.ToolModels
};
}
}
}
}
@@ -1,8 +1,7 @@
using Step.Model.DatabaseModels;
using System;
using CMS_CORE_Library.Models;
using Step.Model.DatabaseModels;
using System.Collections;
using System.ComponentModel.DataAnnotations;
using static CMS_CORE_Library.DataStructures;
namespace Step.Model.DTOModels.ToolModels
{
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using CMS_CORE_Library.Models;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using static CMS_CORE_Library.DataStructures;
namespace Step.Model.DTOModels.ToolModels
{
@@ -1,5 +1,6 @@
using System.ComponentModel.DataAnnotations;
using static CMS_CORE_Library.DataStructures;
using CMS_CORE_Library.Models;
using System.ComponentModel.DataAnnotations;
using static CMS_CORE_Library.Models.DataStructures;
namespace Step.Model.DTOModels.ToolModels
{
+2 -2
View File
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using CMS_CORE_Library.Models;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using static CMS_CORE_Library.DataStructures;
namespace Step.Model.DatabaseModels
{
@@ -1,6 +1,8 @@
using System.ComponentModel.DataAnnotations;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using static CMS_CORE_Library.DataStructures;
using CMS_CORE_Library.Models;
using static CMS_CORE_Library.Models.NcMagazinePositionModel;
namespace Step.Model.DatabaseModels
{
+3 -2
View File
@@ -1,7 +1,8 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using static CMS_CORE_Library.DataStructures;
using CMS_CORE_Library.Models;
namespace Step.Model.DatabaseModels
{
+2 -2
View File
@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
using CMS_CORE_Library.Models;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using static CMS_CORE_Library.DataStructures;
namespace Step.Model.DatabaseModels
{
+31 -26
View File
@@ -1,11 +1,13 @@
using CMS_CORE;
using CMS_CORE.Demo;
using CMS_CORE.Fanuc;
using CMS_CORE.Osai;
using CMS_CORE.Siemens;
using CMS_CORE_Library;
using CMS_CORE_Library.Demo;
using CMS_CORE_Library.Fanuc;
using CMS_CORE_Library.Models;
using CMS_CORE_Library.Osai;
using CMS_CORE_Library.Siemens;
using Step.Database.Controllers;
using Step.Model.DatabaseModels;
using Step.Model.DTOModels;
using Step.Model.DTOModels.JobModels;
using Step.Model.DTOModels.MaintenanceModels;
using Step.Model.DTOModels.ToolModels;
using Step.Utils;
@@ -15,17 +17,17 @@ using System.Data.Entity;
using System.Globalization;
using System.IO;
using System.Linq;
using static CMS_CORE_Library.DataStructures;
using static CMS_CORE_Library.Models.DataStructures;
using static Step.Config.ServerConfig;
using static Step.Model.Constants;
using static Step.Database.Controllers.QueueController;
using static Step.Model.Constants;
namespace Step.NC
{
public class NcHandler : IDisposable
{
public Nc numericalControl;
public NcHandler()
{
// Choose NC
@@ -91,7 +93,7 @@ namespace Step.NC
StreamReader fileRead = new StreamReader(path);
int count = 0;
string line = "";
fileInfo = new InfoFile()
{
Name = fileData.Name,
@@ -223,7 +225,7 @@ namespace Step.NC
public CmsError UploadPartProgramAndAddToQueue(string localPath, string fileName, int reps, out DTOQueueModel queueItem)
{
queueItem = new DTOQueueModel();
// Get selectedProcess id
ushort selectedProcess = 0;
CmsError cmsError = numericalControl.PROC_RSelectedProcess(ref selectedProcess);
@@ -248,7 +250,6 @@ namespace Step.NC
// Add new process to
PartProgramQueue[selectedProcess].Add(queueItem);
using (QueueController queueController = new QueueController())
{
queueController.UpdateQueue();
@@ -257,6 +258,13 @@ namespace Step.NC
return cmsError;
}
public CmsError UploadJob(string path)
{
DTOJobModel jobData = SupportFunctions.UnpackJobAndReadMetadata(path);
return NO_ERROR;
}
public CmsError UpdateQueue()
{
// Get selectedProcess id
@@ -264,7 +272,7 @@ namespace Step.NC
CmsError cmsError = numericalControl.FILES_RQueueData(ref queueData);
foreach(var item in queueData)
foreach (var item in queueData)
{
if (!QueueRunningIndexes.ContainsKey(item.ProcessId))
QueueRunningIndexes.Add(item.ProcessId, 0);
@@ -303,8 +311,8 @@ namespace Step.NC
}
}
}
// Check if queue exists for the process
// Check if queue exists for the process
if (PartProgramQueue.ContainsKey(item.ProcessId) && PartProgramQueue[item.ProcessId].ElementAtOrDefault(QueueRunningIndexes[item.ProcessId]) != null)
{
// Set status based on queue status
@@ -317,16 +325,16 @@ namespace Step.NC
if (item.Status == QUEUE_STATUS.WAITING_OPERATOR)
PartProgramQueue[item.ProcessId][QueueRunningIndexes[item.ProcessId]].Status = QUEUE_ITEM_STATUS.WAITING_OPERATOR;
}
}
}
// Update data
//using (QueueController queueController = new QueueController())
//{
//{
// queueController.UpdateQueue();
//}
return NO_ERROR;
}
public CmsError GetSelectedProcessQueue(out List<DTOQueueModel> queueList)
{
queueList = new List<DTOQueueModel>();
@@ -396,15 +404,15 @@ namespace Step.NC
return INCORRECT_PARAMETERS_ERROR;
var item = PartProgramQueue[processId][itemId];
// Remove item in the old positions
// Remove item in the old positions
PartProgramQueue[processId].RemoveAt(itemId);
// Add in the new position
PartProgramQueue[processId].Insert(newIndex, item);
// Fix new ids
for (int i = 0; i < PartProgramQueue[processId].Count(); i++)
PartProgramQueue[processId][i].Id = i + 1;
using (QueueController queueController = new QueueController())
queueController.UpdateQueueIdsAndSave(processId);
@@ -456,7 +464,6 @@ namespace Step.NC
// Update database data
using (QueueController queueController = new QueueController())
queueController.UpdateQueueIdsAndSave(processId);
return NO_ERROR;
}
@@ -466,7 +473,7 @@ namespace Step.NC
// Check if there is a queue
if (PartProgramQueue.ContainsKey(processId))
PartProgramQueue[processId] = new List<DTOQueueModel>();
// Update db
using (QueueController queueController = new QueueController())
queueController.UpdateQueue();
@@ -1292,7 +1299,7 @@ namespace Step.NC
config.ToolsConfiguration = config.ToolsConfiguration.Concat(config.FamiliesConfiguration.FamilyReadOnlyConfiguration).ToList();
}
if(!ToolManagerConfig.OffsetOpt)
if (!ToolManagerConfig.OffsetOpt)
config.OffsetOptionActive = false;
if (!ToolManagerConfig.OffsetOpt)
@@ -1443,7 +1450,7 @@ namespace Step.NC
public CmsError SetActiveScreen(short screen)
{
// Set to true power on data by id
return numericalControl.NC_SetScreenVisible((Nc.SCREEN_PAGE) screen);
return numericalControl.NC_SetScreenVisible((Nc.SCREEN_PAGE)screen);
}
#endregion Write data
@@ -1628,7 +1635,6 @@ namespace Step.NC
{
DbNcToolModel ncTool = toolsManager.AddTool(tool);
if (!ToolManagerConfig.OffsetOpt)
{
CmsError cmsError = UpdateToolOffsetId(ncTool.ToolId, 1, ncTool.ToolId, out DTONcToolModel toolWithOffset);
@@ -1640,7 +1646,6 @@ namespace Step.NC
GetToolData(ncTool, ref dtoTool);
return NO_ERROR;
}
}
+2 -2
View File
@@ -1,10 +1,10 @@
using Microsoft.AspNet.SignalR;
using CMS_CORE_Library.Models;
using Microsoft.AspNet.SignalR;
using Step.Attributes;
using Step.NC;
using System.Collections.Generic;
using System.Threading.Tasks;
using TeamDev.SDK.MVVM;
using static CMS_CORE_Library.DataStructures;
using static Step.Config.ServerConfig;
using static Step.Model.Constants;
using static Step.Model.Constants.FUNCTIONALITY_NAMES;
@@ -1,12 +1,11 @@
using Step.Database.Controllers;
using CMS_CORE_Library.Models;
using Step.Database.Controllers;
using Step.Model.DTOModels;
using Step.NC;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using static CMS_CORE_Library.DataStructures;
using static Step.Config.ServerConfig;
using static Step.Model.Constants;
namespace Step.Controllers.WebApi
{
@@ -1,9 +1,10 @@
using Step.Model.DTOModels;
using CMS_CORE_Library.Models;
using Step.Model.DTOModels;
using Step.NC;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using static CMS_CORE_Library.DataStructures;
using static CMS_CORE_Library.Models.DataStructures;
using static Step.Config.ServerConfig;
using static Step.Model.Constants;
using static Step.Utils.LanguageController;
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using CMS_CORE_Library.Models;
using Newtonsoft.Json;
using Step.Database.Controllers;
using Step.Model.DatabaseModels;
using Step.Model.DTOModels.MaintenanceModels;
@@ -16,7 +17,6 @@ using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using static CMS_CORE_Library.DataStructures;
using static Step.Config.ServerConfig;
using static Step.Model.Constants;
+2 -2
View File
@@ -1,8 +1,8 @@
using Step.Model.DTOModels;
using CMS_CORE_Library.Models;
using Step.Model.DTOModels;
using Step.NC;
using System.Globalization;
using System.Web.Http;
using static CMS_CORE_Library.DataStructures;
using static Step.Model.Constants;
namespace Step.Controllers.WebApi
+2 -1
View File
@@ -10,10 +10,11 @@ using static Step.Model.Constants;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using static CMS_CORE_Library.DataStructures;
using System.Linq;
using static Step.Config.ServerConfig;
using System.ComponentModel.DataAnnotations;
using CMS_CORE_Library.Models;
using static CMS_CORE_Library.Models.DataStructures;
namespace Step.Controllers.WebApi
{
@@ -1,4 +1,5 @@
using Step.Database.Controllers;
using CMS_CORE_Library.Models;
using Step.Database.Controllers;
using Step.Model.DatabaseModels;
using Step.Model.DTOModels.ToolModels;
using Step.NC;
@@ -7,7 +8,6 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web.Http;
using static CMS_CORE_Library.DataStructures;
using static Step.Config.ServerConfig;
using static Step.Model.Constants;
@@ -1,4 +1,5 @@
using Step.Model.DatabaseModels;
using CMS_CORE_Library.Models;
using Step.Model.DatabaseModels;
using Step.Model.DTOModels.ToolModels;
using Step.NC;
using System;
@@ -6,7 +7,6 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web.Http;
using static CMS_CORE_Library.DataStructures;
namespace Step.Controllers.WebApi
{