diff --git a/Client/Browser_Tools/BrowserJSObject.cs b/Client/Browser_Tools/BrowserJSObject.cs index dcaeba59..7b8c2d91 100644 --- a/Client/Browser_Tools/BrowserJSObject.cs +++ b/Client/Browser_Tools/BrowserJSObject.cs @@ -462,7 +462,7 @@ namespace CMS_Client.Browser_Tools form.Add(new ByteArrayContent(filecontent), "file", fileName); if (imagecontent != null) form.Add(new ByteArrayContent(imagecontent), "image", imageName); - + // Add reps to the form-data form.Add(new StringContent(reps.ToString()), "reps"); //Send them diff --git a/Client/Client.csproj b/Client/Client.csproj index e9b071e2..e3ca8c54 100644 --- a/Client/Client.csproj +++ b/Client/Client.csproj @@ -127,8 +127,8 @@ ..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.ShellExtensions.dll - - ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + + ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll diff --git a/Client/packages.config b/Client/packages.config index 0f72ee8a..1639f044 100644 --- a/Client/packages.config +++ b/Client/packages.config @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/Libs/CMS_CORE_Library.dll b/Libs/CMS_CORE_Library.dll index 87bda111..0170fb25 100644 Binary files a/Libs/CMS_CORE_Library.dll and b/Libs/CMS_CORE_Library.dll differ diff --git a/Step.Config/Config/headsConfigValidator.xsd b/Step.Config/Config/headsConfigValidator.xsd index 0588b2da..a360acc8 100644 --- a/Step.Config/Config/headsConfigValidator.xsd +++ b/Step.Config/Config/headsConfigValidator.xsd @@ -4,7 +4,7 @@ - + diff --git a/Step.Config/Config/macrosConfig.xml b/Step.Config/Config/macrosConfig.xml new file mode 100644 index 00000000..e8022fdb --- /dev/null +++ b/Step.Config/Config/macrosConfig.xml @@ -0,0 +1,6 @@ + + + Macro 1 + Macro 2 + Macro 3 + \ No newline at end of file diff --git a/Step.Config/Config/macrosConfigValidator.xsd b/Step.Config/Config/macrosConfigValidator.xsd new file mode 100644 index 00000000..af4c9e00 --- /dev/null +++ b/Step.Config/Config/macrosConfigValidator.xsd @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Step.Config/ServerConfig.cs b/Step.Config/ServerConfig.cs index 59c1cc79..7b0610fc 100644 --- a/Step.Config/ServerConfig.cs +++ b/Step.Config/ServerConfig.cs @@ -32,5 +32,7 @@ namespace Step.Config public static AreasConfigModel MaintenanceConfig; public static AreasConfigModel UtilitiesConfig; public static AreasConfigModel ScadaConfig; + + public static List MacrosConfig; } } diff --git a/Step.Config/ServerConfigController.cs b/Step.Config/ServerConfigController.cs index aee27570..91bbd3eb 100644 --- a/Step.Config/ServerConfigController.cs +++ b/Step.Config/ServerConfigController.cs @@ -28,6 +28,7 @@ namespace Step.Config ReadAlarmsConfig(); ReadHeadsConfig(); ReadToolManagerConfig(); + ReadMacros(); } catch (System.Xml.XmlException ex) { @@ -385,6 +386,18 @@ namespace Step.Config .FirstOrDefault(); } + public static void ReadMacros() + { + XDocument xmlConfigFile = GetXmlHandlerWithValidator(MACROS_CONFIG_SCHEMA_PATH, MACROS_CONFIG_PATH); + + // Read config from XML file + MacrosConfig = xmlConfigFile + .Descendants("macros") + .Elements() + .Select(x => x.Value) + .ToList(); + } + #endregion Read config from file from configuration } } \ No newline at end of file diff --git a/Step.Config/Step.Config.csproj b/Step.Config/Step.Config.csproj index 257e2a89..e9622439 100644 --- a/Step.Config/Step.Config.csproj +++ b/Step.Config/Step.Config.csproj @@ -42,6 +42,10 @@ + + Designer + PreserveNewest + @@ -115,5 +119,10 @@ Designer + + + Designer + + \ No newline at end of file diff --git a/Step.Core/Step.Core.csproj b/Step.Core/Step.Core.csproj index 42cc5b5e..fd61eed3 100644 --- a/Step.Core/Step.Core.csproj +++ b/Step.Core/Step.Core.csproj @@ -87,6 +87,7 @@ + diff --git a/Step.Core/app.config b/Step.Core/app.config new file mode 100644 index 00000000..b65ec51d --- /dev/null +++ b/Step.Core/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Step.Database/App.config b/Step.Database/App.config index 37bd4d82..218f15ca 100644 --- a/Step.Database/App.config +++ b/Step.Database/App.config @@ -5,7 +5,7 @@ - + diff --git a/Step.Model/Constants.cs b/Step.Model/Constants.cs index 9eb665f6..fc68621a 100644 --- a/Step.Model/Constants.cs +++ b/Step.Model/Constants.cs @@ -10,8 +10,13 @@ namespace Step.Model public static readonly string[] VALID_IMAGE_EXTENSIONS = { ".jpg", ".jpeg", ".png" }; public const double EPSILON = 0.001; public static string QUEUE_FILE_NAME = "pp"; + public const string JOB_MAIN_FILENAME = "main.cnc"; + public const string JOB_METADATA_FILENAME = "metadata.json"; + + public static String JOB_OPENING_PATH = BASE_PATH + "TempJob\\"; + + - public enum ROLE_IDS { CMS_SERVICE_ONLY = 1, @@ -140,6 +145,9 @@ namespace Step.Model public const string TOOL_MANAGER_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "toolManagerConfigValidator.xsd"; public const string TOOL_MANAGER_CONFIG_PATH = CONFIG_DIRECTORY + "toolManagerConfig.xml"; + public const string MACROS_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "macrosConfigValidator.xsd"; + public const string MACROS_CONFIG_PATH = CONFIG_DIRECTORY + "macrosConfig.xml"; + public static string WEBSITE_DIRECTORY = Path.Combine(BASE_PATH, "..", "wwwroot"); public static string LANGUAGE_PACK_DIRECTORY = BASE_PATH + "\\languages\\"; public static string LANGUAGE_SCHEMA_PATH = BASE_PATH + "\\LanguageValidator.xsd"; diff --git a/Step.Model/DTOModels/JobModels/DTOGenericParamModel.cs b/Step.Model/DTOModels/JobModels/DTOGenericParamModel.cs new file mode 100644 index 00000000..7bc3f4ec --- /dev/null +++ b/Step.Model/DTOModels/JobModels/DTOGenericParamModel.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Step.Model.DTOModels.JobModels +{ + public class DTOGenericParamModel + { + public List Images; + public string Description; + public TimeSpan ExecutionTime; + + public DTOGenericParamModel() + { + Images = new List(); + } + } +} diff --git a/Step.Model/DTOModels/JobModels/DTOImageParamModel.cs b/Step.Model/DTOModels/JobModels/DTOImageParamModel.cs new file mode 100644 index 00000000..25524b03 --- /dev/null +++ b/Step.Model/DTOModels/JobModels/DTOImageParamModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Step.Model.DTOModels.JobModels +{ + public class DTOImageParamModel + { + public string Name; + public string Base64; + } +} diff --git a/Step.Model/DTOModels/JobModels/DTOJobCustomParamModel.cs b/Step.Model/DTOModels/JobModels/DTOJobCustomParamModel.cs new file mode 100644 index 00000000..e6ba277f --- /dev/null +++ b/Step.Model/DTOModels/JobModels/DTOJobCustomParamModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Step.Model.DTOModels.JobModels +{ + public class DTOJobCustomParamModel + { + public string Name; + public string Type; + public List SelectionList; + public int Value; + + public DTOJobCustomParamModel() + { + SelectionList = new List(); + } + } +} diff --git a/Step.Model/DTOModels/JobModels/DTOJobModel.cs b/Step.Model/DTOModels/JobModels/DTOJobModel.cs new file mode 100644 index 00000000..c885fb21 --- /dev/null +++ b/Step.Model/DTOModels/JobModels/DTOJobModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Step.Model.DTOModels.JobModels +{ + public class DTOJobModel + { + public string Name; + public DateTime LastEditTimestamp; + public string IsoMainProgram; + public DTOMetadataModel Metadata; + + public DTOJobModel() + { + Metadata = new DTOMetadataModel(); + } + } +} diff --git a/Step.Model/DTOModels/JobModels/DTOMetadataFieldsModel.cs b/Step.Model/DTOModels/JobModels/DTOMetadataFieldsModel.cs new file mode 100644 index 00000000..248b3ffc --- /dev/null +++ b/Step.Model/DTOModels/JobModels/DTOMetadataFieldsModel.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Step.Model.DTOModels.JobModels +{ + public class DTOMetadataFieldsModel + { + public string Description; + public TimeSpan ExecutionTime; + public List Tools; + public List Customs; + + public DTOMetadataFieldsModel() + { + Tools = new List(); + Customs = new List(); + } + } +} diff --git a/Step.Model/DTOModels/JobModels/DTOMetadataModel.cs b/Step.Model/DTOModels/JobModels/DTOMetadataModel.cs new file mode 100644 index 00000000..7a0db8a7 --- /dev/null +++ b/Step.Model/DTOModels/JobModels/DTOMetadataModel.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Step.Model.DTOModels.JobModels +{ + public class DTOMetadataModel + { + public DTOGenericParamModel Generics; + public List Tools; + public List Customs; + + public DTOMetadataModel() + { + Generics = new DTOGenericParamModel(); + Tools = new List(); + Customs = new List(); + } + } +} diff --git a/Step.Model/Step.Model.csproj b/Step.Model/Step.Model.csproj index 7f1db5d4..22be59aa 100644 --- a/Step.Model/Step.Model.csproj +++ b/Step.Model/Step.Model.csproj @@ -94,7 +94,13 @@ + + + + + + diff --git a/Step.NC/NcHandler.cs b/Step.NC/NcHandler.cs index 04180c34..27139f51 100644 --- a/Step.NC/NcHandler.cs +++ b/Step.NC/NcHandler.cs @@ -317,12 +317,12 @@ 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(); - } + //using (QueueController queueController = new QueueController()) + //{ + // queueController.UpdateQueue(); + //} return NO_ERROR; } @@ -379,10 +379,11 @@ namespace Step.NC { itemId = itemId - 1; - // Update queue running index + var a = QueueRunningIndexes[processId]; + // Update queue running index after move an item if (itemId < QueueRunningIndexes[processId] && newIndex >= QueueRunningIndexes[processId]) QueueRunningIndexes[processId] -= 1; - if (newIndex <= QueueRunningIndexes[processId] && itemId > QueueRunningIndexes[processId]) + if (newIndex < QueueRunningIndexes[processId] && itemId > QueueRunningIndexes[processId]) QueueRunningIndexes[processId] += 1; queue = new List(); @@ -1267,6 +1268,7 @@ namespace Step.NC { config.FamilyOptionActive = true; config.MultitoolOptionActive = true; + config.OffsetOptionActive = true; List categories = new List(); if (!ToolManagerConfig.ShankOpt) @@ -1281,13 +1283,16 @@ namespace Step.NC config.FamilyOptionActive = false; categories.Add("family"); config.ToolsConfiguration = config.ToolsConfiguration.Where(x => !(x.Name == "familyId")).ToList(); - config.ToolsConfiguration = config.ToolsConfiguration.Concat(config.FamiliesConfiguration.FamilyConfiguration).ToList(); + config.ToolsConfiguration = config.FamiliesConfiguration.FamilyConfiguration.Concat(config.ToolsConfiguration).ToList(); } else { config.ToolsConfiguration = config.ToolsConfiguration.Concat(config.FamiliesConfiguration.FamilyReadOnlyConfiguration).ToList(); } + if(!ToolManagerConfig.OffsetOpt) + config.OffsetOptionActive = false; + if (!ToolManagerConfig.OffsetOpt) categories.Add("offset"); diff --git a/Step.NC/Step.NC.csproj b/Step.NC/Step.NC.csproj index eec04cd2..e2277c8a 100644 --- a/Step.NC/Step.NC.csproj +++ b/Step.NC/Step.NC.csproj @@ -51,6 +51,7 @@ + Always diff --git a/Step.NC/app.config b/Step.NC/app.config new file mode 100644 index 00000000..b65ec51d --- /dev/null +++ b/Step.NC/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Step.Utils/Step.Utils.csproj b/Step.Utils/Step.Utils.csproj index 84b9729d..0a022247 100644 --- a/Step.Utils/Step.Utils.csproj +++ b/Step.Utils/Step.Utils.csproj @@ -35,11 +35,16 @@ ..\packages\MySql.Data.6.10.4\lib\net452\MySql.Data.dll + + ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll + ..\packages\NLog.4.4.12\lib\net45\NLog.dll + + diff --git a/Step.Utils/languages/IT.xml b/Step.Utils/languages/IT.xml index 341e01cc..652eba68 100644 --- a/Step.Utils/languages/IT.xml +++ b/Step.Utils/languages/IT.xml @@ -145,8 +145,8 @@ Creazione Nuovo Utensile Modifica Tagliente n. %d Modifica Offset n. %d - Creazione nuovo Tagliente - Associazionie nuovo Offset + Associazionie nuovo Offset + Creazione nuovo Tagliente Gestione Codoli Seleziona un Codolo: Crea un nuovo Codolo @@ -248,6 +248,11 @@ Percorso autoadattativo: Vita: Ravvivatura: + Limiti: + Ravvivatura: + Compensazione Dinamica: + Tabella TCP: + Percorso autoadattativo: @@ -385,7 +390,8 @@ A Contatore Ad Usura Rot. Oraria - Rot. Antioraria + Rot. Antioraria + Tutti i sensi di rotazione UT per fresatura Fr.cilin.testa sfer. Fr.conic.testa sfer. diff --git a/Step.Utils/languages/en.xml b/Step.Utils/languages/en.xml index 91e5105c..701502bb 100644 --- a/Step.Utils/languages/en.xml +++ b/Step.Utils/languages/en.xml @@ -247,7 +247,12 @@ Adatpive Path: Life: Tool Revive: - + Limits: + Tool Revive: + Dynamic Compensation: + TCP Table: + Adatpive Path: + Tool Id @@ -385,6 +390,7 @@ Wear Clockwhise Rot. Counter Clockwhise Rot. + All rotations Milling tool Ball nose end mill Conical ball end diff --git a/Step.Utils/packages.config b/Step.Utils/packages.config index 9e8a4d68..34a77645 100644 --- a/Step.Utils/packages.config +++ b/Step.Utils/packages.config @@ -1,5 +1,6 @@  + \ No newline at end of file diff --git a/Step.Utils/supportFunctions.cs b/Step.Utils/supportFunctions.cs index 75f55ab5..281ef922 100644 --- a/Step.Utils/supportFunctions.cs +++ b/Step.Utils/supportFunctions.cs @@ -1,6 +1,10 @@ -using System.Collections.Generic; +using Newtonsoft.Json; +using Step.Model.DTOModels.JobModels; +using System; +using System.Collections.Generic; +using System.IO; +using System.IO.Compression; using System.Linq; -using System.Reflection; using static Step.Model.Constants; namespace Step.Utils @@ -101,7 +105,7 @@ namespace Step.Utils } } } - + public static int GetNextId(IEnumerable objIds) { if (objIds.Count() == 0) @@ -121,6 +125,86 @@ namespace Step.Utils else return 1; } - } + public static DTOJobModel UnpackJobAndReadMetadata(string path) + { + DTOJobModel job = new DTOJobModel(); + // Check if job exists + if (!File.Exists(path)) + return null; + + EmptyFolder(path); + + string fileName = Path.GetFileName(path); + + using (ZipArchive zipExtractor = ZipFile.OpenRead(fileName)) + { + // Setup main job fields + job.Name = Path.GetFileName(fileName); + job.LastEditTimestamp = new FileInfo(fileName).LastAccessTime; + + foreach (ZipArchiveEntry entry in zipExtractor.Entries) + { + // Get main program content + if (entry.Name.Equals(JOB_MAIN_FILENAME, StringComparison.OrdinalIgnoreCase)) + { + using (var reader = new StreamReader(entry.Open())) + job.IsoMainProgram = (reader.ReadToEnd()); + } + + // Read images + else if (VALID_IMAGE_EXTENSIONS.Contains(Path.GetExtension(entry.Name).ToLower())) + { + var bytes = default(byte[]); + entry.ExtractToFile(JOB_OPENING_PATH + entry.Name, true); + using (var memstream = new MemoryStream()) + { + entry.Open().CopyTo(memstream); + bytes = memstream.ToArray(); + job.Metadata.Generics.Images.Add(new DTOImageParamModel() + { + Name = Path.GetFileNameWithoutExtension(entry.Name), + Base64 = "data:image/" + Path.GetExtension(entry.Name).ToLower().TrimStart('.') + ";base64," + Convert.ToBase64String(bytes) + }); + } + } + // Read metadata + else if (entry.Name.Equals(JOB_METADATA_FILENAME, StringComparison.OrdinalIgnoreCase)) + { + DTOMetadataFieldsModel metasFromFile = new DTOMetadataFieldsModel(); + + using (var reader = new StreamReader(entry.Open())) + { + metasFromFile = JsonConvert.DeserializeObject(reader.ReadToEnd()); + if (metasFromFile == null) + { + return null; + } + else + { + job.Metadata.Generics.Description = metasFromFile.Description; + job.Metadata.Generics.ExecutionTime = metasFromFile.ExecutionTime; + job.Metadata.Tools = metasFromFile.Tools; + job.Metadata.Customs = metasFromFile.Customs; + } + } + } + // Consider other file as part program + else + entry.ExtractToFile(JOB_OPENING_PATH + entry.Name, true); + } + + return job; + } + } + + public static void EmptyFolder(string path) + { + DirectoryInfo di = new DirectoryInfo(path); + foreach (FileInfo file in di.GetFiles()) + file.Delete(); + foreach (DirectoryInfo dir in di.GetDirectories()) + dir.Delete(true); + } + } } \ No newline at end of file diff --git a/Step/App.config b/Step/App.config index feb9879a..e9068b4f 100644 --- a/Step/App.config +++ b/Step/App.config @@ -22,7 +22,7 @@ - + diff --git a/Step/Controllers/WebApi/NcFileController.cs b/Step/Controllers/WebApi/NcFileController.cs index e96cba39..9f56d018 100644 --- a/Step/Controllers/WebApi/NcFileController.cs +++ b/Step/Controllers/WebApi/NcFileController.cs @@ -291,6 +291,12 @@ namespace Step.Controllers.WebApi } } + [Route("macros")] + public IHttpActionResult GetMacros() + { + return Ok(MacrosConfig); + } + public class MoveItems { public int ObjectId; diff --git a/Step/Step.csproj b/Step/Step.csproj index da17de68..420cb0cf 100644 --- a/Step/Step.csproj +++ b/Step/Step.csproj @@ -97,8 +97,8 @@ ..\packages\Microsoft.Owin.StaticFiles.3.1.0\lib\net45\Microsoft.Owin.StaticFiles.dll - - ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + + ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll ..\packages\Owin.1.0\lib\net40\Owin.dll diff --git a/Step/packages.config b/Step/packages.config index da3e9a1b..df6ee823 100644 --- a/Step/packages.config +++ b/Step/packages.config @@ -27,7 +27,7 @@ - + diff --git a/Step/wwwroot/package.json b/Step/wwwroot/package.json index 9160662a..ca2cdf86 100644 --- a/Step/wwwroot/package.json +++ b/Step/wwwroot/package.json @@ -22,7 +22,7 @@ "vue-drag-drop": "1.1.0", "vue-smooth-dnd": "0.2.1", "vue2-ace-editor": "0.0.11", - "brace":"0.11.1" + "brace": "0.11.1" }, "devDependencies": { "autoprefixer": "^7.1.2", diff --git a/Step/wwwroot/src/@types/tooling.d.ts b/Step/wwwroot/src/@types/tooling.d.ts index 76e22c5e..763d8a2b 100644 --- a/Step/wwwroot/src/@types/tooling.d.ts +++ b/Step/wwwroot/src/@types/tooling.d.ts @@ -15,6 +15,7 @@ declare module server { multitoolOptionActive: boolean familyOptionActive: boolean magPositionOptionActive: boolean + offsetOptionActive: boolean } export interface EdgesConfiguration { diff --git a/Step/wwwroot/src/components/tooling/tooling-equipment.ts b/Step/wwwroot/src/components/tooling/tooling-equipment.ts index 90a60e3f..bc5648d1 100644 --- a/Step/wwwroot/src/components/tooling/tooling-equipment.ts +++ b/Step/wwwroot/src/components/tooling/tooling-equipment.ts @@ -25,7 +25,11 @@ export default class toolingEquipment extends Vue { public get familyOptionActive(): boolean { return (this.$store.state as AppModel).tooling.familyOptionActive; } - + + public get offsetOptionActive(): boolean { + return (this.$store.state as AppModel).tooling.offsetOptionActive; + } + public get tools(): server.Tool[] { return (this.$store.state as AppModel).tooling.tools; } public get ncTools(): server.ToolNc[] { return (this.$store.state as AppModel).tooling.ncTools; } diff --git a/Step/wwwroot/src/components/tooling/tooling-equipment.vue b/Step/wwwroot/src/components/tooling/tooling-equipment.vue index 13e31f96..ffcbdf0c 100644 --- a/Step/wwwroot/src/components/tooling/tooling-equipment.vue +++ b/Step/wwwroot/src/components/tooling/tooling-equipment.vue @@ -57,7 +57,7 @@ {{'tooling_edgesdataequip_skill_tools' | localize("Offset")}} {{ed.id}} {{'tooling_edgesdataequip_new' | localize("Nuovo Offset")}} -
+
@@ -147,7 +147,7 @@
- +
{{'tooling_edgesdata_label_edit' | localize("Modifica Tagliente n. %d",selectedEquipment.id)}}
diff --git a/Step/wwwroot/src/modules/base-components/cards/card-queue-production.vue b/Step/wwwroot/src/modules/base-components/cards/card-queue-production.vue index 90cc0bc3..89163a29 100644 --- a/Step/wwwroot/src/modules/base-components/cards/card-queue-production.vue +++ b/Step/wwwroot/src/modules/base-components/cards/card-queue-production.vue @@ -25,9 +25,9 @@
-->
- + -
+
@@ -111,19 +111,18 @@ export default { await new FileService().deleteQueue(id); }, async deleteItemQueue(processId, item){ - debugger await new FileService().deleteItemQueue(processId, item); }, - onDrag({ isSource, payload, willAcceptDrop }) { - this.enablePopup = false; - this.draggingIn = true; - this.draggingItem = payload; - }, + // onDrag({ isSource, payload, willAcceptDrop }) { + // this.enablePopup = false; + // this.draggingIn = true; + // this.draggingItem = payload; + // }, - onDragEnd() { - this.draggingIn = false; - // this.draggingTool = null; - }, + // onDragEnd({ isSource, payload, willAcceptDrop }) { + // this.draggingIn = false; + // this.draggingItem = payload; + // }, onDragEnter(position) { this.draggingPosition = position; @@ -136,13 +135,14 @@ export default { if(event.payload && event.payload.status != 1 && event.payload.status != 3 && event.addedIndex != event.removedIndex){ this.draggingIn = false; this.draggingItem = null; - var itemsPositions = {objectId: event.payload.id, newPosition: event.addedIndex}; - await new FileService().moveItemsQueue(this.selectedProcess,itemsPositions,this.partPrograms).then(function(){ - response = true; - }); - if(response && event.addedIndex && event.removeIndex){ - this.partPrograms.splice(event.addedIndex, 0, this.partPrograms.splice(event.removedIndex,1)[0]); - } + var itemsPositions = {objectId: event.payload.id, newPosition: event.addedIndex, oldPosition: event.removedIndex}; + await new FileService().moveItemsQueue(this.selectedProcess,itemsPositions,this.partPrograms); + // .then(function(){ + // response = true; + // }); + // if(response && event.addedIndex && event.removeIndex){ + // this.partPrograms.splice(event.addedIndex, 0, this.partPrograms.splice(event.removedIndex,1)[0]); + // } } else{ event = null; diff --git a/Step/wwwroot/src/services/fileService.ts b/Step/wwwroot/src/services/fileService.ts index 331c4165..72512217 100644 --- a/Step/wwwroot/src/services/fileService.ts +++ b/Step/wwwroot/src/services/fileService.ts @@ -36,15 +36,15 @@ export class FileService extends baseRestService { } async deleteItemQueue(processId, model){ - debugger var result = await this.Delete(this.BASE_URL + "queue/" + processId + "/remove/" + model.id, true); productionActions.deletePartProgram(store,model); return result; } - async moveItemsQueue(processId, itemsPositions, model){ - var result = await this.Put(this.BASE_URL + "queue/" + processId + "/move", itemsPositions, true); - productionActions.movePartPrograms(store,result); + async moveItemsQueue(processId, position, model){ + var result = await this.Put(this.BASE_URL + "queue/" + processId + "/move", position, true); + model = result; + productionActions.movePartProgram(store,{model,position}); return result; } @@ -59,7 +59,6 @@ export class FileService extends baseRestService { } async changeReps(processId,model){ - debugger var result = await this.Put(this.BASE_URL + "queue/" + processId + "/edit/" + model.id, {reps: model.reps}); productionActions.updatePartProgram(store, result); return result; diff --git a/Step/wwwroot/src/services/toolingService.ts b/Step/wwwroot/src/services/toolingService.ts index bf9059bf..596fd013 100644 --- a/Step/wwwroot/src/services/toolingService.ts +++ b/Step/wwwroot/src/services/toolingService.ts @@ -75,6 +75,7 @@ export class ToolingService extends baseRestService { toolingActions.setToolsPerMultitools(store, result.maxToolsPerMultitools); toolingActions.setMultitoolOptionActive(store, result.multitoolOptionActive); toolingActions.setFamilyOptionActive(store, result.familyOptionActive); + toolingActions.setOffsetOptionActive(store, result.offsetOptionActive); toolingActions.setMagPositionOptionActive(store, result.magPositionOptionActive); toolingActions.updateToolsConfigurations(store, result.toolsConfiguration); toolingActions.updateMagazinePosConfigurations( diff --git a/Step/wwwroot/src/store/production.store.ts b/Step/wwwroot/src/store/production.store.ts index d1ca1e52..8c30ecec 100644 --- a/Step/wwwroot/src/store/production.store.ts +++ b/Step/wwwroot/src/store/production.store.ts @@ -11,7 +11,8 @@ export interface ProductionActions { updatePartPrograms(context, model:server.PartProgramModel[]); deletePartPrograms(context); deletePartProgram(context, model:server.PartProgramModel); - movePartPrograms(context, model:server.PartProgramModel[]); + movePartPrograms(context, model:server.PartProgramModel[]); + movePartProgram(context, {model,position}); } export const productionStore = { @@ -23,24 +24,39 @@ export const productionStore = { }, mutations: { UpdatePartProgram(store, model: server.PartProgramModel) { - debugger store._partProgram.set(model.id, model); store.partProgram = Array.from(store._partProgram.values()); }, + UpdatePartPrograms(store, model: server.PartProgramModel[]){ + store._partProgram.clear(); + store.partProgram = []; + for(const key in model){ + const element = model[key]; + store._partProgram.set(element.id,element); + store.partProgram = Array.from(store._partProgram.values()); + } + }, DeletePartPrograms(store) { store.partProgram = []; }, DeletePartProgram(store, model:server.PartProgramModel) { - debugger - let idx = store.partProgram.indexOf(model); - if(store.partProgram[idx] && model && store.partProgram[idx].id == model.id){ - store.partProgram.splice(idx,1); - } - // store._partProgram.delete(model.id); - // store.partProgram = Array.from(store._partProgram.values()); + // let idx = store.partProgram.indexOf(model); + // if(store.partProgram[idx] && model && store.partProgram[idx].id == model.id){ + // store.partProgram.splice(idx,1); + // } + store._partProgram.delete(model.id); + store.partProgram = Array.from(store._partProgram.values()); }, MovePartPrograms(store, model:server.PartProgramModel[]) { - store.partProgram = model; + store.partProgram = []; + store.partProgram = model; + }, + MovePartProgram(store, {model,position}) { + if(position){ + var model = store.partProgram.splice(position.oldPosition, 1)[0]; + store.partProgram.splice(position.newPosition, 0, model); + // store.partProgram.splice(position.newPosition, 0, store.partProgram.splice(position.oldPosition,1)[0]); + } } }, actions: { @@ -48,10 +64,14 @@ export const productionStore = { context.commit("UpdatePartProgram", model); }, updatePartPrograms(context, model:server.PartProgramModel[]) { - context.commit("MovePartPrograms", model); + context.commit("UpdatePartPrograms", model); + // context.commit("MovePartPrograms", model); }, movePartPrograms(context, model:server.PartProgramModel[]) { context.commit("MovePartPrograms", model); + }, + movePartProgram(context, {model,position}) { + context.commit("MovePartProgram", {model,position}); }, deletePartProgram(context, model:server.PartProgramModel) { context.commit("DeletePartProgram", model); diff --git a/Step/wwwroot/src/store/tooling.store.ts b/Step/wwwroot/src/store/tooling.store.ts index c46973e7..f46f8a72 100644 --- a/Step/wwwroot/src/store/tooling.store.ts +++ b/Step/wwwroot/src/store/tooling.store.ts @@ -30,6 +30,7 @@ export interface ToolingStoreModel { multitoolOptionActive: boolean familyOptionActive: boolean magPositionOptionActive: boolean + offsetOptionActive: boolean } export interface ToolingGetters{ @@ -98,6 +99,7 @@ export interface ToolingActions { setToolsPerMultitools(context, number); setMultitoolOptionActive(context, multitoolOptionActive: boolean); setFamilyOptionActive(context, familyOptionActive: boolean); + setOffsetOptionActive(context, offsetOptionActive: boolean); setMagPositionOptionActive(context, magPositionOptionActive: boolean); } @@ -147,7 +149,8 @@ export const toolingStore = { maxToolsPerMultitools: 0, multitoolOptionActive: false, familyOptionActive: false, - magPositionOptionActive: false + magPositionOptionActive: false, + offsetOptionActive: false } as ToolingStoreModel, getters:{ toolIsInWarning : (state) => (id) : boolean =>{ @@ -398,6 +401,9 @@ export const toolingStore = { SetFamilyOptionActive(store, familyOptionActive){ store.familyOptionActive = familyOptionActive; }, + SetOffsetOptionActive(store, offsetOptionActive){ + store.offsetOptionActive = offsetOptionActive; + }, SetMagPositionOptionActive(store, magPositionOptionActive){ store.magPositionOptionActive = magPositionOptionActive; }, @@ -427,6 +433,9 @@ export const toolingStore = { setFamilyOptionActive(context, familyOptionActive: boolean){ context.commit("SetFamilyOptionActive", familyOptionActive); }, + setOffsetOptionActive(context, offsetOptionActive: boolean){ + context.commit("SetOffsetOptionActive", offsetOptionActive); + }, setMagPositionOptionActive(context, magPositionOptionActive: boolean){ context.commit("SetMagPositionOptionActive", magPositionOptionActive); },