diff --git a/Thermo.Active.Config/Config/areasConfig.xml b/Thermo.Active.Config/Config/areasConfig.xml
index 242d2df5..ae8abc83 100644
--- a/Thermo.Active.Config/Config/areasConfig.xml
+++ b/Thermo.Active.Config/Config/areasConfig.xml
@@ -5,11 +5,6 @@
false
true
-
- true
- false
- true
-
false
true
diff --git a/Thermo.Active.Config/Config/areasConfigValidator.xsd b/Thermo.Active.Config/Config/areasConfigValidator.xsd
index d3ed43d6..f63495a7 100644
--- a/Thermo.Active.Config/Config/areasConfigValidator.xsd
+++ b/Thermo.Active.Config/Config/areasConfigValidator.xsd
@@ -13,16 +13,6 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/Thermo.Active.Config/Config/toolManagerConfig.xml b/Thermo.Active.Config/Config/toolManagerConfig.xml
deleted file mode 100644
index 16c8352e..00000000
--- a/Thermo.Active.Config/Config/toolManagerConfig.xml
+++ /dev/null
@@ -1,923 +0,0 @@
-
-
-
- DIAMETER
- true
- true
- true
- true
- true
- true
- true
- true
- true
- true
- true
- true
- true
- true
-
-
-
- Cooling
- Raffreddamento
-
-
- Cooling 1
- Raffreddamento 1
-
-
- Cooling 2
- Raffreddamento 2
-
-
- Cooling 3
- Raffreddamento 3
-
-
- Cooling 4
- Raffreddamento 4
-
-
- Cooling 5
- Raffreddamento 5
-
-
- Cooling 6
- Raffreddamento 6
-
-
- Cooling 7
- Raffreddamento 7
-
-
-
-
- 1
- true
-
- Magazine 1
- Magazzino 1
-
-
-
- 2
- false
-
- Magazine 2
- Magazzino 2
-
-
-
- 3
- false
-
- Magazine 3
- Magazzino 3
-
-
-
-
-
-
- 0
- false
-
- Generic
- Generico
- Générique
- Allgemein
- Opće
- Generic
- Algemeen
- Γενικό
- Общий
- Ogólny
- Generisk
- Generel
- Genérico
- Genérico
-
-
-
-
- 10
- false
-
- Angular Transmission
- Rinvio Angolare
- Transmission Angulaire
- Scheibe
- Disk
- Transmisie unghiulară
- Hoekige transmissie
- Γωνιακή μετάδοση
- Угловой контрпривод
- Przekładnia kątowa
- Vinkelöverföring
- Vinkel mellemarm
- Transmissão Angular
- Reenvío Angular
-
-
-
-
- 70
- false
-
- Ultrasound disk amplitude 15%%
- Disco ultrasuoni amplitude 15%%
- Disque à ultrasons, amplitude 15%%
- Ultraschallscheibenamplitude 15%%
- Amplituda ultrazvučnog diska 15%%
- Disc de ultrasunete, amplitudine 15%%
- Ultrasoon schijf amplitude 15%%
- Δίσκος υπερήχων πλάτους 15%%
- Ультразвуковой диск амплитуда 15%%
- Tarcza ultradźwiękowa amplituda 15%%
- Amplitud ultraljudsskiva 15%%
- Ultralydsskive amplitude 15%%
- Disco ultrassom amplitude 15%%
- Disco ultrasonidos amplitud 15%%
-
-
-
-
- 71
- false
-
- Ultrasound disk amplitude 20%%
- Disco ultrasuoni amplitude 20%%
- Disque à ultrasons, amplitude 20%%
- Ultraschallscheibenamplitude 20%%
- Amplituda ultrazvučnog diska 20%%
- Disc de ultrasunete, amplitudine 20%%
- Ultrasoon schijf amplitude 20%%
- Δίσκος υπερήχων πλάτους 20%%
- Ультразвуковой диск амплитуда 20%%
- Tarcza ultradźwiękowa amplituda 20%%
- Amplitud ultraljudsskiva 20%%
- Ultralydsskive amplitude 20%%
- Disco ultrassom amplitude 20%%
- Disco ultrasonidos amplitud 20%%
-
-
-
-
- 72
- false
-
- Ultrasound disk amplitude 30%%
- Disco ultrasuoni amplitude 30%%
- Disque à ultrasons, amplitude 30%%
- Ultraschallscheibenamplitude 30%%
- Amplituda ultrazvučnog diska 30%%
- Disc de ultrasunete, amplitudine 30%%
- Ultrasoon schijf amplitude 30%%
- Δίσκος υπερήχων πλάτους 30%%
- Ультразвуковой диск амплитуда 30%%
- Tarcza ultradźwiękowa amplituda 30%%
- Amplitud ultraljudsskiva 30%%
- Ultralydsskive amplitude 30%%
- Disco ultrassom amplitude 30%%
- Disco ultrasonidos amplitud 30%%
-
-
-
-
- 73
- false
-
- Ultrasound disk amplitude 40%%
- Disco ultrasuoni amplitude 40%%
- Disque à ultrasons, amplitude 40%%
- Ultraschallscheibenamplitude 40%%
- Amplituda ultrazvučnog diska 40%%
- Disc de ultrasunete, amplitudine 40%%
- Ultrasoon schijf amplitude 40%%
- Δίσκος υπερήχων πλάτους 40%%
- Ультразвуковой диск амплитуда 40%%
- Tarcza ultradźwiękowa amplituda 40%%
- Amplitud ultraljudsskiva 40%%
- Ultralydsskive amplitude 40%%
- Disco ultrassom amplitude 40%%
- Disco ultrasonidos amplitud 40%%
-
-
-
-
- 74
- false
-
- Ultrasound disk amplitude 50%%
- Disco ultrasuoni amplitude 50%%
- Disque à ultrasons, amplitude 50%%
- Ultraschallscheibenamplitude 50%%
- Amplituda ultrazvučnog diska 50%%
- Disc de ultrasunete, amplitudine 50%%
- Ultrasoon schijf amplitude 50%%
- Δίσκος υπερήχων πλάτους 50%%
- Ультразвуковой диск амплитуда 50%%
- Tarcza ultradźwiękowa amplituda 50%%
- Amplitud ultraljudsskiva 50%%
- Ultralydsskive amplitude 50%%
- Disco ultrassom amplitude 50%%
- Disco ultrasonidos amplitud 50%%
-
-
-
-
- 75
- false
-
- Ultrasound disk amplitude 60%%
- Disco ultrasuoni amplitude 60%%
- Disque à ultrasons, amplitude 60%%
- Ultraschallscheibenamplitude 60%%
- Amplituda ultrazvučnog diska 60%%
- Disc de ultrasunete, amplitudine 60%%
- Ultrasoon schijf amplitude 60%%
- Δίσκος υπερήχων πλάτους 60%%
- Ультразвуковой диск амплитуда 60%%
- Tarcza ultradźwiękowa amplituda 60%%
- Amplitud ultraljudsskiva 60%%
- Ultralydsskive amplitude 60%%
- Disco ultrassom amplitude 60%%
- Disco ultrasonidos amplitud 60%%
-
-
-
-
- 76
- false
-
- Ultrasound disk amplitude 70%%
- Disco ultrasuoni amplitude 70%%
- Disque à ultrasons, amplitude 70%%
- Ultraschallscheibenamplitude 70%%
- Amplituda ultrazvučnog diska 70%%
- Disc de ultrasunete, amplitudine 70%%
- Ultrasoon schijf amplitude 70%%
- Δίσκος υπερήχων πλάτους 70%%
- Ультразвуковой диск амплитуда 70%%
- Tarcza ultradźwiękowa amplituda 70%%
- Amplitud ultraljudsskiva 70%%
- Ultralydsskive amplitude 70%%
- Disco ultrassom amplitude 70%%
- Disco ultrasonidos amplitud 70%%
-
-
-
-
- 77
- false
-
- Ultrasound disk amplitude 80%%
- Disco ultrasuoni amplitude 80%%
- Disque à ultrasons, amplitude 80%%
- Ultraschallscheibenamplitude 80%%
- Amplituda ultrazvučnog diska 80%%
- Disc de ultrasunete, amplitudine 80%%
- Ultrasoon schijf amplitude 80%%
- Δίσκος υπερήχων πλάτους 80%%
- Ультразвуковой диск амплитуда 80%%
- Tarcza ultradźwiękowa amplituda 80%%
- Amplitud ultraljudsskiva 80%%
- Ultralydsskive amplitude 80%%
- Disco ultrassom amplitude 80%%
- Disco ultrasonidos amplitud 80%%
-
-
-
-
- 78
- false
-
- Ultrasound disk amplitude 90%%
- Disco ultrasuoni amplitude 90%%
- Disque à ultrasons, amplitude 90%%
- Ultraschallscheibenamplitude 90%%
- Amplituda ultrazvučnog diska 90%%
- Disc de ultrasunete, amplitudine 90%%
- Ultrasoon schijf amplitude 90%%
- Δίσκος υπερήχων πλάτους 90%%
- Ультразвуковой диск амплитуда 90%%
- Tarcza ultradźwiękowa amplituda 90%%
- Amplitud ultraljudsskiva 90%%
- Ultralydsskive amplitude 90%%
- Disco ultrassom amplitude 90%%
- Disco ultrasonidos amplitud 90%%
-
-
-
-
- 79
- false
-
- Ultrasound disk amplitude 100%%
- Disco ultrasuoni amplitude 100%%
- Disque à ultrasons, amplitude 100%%
- Ultraschallscheibenamplitude 100%%
- Amplituda ultrazvučnog diska 100%%
- Disc de ultrasunete, amplitudine 100%%
- Ultrasoon schijf amplitude 100%%
- Δίσκος υπερήχων πλάτους 100%%
- Ультразвуковой диск амплитуда 100%%
- Tarcza ultradźwiękowa amplituda 100%%
- Amplitud ultraljudsskiva 100%%
- Ultralydsskive amplitude 100%%
- Disco ultrassom amplitude 100%%
- Disco ultrasonidos amplitud 100%%
-
-
-
-
- 80
- false
-
- Ultrasound blade amplitude 10%%
- Lama ultrasuoni amplitude 10%%
- Lame à ultrasons, amplitude 10%%
- Ultraschallklingenamplitude 10%%
- Amplituda ultrazvučne oštrice 10%%
- Lama cu ultrasunete, amplitudine 10%%
- Ultrasoon mes amplitude 10%%
- Λεπίδα υπερήχων πλάτους 10%%
- Ультразвуковой резец амплитуда 10%%
- Ostrze ultradźwiękowe amplituda 10%%
- Amplitud ultraljudsblad 10%%
- Ultralydsklinge amplitude 10%%
- Lâmina ultrassom amplitude 10%%
- Cuchilla ultrasonidos amplitud 10%%
-
-
-
-
- 81
- false
-
- Ultrasound blade amplitude 20%%
- Lama ultrasuoni amplitude 20%%
- Lame à ultrasons, amplitude 20%%
- Ultraschallklingenamplitude 20%%
- Amplituda ultrazvučne oštrice 20%%
- Lama cu ultrasunete, amplitudine 20%%
- Ultrasoon mes amplitude 20%%
- Λεπίδα υπερήχων πλάτους 20%%
- Ультразвуковой резец амплитуда 20%%
- Ostrze ultradźwiękowe amplituda 20%%
- Amplitud ultraljudsblad 20%%
- Ultralydsklinge amplitude 20%%
- Lâmina ultrassom amplitude 20%%
- Cuchilla ultrasonidos amplitud 20%%
-
-
-
-
- 82
- false
-
- Ultrasound blade amplitude 30%%
- Lama ultrasuoni amplitude 30%%
- Lame à ultrasons, amplitude 30%%
- Ultraschallklingenamplitude 30%%
- Amplituda ultrazvučne oštrice 30%%
- Lama cu ultrasunete, amplitudine 30%%
- Ultrasoon mes amplitude 30%%
- Λεπίδα υπερήχων πλάτους 30%%
- Ультразвуковой резец амплитуда 30%%
- Ostrze ultradźwiękowe amplituda 30%%
- Amplitud ultraljudsblad 30%%
- Ultralydsklinge amplitude 30%%
- Lâmina ultrassom amplitude 30%%
- Cuchilla ultrasonidos amplitud 30%%
-
-
-
-
- 83
- false
-
- Ultrasound blade amplitude 40%%
- Lama ultrasuoni amplitude 40%%
- Lame à ultrasons, amplitude 40%%
- Ultraschallklingenamplitude 40%%
- Amplituda ultrazvučne oštrice 40%%
- Lama cu ultrasunete, amplitudine 40%%
- Ultrasoon mes amplitude 40%%
- Λεπίδα υπερήχων πλάτους 40%%
- Ультразвуковой резец амплитуда 40%%
- Ostrze ultradźwiękowe amplituda 40%%
- Amplitud ultraljudsblad 40%%
- Ultralydsklinge amplitude 40%%
- Lâmina ultrassom amplitude 40%%
- Cuchilla ultrasonidos amplitud 40%%
-
-
-
-
- 84
- false
-
- Ultrasound blade amplitude 50%%
- Lama ultrasuoni amplitude 50%%
- Lame à ultrasons, amplitude 50%%
- Ultraschallklingenamplitude 50%%
- Amplituda ultrazvučne oštrice 50%%
- Lama cu ultrasunete, amplitudine 50%%
- Ultrasoon mes amplitude 50%%
- Λεπίδα υπερήχων πλάτους 50%%
- Ультразвуковой резец амплитуда 50%%
- Ostrze ultradźwiękowe amplituda 50%%
- Amplitud ultraljudsblad 50%%
- Ultralydsklinge amplitude 50%%
- Lâmina ultrassom amplitude 50%%
- Cuchilla ultrasonidos amplitud 50%%
-
-
-
-
- 85
- false
-
- Ultrasound blade amplitude 60%%
- Lama ultrasuoni amplitude 60%%
- Lame à ultrasons, amplitude 60%%
- Ultraschallklingenamplitude 60%%
- Amplituda ultrazvučne oštrice 60%%
- Lama cu ultrasunete, amplitudine 60%%
- Ultrasoon mes amplitude 60%%
- Λεπίδα υπερήχων πλάτους 60%%
- Ультразвуковой резец амплитуда 60%%
- Ostrze ultradźwiękowe amplituda 60%%
- Amplitud ultraljudsblad 60%%
- Ultralydsklinge amplitude 60%%
- Lâmina ultrassom amplitude 60%%
- Cuchilla ultrasonidos amplitud 60%%
-
-
-
-
- 86
- false
-
- Ultrasound blade amplitude 70%%
- Lama ultrasuoni amplitude 70%%
- Lame à ultrasons, amplitude 70%%
- Ultraschallklingenamplitude 70%%
- Amplituda ultrazvučne oštrice 70%%
- Lama cu ultrasunete, amplitudine 70%%
- Ultrasoon mes amplitude 70%%
- Λεπίδα υπερήχων πλάτους 70%%
- Ультразвуковой резец амплитуда 70%%
- Ostrze ultradźwiękowe amplituda 70%%
- Amplitud ultraljudsblad 70%%
- Ultralydsklinge amplitude 70%%
- Lâmina ultrassom amplitude 70%%
- Cuchilla ultrasonidos amplitud 70%%
-
-
-
-
- 87
- false
-
- Ultrasound blade amplitude 80%%
- Lama ultrasuoni amplitude 80%%
- Lame à ultrasons, amplitude 80%%
- Ultraschallklingenamplitude 80%%
- Amplituda ultrazvučne oštrice 80%%
- Lama cu ultrasunete, amplitudine 80%%
- Ultrasoon mes amplitude 80%%
- Λεπίδα υπερήχων πλάτους 80%%
- Ультразвуковой резец амплитуда 80%%
- Ostrze ultradźwiękowe amplituda 80%%
- Amplitud ultraljudsblad 80%%
- Ultralydsklinge amplitude 80%%
- Lâmina ultrassom amplitude 80%%
- Cuchilla ultrasonidos amplitud 80%%
-
-
-
-
- 88
- false
-
- Ultrasound blade amplitude 90%%
- Lama ultrasuoni amplitude 90%%
- Lame à ultrasons, amplitude 90%%
- Ultraschallklingenamplitude 90%%
- Amplituda ultrazvučne oštrice 90%%
- Lama cu ultrasunete, amplitudine 90%%
- Ultrasoon mes amplitude 90%%
- Λεπίδα υπερήχων πλάτους 90%%
- Ультразвуковой резец амплитуда 90%%
- Ostrze ultradźwiękowe amplituda 90%%
- Amplitud ultraljudsblad 90%%
- Ultralydsklinge amplitude 90%%
- Lâmina ultrassom amplitude 90%%
- Cuchilla ultrasonidos amplitud 90%%
-
-
-
-
- 89
- false
-
- Ultrasound blade amplitude 100%%
- Lama ultrasuoni amplitude 100%%
- Lame à ultrasons, amplitude 100%%
- Ultraschallklingenamplitude 100%%
- Amplituda ultrazvučne oštrice 100%%
- Lama cu ultrasunete, amplitudine 100%%
- Ultrasoon mes amplitude 100%%
- Λεπίδα υπερήχων πλάτους 100%%
- Ультразвуковой резец амплитуда 100%%
- Ostrze ultradźwiękowe amplituda 100%%
- Amplitud ultraljudsblad 100%%
- Ultralydsklinge amplitude 100%%
- Lâmina ultrassom amplitude 100%%
- Cuchilla ultrasonidos amplitud 100%%
-
-
-
-
- 90
- false
-
- Blade 1
- Lama 1
- Lame 1
- Klinge 1
- List pile 1
- Lama 1
- Mes 1
- Λάμα 1
- Резец 1
- Ostrze 1
- Blad 1
- Klinge 1
- Lâmina 1
- Cuchilla 1
-
-
-
-
- 91
- false
-
- Blade 2
- Lama 2
- Lame 2
- Klinge 2
- List pile 2
- Lama 2
- Mes 2
- Λάμα 2
- Резец 2
- Ostrze 2
- Blad 2
- Klinge 2
- Lâmina 2
- Cuchilla 2
-
-
-
-
- 92
- false
-
- Blade 3
- Lama 3
- Lame 3
- Klinge 3
- List pile 3
- Lama 3
- Mes 3
- Λάμα 3
- Резец 3
- Ostrze 3
- Blad 3
- Klinge 3
- Lâmina 3
- Cuchilla 3
-
-
-
-
- 93
- false
-
- Blade 4
- Lama 4
- Lame 4
- Klinge 4
- List pile 4
- Lama 4
- Mes 4
- Λάμα 4
- Резец 4
- Ostrze 4
- Blad 4
- Klinge 4
- Lâmina 4
- Cuchilla 4
-
-
-
-
- 94
- false
-
- Blade 5
- Lama 5
- Lame 5
- Klinge 5
- List pile 5
- Lama 5
- Mes 5
- Λάμα 5
- Резец 5
- Ostrze 5
- Blad 5
- Klinge 5
- Lâmina 5
- Cuchilla 5
-
-
-
-
- 95
- false
-
- Blade 6
- Lama 6
- Lame 6
- Klinge 6
- List pile 6
- Lama 6
- Mes 6
- Λάμα 6
- Резец 6
- Ostrze 6
- Blad 6
- Klinge 6
- Lâmina 6
- Cuchilla 6
-
-
-
-
- 96
- false
-
- Blade 7
- Lama 7
- Lame 7
- Klinge 7
- List pile 7
- Lama 7
- Mes 7
- Λάμα 7
- Резец 7
- Ostrze 7
- Blad 7
- Klinge 7
- Lâmina 7
- Cuchilla 7
-
-
-
-
- 97
- false
-
- Blade ⌀300
- Lama ⌀300
- Lame ⌀300
- Klinge ⌀300
- List pile ⌀300
- Lama ⌀300
- Mes ⌀300
- Λάμα ⌀300
- Резец ⌀300
- Ostrze ⌀300
- Blad ⌀300
- Klinge ⌀300
- Lâmina ⌀300
- Cuchilla ⌀300
-
-
-
-
- 98
- false
-
- Blade ⌀400
- Lama ⌀400
- Lame ⌀400
- Klinge ⌀400
- List pile ⌀400
- Lama ⌀400
- Mes ⌀400
- Λάμα ⌀400
- Резец ⌀400
- Ostrze ⌀400
- Blad ⌀400
- Klinge ⌀400
- Lâmina ⌀400
- Cuchilla ⌀400
-
-
-
-
- 99
- false
-
- Blade ⌀500
- Lama ⌀500
- Lame ⌀500
- Klinge ⌀500
- List pile ⌀500
- Lama ⌀500
- Mes ⌀500
- Λάμα ⌀500
- Резец ⌀500
- Ostrze ⌀500
- Blad ⌀500
- Klinge ⌀500
- Lâmina ⌀500
- Cuchilla ⌀500
-
-
-
-
- 101
- false
-
- Radio Probe 1 - Reciever 1
- Radio Probe 1 - Ricevitore 1
- Radio Probe 1 - Récepteur 1
- Radio Probe 1 - Empfänger 1
- Radio Probe 1 - Prijemnik 1
- Probe Radio 1 - Receptor 1
- Radio Probe 1 - Ontvanger 1
- Ραδιο-ανιχνευτής 1 - Δέκτης 1
- Радиодатчик 1 - Приемник 1
- Sonda radiowa 1 - Odbiornik 1
- Radiosond 1 - Mottagare 1
- Radio Sonde 1 - Modtager 1
- Sonda Probe 1 - Receptor 1
- Radio Probe 1 - Receptor 1
-
-
-
-
- 102
- false
-
- Radio Probe 2 - Reciever 1
- Radio Probe 2 - Ricevitore 1
- Radio Probe 2 - Récepteur 1
- Radio Probe 2 - Empfänger 1
- Radio Probe 2 - Prijemnik 1
- Probe Radio 2 - Receptor 1
- Radio Probe 2 - Ontvanger 1
- Ραδιο-ανιχνευτής 2 - Δέκτης 1
- Радиодатчик 2 - Приемник 1
- Sonda radiowa 2 - Odbiornik 1
- Radiosond 2 - Mottagare 1
- Radio Sonde 2 - Modtager 1
- Sonda Probe 2 - Receptor 1
- Radio Probe 2 - Receptor 1
-
-
-
-
- 103
- false
-
- Radio Probe 3 - Reciever 1
- Radio Probe 3 - Ricevitore 1
- Radio Probe 3 - Récepteur 1
- Radio Probe 3 - Empfänger 1
- Radio Probe 3 - Prijemnik 1
- Probe Radio 3 - Receptor 1
- Radio Probe 3 - Ontvanger 1
- Ραδιο-ανιχνευτής 3 - Δέκτης 1
- Радиодатчик 3 - Приемник 1
- Sonda radiowa 3 - Odbiornik 1
- Radiosond 3 - Mottagare 1
- Radio Sonde 3 - Modtager 1
- Sonda Probe 3 - Receptor 1
- Radio Probe 3 - Receptor 1
-
-
-
-
- 104
- false
-
- Radio Probe 4 - Reciever 1
- Radio Probe 4 - Ricevitore 1
- Radio Probe 4 - Récepteur 1
- Radio Probe 4 - Empfänger 1
- Radio Probe 4 - Prijemnik 1
- Probe Radio 4 - Receptor 1
- Radio Probe 4 - Ontvanger 1
- Ραδιο-ανιχνευτής 4 - Δέκτης 1
- Радиодатчик 4 - Приемник 1
- Sonda radiowa 4 - Odbiornik 1
- Radiosond 4 - Mottagare 1
- Radio Sonde 4 - Modtager 1
- Sonda Probe 4 - Receptor 1
- Radio Probe 4 - Receptor 1
-
-
-
-
- 105
- false
-
- Radio Probe 1 - Reciever 2
- Radio Probe 1 - Ricevitore 2
- Radio Probe 1 - Récepteur 2
- Radio Probe 1 - Empfänger 2
- Radio Probe 1 - Prijemnik 2
- Probe Radio 1 - Receptor 2
- Radio Probe 1 - Ontvanger 2
- Ραδιο-ανιχνευτής 1 - Δέκτης 2
- Радиодатчик 1 - Приемник 2
- Sonda radiowa 1 - Odbiornik 2
- Radiosond 1 - Mottagare 2
- Radio Sonde 1 - Modtager 2
- Sonda Probe 1 - Receptor 2
- Radio Probe 1 - Receptor 2
-
-
-
-
- 106
- false
-
- Radio Probe 2 - Reciever 2
- Radio Probe 2 - Ricevitore 2
- Radio Probe 2 - Récepteur 2
- Radio Probe 2 - Empfänger 2
- Radio Probe 2 - Prijemnik 2
- Probe Radio 2 - Receptor 2
- Radio Probe 2 - Ontvanger 2
- Ραδιο-ανιχνευτής 2 - Δέκτης 2
- Радиодатчик 2 - Приемник 2
- Sonda radiowa 2 - Odbiornik 2
- Radiosond 2 - Mottagare 2
- Radio Sonde 2 - Modtager 2
- Sonda Probe 2 - Receptor 2
- Radio Probe 2 - Receptor 2
-
-
-
-
- 107
- false
-
- Radio Probe 3 - Reciever 2
- Radio Probe 3 - Ricevitore 2
- Radio Probe 3 - Récepteur 2
- Radio Probe 3 - Empfänger 2
- Radio Probe 3 - Prijemnik 2
- Probe Radio 3 - Receptor 2
- Radio Probe 3 - Ontvanger 2
- Ραδιο-ανιχνευτής 3 - Δέκτης 2
- Радиодатчик 3 - Приемник 2
- Sonda radiowa 3 - Odbiornik 2
- Radiosond 3 - Mottagare 2
- Radio Sonde 3 - Modtager 2
- Sonda Probe 3 - Receptor 2
- Radio Probe 3 - Receptor 2
-
-
-
-
- 108
- false
-
- Radio Probe 4 - Reciever 2
- Radio Probe 4 - Ricevitore 2
- Radio Probe 4 - Récepteur 2
- Radio Probe 4 - Empfänger 2
- Radio Probe 4 - Prijemnik 2
- Probe Radio 4 - Receptor 2
- Radio Probe 4 - Ontvanger 2
- Ραδιο-ανιχνευτής 4 - Δέκτης 2
- Радиодатчик 4 - Приемник 2
- Sonda radiowa 4 - Odbiornik 2
- Radiosond 4 - Mottagare 2
- Radio Sonde 4 - Modtager 2
- Sonda Probe 4 - Receptor 2
- Radio Probe 4 - Receptor 2
-
-
-
-
-
\ No newline at end of file
diff --git a/Thermo.Active.Config/Config/toolManagerConfigValidator.xsd b/Thermo.Active.Config/Config/toolManagerConfigValidator.xsd
deleted file mode 100644
index 6be1591d..00000000
--- a/Thermo.Active.Config/Config/toolManagerConfigValidator.xsd
+++ /dev/null
@@ -1,175 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Thermo.Active.Config/Config/userSoftKeyConfig.xml b/Thermo.Active.Config/Config/userSoftKeyConfig.xml
index 0ecfd008..e89c7c77 100644
--- a/Thermo.Active.Config/Config/userSoftKeyConfig.xml
+++ b/Thermo.Active.Config/Config/userSoftKeyConfig.xml
@@ -205,7 +205,7 @@
true
-
+
true
@@ -348,7 +348,7 @@
true
-
+
-
+
false
@@ -399,7 +399,7 @@
true
-
+
-
+
false
@@ -435,7 +435,7 @@
true
-
+
false
diff --git a/Thermo.Active.Config/ServerConfig.cs b/Thermo.Active.Config/ServerConfig.cs
index 24e5a0fd..139f5caf 100644
--- a/Thermo.Active.Config/ServerConfig.cs
+++ b/Thermo.Active.Config/ServerConfig.cs
@@ -32,11 +32,9 @@ namespace Thermo.Active.Config
public static List NcSoftKeysConfig;
public static List InitialAlarmsConfig;
public static List HeadsConfig;
- public static ToolManagerConfigModel ToolManagerConfig;
public static CmsConnectConfigModel CmsConnectConfig;
public static AreasConfigModel ProductionConfig;
- public static AreasConfigModel ToolingConfig;
public static AreasConfigModel ReportConfig;
public static AreasConfigModel AlarmsConfig;
public static AreasConfigModel MaintenanceConfig;
diff --git a/Thermo.Active.Config/ServerConfigController.cs b/Thermo.Active.Config/ServerConfigController.cs
index 0db2f861..cea82bdd 100644
--- a/Thermo.Active.Config/ServerConfigController.cs
+++ b/Thermo.Active.Config/ServerConfigController.cs
@@ -33,7 +33,6 @@ namespace Thermo.Active.Config
ReadUserSoftKeysConfig();
ReadAlarmsConfig();
ReadHeadsConfig();
- ReadToolManagerConfig();
// ReadCMSConnectConfig();
ReadMacros();
ReadScadaFile();
@@ -113,10 +112,6 @@ namespace Thermo.Active.Config
SetAreaValue(ref ProductionConfig, element);
break;
- case AREAS.TOOLING_KEY:
- SetAreaValue(ref ToolingConfig, element);
- break;
-
case AREAS.REPORT_KEY:
SetAreaValue(ref ReportConfig, element);
break;
@@ -181,9 +176,6 @@ namespace Thermo.Active.Config
{
case AREAS.PRODUCTION_KEY:
return ProductionConfig.Enabled;
-
- case AREAS.TOOLING_KEY:
- return ToolingConfig.Enabled;
case AREAS.REPORT_KEY:
return ProductionConfig.Enabled;
@@ -580,97 +572,6 @@ namespace Thermo.Active.Config
.ToList();
}
- private static void ReadToolManagerConfig()
- {
- XDocument xmlConfigFile = GetXmlHandlerWithValidator(TOOL_MANAGER_CONFIG_SCHEMA_PATH, TOOL_MANAGER_CONFIG_PATH);
-
- // Read config from XML file
- ToolManagerConfig = xmlConfigFile
- .Root
- .Descendants("toolManagerConfig")
- .Select(x => new ToolManagerConfigModel()
- {
- ToolMetricType = x.Element("toolMetricType").Value,
- FamilyOpt = Convert.ToBoolean(x.Element("familyOpt").Value),
- ShankOpt = Convert.ToBoolean(x.Element("shankOpt").Value),
- MagPosTypeOpt = Convert.ToBoolean(x.Element("magPositionOpt").Value),
- OffsetOpt = Convert.ToBoolean(x.Element("offsetOpt").Value),
- ReviveOpt = Convert.ToBoolean(x.Element("reviveOpt").Value),
- GammaOpt = Convert.ToBoolean(x.Element("gammaOpt").Value),
- LifeOpt = Convert.ToBoolean(x.Element("lifeOpt").Value),
- TcpOpt = Convert.ToBoolean(x.Element("tcpOpt").Value),
- CoolingOpt = Convert.ToBoolean(x.Element("coolingOpt").Value),
- MultidimensionalShankOpt = Convert.ToBoolean(x.Element("multidimensionalShankOpt").Value),
- SelfAdaptivePathOpt = Convert.ToBoolean(x.Element("selfAdaptivePathOpt").Value),
- DynamicCompensationOpt = Convert.ToBoolean(x.Element("dynamicCompensationOpt").Value),
- BallufOpt = Convert.ToBoolean(x.Element("ballufOpt").Value),
- IntegrityCheckOpt = Convert.ToBoolean(x.Element("integrityCheckOpt").Value)
- })
- .FirstOrDefault();
-
-
- ToolManagerConfig.CooligsTranslations = xmlConfigFile
- .Root
- .Descendants("coolingLocalizedNames")
- .Select(x => new CooligTranslations()
- {
- Cooling = x.Element("cooling").Elements().ToDictionary( // Read localized names of cooling and convert into a dictionary
- y => y.Attribute("langKey").Value, y => y.Value
- ),
- Cooling1 = x.Element("cooling1").Elements().ToDictionary(
- y => y.Attribute("langKey").Value, y => y.Value
- ),
- Cooling2 = x.Element("cooling2").Elements().ToDictionary(
- y => y.Attribute("langKey").Value, y => y.Value
- ),
- Cooling3 = x.Element("cooling3").Elements().ToDictionary(
- y => y.Attribute("langKey").Value, y => y.Value
- ),
- Cooling4 = x.Element("cooling4").Elements().ToDictionary(
- y => y.Attribute("langKey").Value, y => y.Value
- ),
- Cooling5 = x.Element("cooling5").Elements().ToDictionary(
- y => y.Attribute("langKey").Value, y => y.Value
- ),
- Cooling6 = x.Element("cooling6").Elements().ToDictionary(
- y => y.Attribute("langKey").Value, y => y.Value
- ),
- Cooling7 = x.Element("cooling7").Elements().ToDictionary(
- y => y.Attribute("langKey").Value, y => y.Value
- )
-
- })
- .FirstOrDefault();
-
- ToolManagerConfig.MagazineNames = xmlConfigFile
- .Root
- .Descendants("magazineNames")
- .Elements()
- .Select(x => new MagazineNamesModel()
- {
- MagazineId = Convert.ToInt32(x.Element("id").Value),
- AssistedTooling = Convert.ToBoolean(x.Element("assistedTooling").Value),
- LocalizedNames = x.Element("localizedNames").Elements().ToDictionary( // Read localized names and convert into a dictionary
- y => y.Attribute("langKey").Value, y => y.Value
- ),
- })
- .ToList();
-
- ToolManagerConfig.ToolTypes = xmlConfigFile
- .Root
- .Descendants("toolTypes")
- .Elements()
- .Select(x => new ToolTypeConfigModel()
- {
- Id = Convert.ToInt32(x.Element("id").Value),
- Disabled = Convert.ToBoolean(x.Element("disabled").Value),
- LocalizedNames = x.Element("localizedNames").Elements().ToDictionary( // Read localized names and convert into a dictionary
- y => y.Attribute("langKey").Value, y => y.Value
- ),
- })
- .ToList();
- }
-
private static void ReadCMSConnectConfig()
{
diff --git a/Thermo.Active.Config/Thermo.Active.Config.csproj b/Thermo.Active.Config/Thermo.Active.Config.csproj
index 62ecc67b..e77793e6 100644
--- a/Thermo.Active.Config/Thermo.Active.Config.csproj
+++ b/Thermo.Active.Config/Thermo.Active.Config.csproj
@@ -69,10 +69,6 @@
Always
-
- PreserveNewest
- Designer
-
PreserveNewest
Designer
@@ -113,9 +109,6 @@
Designer
-
- Designer
-
diff --git a/Thermo.Active.Core/ThreadsFunctions.cs b/Thermo.Active.Core/ThreadsFunctions.cs
index 35555f59..9ff2113c 100644
--- a/Thermo.Active.Core/ThreadsFunctions.cs
+++ b/Thermo.Active.Core/ThreadsFunctions.cs
@@ -5,7 +5,6 @@ using Thermo.Active.Database.Controllers;
using Thermo.Active.Model.DTOModels;
using Thermo.Active.Model.DTOModels.AlarmModels;
using Thermo.Active.Model.DTOModels.Scada;
-using Thermo.Active.Model.DTOModels.ToolModels;
using Thermo.Active.NC;
using Thermo.Active.Utils;
using System;
@@ -508,50 +507,6 @@ public static class ThreadsFunctions
}
}
- public static void ReadMagazinesStatus()
- {
- SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter();
- Stopwatch sw = new Stopwatch();
-
- try
- {
- // Try connection
- CmsError libraryError = ncAdapter.Connect();
- if (libraryError.errorCode != 0)
- ManageLibraryError(libraryError);
-
- while (true)
- {
- sw.Restart();
-
- if (ncAdapter.numericalControl.NC_IsConnected())
- {
- // Get Data from config and PLC
- libraryError = ncAdapter.GetMagazineStatus(out DTOMagazineActionModel magazineStatus);
- if (libraryError.errorCode != 0)
- ManageLibraryError(libraryError);
- else
- // Send through signalR
- MessageServices.Current.Publish(SEND_MAGAZINES_STATUS, null, magazineStatus);
- }
- else
- RestoreConnection();
-
- sw.Stop();
-
- //Update thread timer
- UpdateStat(MethodBase.GetCurrentMethod().Name, sw.ElapsedMilliseconds);
-
- // Wait
- Thread.Sleep(CalcSleepTime(1000, (int)sw.ElapsedMilliseconds));
- }
- }
- catch (ThreadAbortException)
- {
- ncAdapter.Dispose();
- }
- }
-
public static void ReadActiveProgramData()
{
NcFileAdapter ncAdapter = new NcFileAdapter();
@@ -597,108 +552,6 @@ public static class ThreadsFunctions
}
}
- public static void UpdateToolsData()
- {
- NcToolTableAdapter ncAdapter = new NcToolTableAdapter();
- Stopwatch sw = new Stopwatch();
-
- if(NcConfig.NcVendor != NC_VENDOR.SIEMENS)
- {
- try
- {
- // Try connection
- CmsError libraryError = ncAdapter.Connect();
- if (libraryError.errorCode != 0)
- ManageLibraryError(libraryError);
-
- while (true)
- {
- sw.Restart();
-
- // Check if client is connected
- if (ncAdapter.numericalControl.NC_IsConnected())
- {
- // Get new data from PLC
- libraryError = ncAdapter.GetUpdatedToolsData(out Dictionary updatedStatus, out Dictionary updatedLives);
- if (libraryError.IsError())
- ManageLibraryError(libraryError);
-
- MessageServices.Current.Publish(UPDATE_TOOLS_DATA, null,
- new DTONewToolDataModel
- {
- UpdatedStatus = updatedStatus,
- UpdatedLives = updatedLives
- });
- }
- else
- RestoreConnection();
- sw.Stop();
-
- //Update thread timer
- UpdateStat(MethodBase.GetCurrentMethod().Name, sw.ElapsedMilliseconds);
-
- // Wait
- Thread.Sleep(CalcSleepTime(1000, (int)sw.ElapsedMilliseconds));
- }
- }
- catch (ThreadAbortException)
- {
- ncAdapter.Dispose();
- }
- }
- }
-
- public static void ReadNcMagazineActive()
- {
- if (NcConfig.NcVendor != NC_VENDOR.SIEMENS)
- {
- NcToolTableAdapter ncAdapter = new NcToolTableAdapter();
- Stopwatch sw = new Stopwatch();
- try
- {
- // Try connection
- CmsError libraryError = ncAdapter.Connect();
- if (libraryError.errorCode != 0)
- ManageLibraryError(libraryError);
-
- while (true)
- {
- sw.Restart();
-
- // Check if client is connected
- if (ncAdapter.numericalControl.NC_IsConnected())
- {
- // Get new data from PLC
- libraryError = ncAdapter.GetNcMagazineStatus(out Dictionary status);
- if (libraryError.IsError())
- ManageLibraryError(libraryError);
-
- MessageServices.Current.Publish(NC_MAGAZINE_IS_ACTIVE, null, status);
-
- libraryError = ncAdapter.ReadAssistedToolingProcedure(out DTOAssistedToolingEndValueModel data);
- if (libraryError.IsError())
- ManageLibraryError(libraryError);
-
- MessageServices.Current.Publish(ASSISTED_TOOLING_DATA, null, data);
- }
- else
- RestoreConnection();
- sw.Stop();
-
- //Update thread timer
- UpdateStat(MethodBase.GetCurrentMethod().Name, sw.ElapsedMilliseconds);
-
- // Wait
- Thread.Sleep(CalcSleepTime(500, (int)sw.ElapsedMilliseconds));
- }
- }
- catch (ThreadAbortException)
- {
- ncAdapter.Dispose();
- }
- }
- }
-
public static void ReadPartProgramQueueData()
{
NcFileAdapter ncAdapter = new NcFileAdapter();
@@ -1053,28 +906,12 @@ public static class ThreadsFunctions
ncAdapter.Dispose();
}
- if (cmsError.errorCode == CMS_ERROR_CODES.SIEMENS_TOOL_TABLE_ERROR)
- ManageLibraryError(cmsError);
-
// Send status to UI
MessageServices.Current.Publish(SEND_NC_STATUS, null, ncAdapter.numericalControl.NC_IsConnected());
Thread.Sleep(1000);
}
-
- if(NcConfig.NcVendor == NC_VENDOR.FANUC || NcConfig.NcVendor == NC_VENDOR.OSAI)
- {
- using (NcToolTableAdapter toolTable = new NcToolTableAdapter())
- {
- toolTable.Connect();
- // After reconecction write option
- cmsError = toolTable.SetupNcToolManager();
- if (cmsError.IsError())
- ManageLibraryError(cmsError);
- // cmsError = toolTable.RestoreTableLock();
- }
- }
if (!cmsError.IsError())
{
if (ServerStartupConfig.AutoOpenCmsClient)
@@ -1122,7 +959,6 @@ public static class ThreadsFunctions
case CMS_ERROR_CODES.SIEMENS_ENVIRONMENT_NOT_FOUND:
case CMS_ERROR_CODES.OSAI_TT_FOLDER_NOT_FOUND:
case CMS_ERROR_CODES.OPTION_NOT_CONSISTENT:
- case CMS_ERROR_CODES.SIEMENS_TOOL_TABLE_ERROR:
ManageError(ERROR_LEVEL.FATAL, cmsError.localizationKey);
break;
diff --git a/Thermo.Active.Core/ThreadsHandler.cs b/Thermo.Active.Core/ThreadsHandler.cs
index 2bea030d..490c24b5 100644
--- a/Thermo.Active.Core/ThreadsHandler.cs
+++ b/Thermo.Active.Core/ThreadsHandler.cs
@@ -18,13 +18,10 @@ namespace Thermo.Active.Core
ThreadsFunctions.ReadEnabledFunctionality,
ThreadsFunctions.ReadExpiredMaintenances,
ThreadsFunctions.ReadAxesPositionsData,
- ThreadsFunctions.ReadMagazinesStatus,
ThreadsFunctions.ReadUserSoftKeysData,
ThreadsFunctions.ReadHeadsData,
ThreadsFunctions.ReadAxesNamesData,
ThreadsFunctions.ReadActiveProgramData,
- ThreadsFunctions.UpdateToolsData,
- ThreadsFunctions.ReadNcMagazineActive,
//ThreadsFunctions.ReadPartProgramQueueData,
ThreadsFunctions.ReadScadaData,
ThreadsFunctions.ReadM154Data
diff --git a/Thermo.Active.Database/Controllers/NcToolManagerController.cs b/Thermo.Active.Database/Controllers/NcToolManagerController.cs
deleted file mode 100644
index c1816182..00000000
--- a/Thermo.Active.Database/Controllers/NcToolManagerController.cs
+++ /dev/null
@@ -1,685 +0,0 @@
-using Thermo.Active.Model.DatabaseModels;
-using Thermo.Active.Model.DTOModels.ToolModels;
-using Thermo.Active.Utils;
-using System;
-using System.Collections.Generic;
-using System.Data.Entity;
-using System.Linq;
-using static Thermo.Active.Utils.SupportFunctions;
-using static Thermo.Active.Model.Constants;
-
-namespace Thermo.Active.Database.Controllers
-{
- public class NcToolManagerController : IDisposable
- {
- public DatabaseContext dbCtx;
-
- public NcToolManagerController()
- {
- // Initialize database context
- dbCtx = new DatabaseContext();
- }
-
- public void Dispose()
- {
- // Clear database context
- dbCtx.Dispose();
- }
-
- public List FindFamilies()
- {
- List families = dbCtx
- .Families
- .Include("Tools")
- .ToList();
-
- return families;
- }
-
- public List GetFamilies()
- {
- List dbFamilies = FindFamilies();
-
- return dbFamilies
- .Select(x => (DTONcFamilyModel)x)
- .ToList();
- }
-
- public List FindFamiliesByShankId(int shankId)
- {
- DbNcShankModel shank = FindShankWithTools(shankId);
- // Get only families id
- short[] ids = shank.Tools.Select(x => x.FamilyId).ToArray();
-
- return FindFamilies() // Get Families
- .Where(x => ids.Contains(x.FamilyId)) // Filter by ids
- .ToList();
- }
-
- public DbNcToolModel FindTool(int toolId)
- {
- return dbCtx.Tools
- .Where(x => x.ToolId == toolId)
- .FirstOrDefault();
- }
-
- public DbNcToolModel FindToolWithDependencies(int toolId)
- {
- return dbCtx.Tools
- .Where(x => x.ToolId == toolId)
- .Include("Family")
- .Include("Shank")
- .FirstOrDefault();
- }
-
- public DbNcShankModel FindShankWithTools(int shankId)
- {
- return dbCtx.Shanks
- .Include("Tools")
- .Where(x => x.ShankId == shankId)
- .FirstOrDefault();
- }
-
- public DbNcFamilyModel FindFamily(int familyId)
- {
- return dbCtx
- .Families
- .Where(x => x.FamilyId == familyId)
- .Include("Tools")
- .FirstOrDefault();
- }
-
- public List FindToolsWithDependencies()
- {
- List tools = dbCtx
- .Tools
- .Include("Family")
- .Include("Shank")
- .ToList();
-
- return tools;
- }
-
- public List FindToolsByShankIdWithDependencies(int shankId)
- {
- List tools = FindToolsWithDependencies()
- .Where(x => x.ShankId == shankId)
- .ToList();
-
- return tools;
- }
-
- public List FindTools()
- {
- List tools = dbCtx
- .Tools
- .ToList();
-
- return tools;
- }
-
- public List GetTools()
- {
- List dbTools = FindToolsWithDependencies();
-
- return dbTools
- .Select(x => (DTONcToolModel)x)
- .ToList();
- }
-
- public List FindShanks()
- {
- List shanks = dbCtx
- .Shanks
- .Include("MagazinePosition")
- .ToList();
-
- return shanks;
- }
-
- public DbNcShankModel FindShank(int shankId)
- {
- return dbCtx.Shanks
- .Where(x => x.ShankId == shankId)
- .FirstOrDefault();
- }
-
- public DbNcShankModel FindShanksByPositions(int magazineId, int positionId)
- {
- DbNcShankModel shank = FindShanks()
- .Where(x => x.MagazineId == magazineId && x.PositionId == positionId)
- .FirstOrDefault();
-
- return shank;
- }
-
- public List FindShanksByFamilyId(int familyId)
- {
- return dbCtx
- .Tools
- .Include("Shank")
- .Where(x => x.FamilyId == familyId && x.ShankId != null)
- .Select(x => x.Shank)
- .ToList();
- }
-
- public DbNcShankModel FindShankByToolId(int toolId)
- {
- return dbCtx
- .Tools
- .Include("Shank")
- .Where(x => x.ToolId == toolId && x.ShankId != null)
- .Select(x => x.Shank)
- .FirstOrDefault();
- }
-
- public List GetShanks()
- {
- // Get shank from database
- List dbShanks = dbCtx
- .Shanks
- .Include("Tools")
- .ToList();
-
- // Populate dto shanks
- List dtoShanks = dbShanks
- .Select(x => (DTONcShankModel)x)
- .ToList();
-
- return dtoShanks;
- }
-
- public List GetShanksWithSpace()
- {
- // Populate nks
- List dtoShanks = GetShanks();
-
- List dtoFamilies = GetFamilies();
-
- // Calculate & set space occupied for each shank
- foreach(var shank in dtoShanks)
- {
- // Get only families id
- short[] ids = shank.ChildsTools.Select(x => x.FamilyId).ToArray();
-
- // Get Families data
- List families = dtoFamilies
- .Where(x => ids.Contains(x.Id))
- .ToList();
-
- if (families.Count() > 0)
- {
- // Find max between families
- shank.MaxRight = families.Max(x => x.RightSize);
- shank.MaxLeft = families.Max(x => x.LeftSize);
- }
- }
-
- return dtoShanks;
- }
-
- public DTONcShankModel GetShank(int shankId)
- {
- // Get shank from database
- DTONcShankModel dtoShanks = GetShanksWithSpace()
- .Where(x => x.Id == shankId)
- .FirstOrDefault();
-
- return dtoShanks;
- }
-
- public List FindMagazinesPositions()
- {
- List positions = dbCtx
- .MagazinePositions
- .ToList();
-
- return positions;
- }
-
- public List FindMagazinePositions(byte magId)
- {
- return dbCtx
- .MagazinePositions
- .Where(x => x.MagazineId == magId)
- .ToList();
- }
-
- public void GetShankMaxSpaceOccupied(int shankId, out int maxRight, out int maxLeft)
- {
- // Get families
- List families = FindFamiliesByShankId(shankId);
- // Find max
- maxRight = families.Max(x => x.RightSize);
- maxLeft = families.Max(x => x.LeftSize);
- }
-
- public List GetMagazinePositions(byte magId)
- {
- // Get only magazine positions that match with magazineId
- List magPos = FindMagazinePositions(magId).Select(x => (DTONcMagazinePositionModel)x).ToList();
- // Get&filter shanks by magazineId in order to get only mounted shanks in the current magazineId
- List shanks = dbCtx.Shanks.Where(x => x.MagazineId == magId).ToList();
-
- foreach(DbNcShankModel shank in shanks)
- {
- // Populate magazinePosition shank Id
- var pos = magPos
- .FirstOrDefault(x => x.PositionId == shank.PositionId);
-
- if(pos != null)
- pos.ShankId = shank.ShankId;
- }
- // Convert in DTOModel and return
- return magPos;
- }
-
- public DbNcMagazinePositionModel FindMagazinePosition(byte magId, byte posId)
- {
- DbNcMagazinePositionModel positions = dbCtx
- .MagazinePositions
- .FirstOrDefault(x => x.MagazineId == magId && x.PositionId == posId);
-
- return positions;
- }
-
- public List GetMountedShanks(int magazineId)
- {
- List dtoShanks = GetShanksWithSpace()
- .Where(x => x.MagazineId != null && x.MagazineId == magazineId)
- .ToList();
-
- return dtoShanks;
- }
-
- public List GetMountedTools()
- {
- List tools = FindToolsWithDependencies()
- .Where(x => x.Shank != null && x.Shank.MagazineId != null)
- .ToList();
-
- return tools;
- }
-
- public List GetAvailableShanksWithChilds()
- {
- List dtoShanks = GetShanksWithSpace()
- .Where(x => x.MagazineId == null && x.ChildsTools.Count > 0)
- .ToList();
-
- return dtoShanks;
- }
-
- public List GetAvailableTools()
- {
- List dtoTools = GetTools()
- .Where(x => x.ShankId == null || x.ShankId == 0)
- .ToList();
-
- return dtoTools;
- }
-
- public DbNcToolModel AddTool(DTONewNcToolModel dtoTool, short toolId)
- {
- // Copy data
- DbNcToolModel dbTool = (DbNcToolModel)dtoTool;
-
- if (toolId == 0)
- // Get next id
- dbTool.ToolId = GetFirstFreeId(dbCtx.Tools.Select(x => x.ToolId).ToList());
- else
- dbTool.ToolId = toolId;
-
- dbCtx.Tools.Add(dbTool);
-
- dbCtx.SaveChanges();
- // Get foreign key data
- dbCtx.Entry(dbTool).Reference(x => x.Family).Load();
- dbCtx.Entry(dbTool).Reference(x => x.Shank).Load();
-
- return dbTool;
- }
-
- public DbNcToolModel UpdateTool(int toolId, DTONewNcToolModel dtoTool)
- {
- DbNcToolModel tool = FindTool(toolId);
-
- tool.Status = ((DbNcToolModel)dtoTool).Status;
- var shankId = tool.ShankId;
-
- // Update db model
- SupportFunctions.CopyProperties(dtoTool, tool);
- tool.ShankId = shankId;
-
- // Save
- dbCtx.SaveChanges();
-
- return tool;
- }
-
- public DbNcToolModel UpdateToolOffset(int toolId, int position, short offsetId)
- {
- DbNcToolModel tool = FindTool(toolId);
-
- switch (position)
- {
- case 1:
- tool.OffsetId1 = offsetId;
- break;
- case 2:
- tool.OffsetId2 = offsetId;
- break;
- case 3:
- tool.OffsetId3 = offsetId;
- break;
- }
-
- // Save
- dbCtx.SaveChanges();
-
- return tool;
- }
-
- public void DeleteTool(int toolId)
- {
- DbNcToolModel tool = FindTool(toolId);
- if(tool != null)
- DeleteTool(tool);
- }
-
- public void DeleteTool(DbNcToolModel tool)
- {
- dbCtx.Tools.Remove(tool);
-
- dbCtx.SaveChanges();
- }
-
- public DbNcFamilyModel AddFamily(DTONcFamilyModel family)
- {
- DbNcFamilyModel dbFamily = (DbNcFamilyModel)family;
-
- // Get next free id if id is 0
- if (dbFamily.FamilyId == 0)
- dbFamily.FamilyId = GetFirstFreeId(dbCtx.Families.Select(x => x.FamilyId).ToList());
-
- dbFamily.Name = DEFAULT_FAM_NAME + dbFamily.FamilyId;
- dbCtx.Families.Add(dbFamily);
-
- dbCtx.SaveChanges();
-
- return dbFamily;
- }
-
- public DbNcFamilyModel UpdateFamily(int familyId, DTONewNcFamilyModel family)
- {
- DbNcFamilyModel dbFamily = FindFamily(familyId);
- // Copy data from NewModel to DbModel
- SupportFunctions.CopyProperties(family, dbFamily);
- // Set cooling byte
- dbFamily.CoolingByte = ((DbNcFamilyModel)family).CoolingByte;
-
- dbCtx.SaveChanges();
- // Connect tools data
- dbCtx.Entry(dbFamily).Collection(x => x.Tools).Load();
-
- return dbFamily;
- }
-
- public void DeleteFamily(int famId)
- {
- var family = FindFamily(famId);
-
- dbCtx.Families.Remove(family);
-
- dbCtx.SaveChanges();
- }
-
- public DbNcShankModel AddShank(DTONewNcShankModel shank, short shankId = 0)
- {
- DbNcShankModel dbShank = (DbNcShankModel)shank;
-
- if (shankId == 0)
- // Get next id
- dbShank.ShankId = GetFirstFreeId(dbCtx.Shanks.Select(x => x.ShankId).ToList());
- else
- dbShank.ShankId = shankId;
-
- dbCtx.Shanks.Add(dbShank);
-
- dbCtx.SaveChanges();
-
-
- return dbShank;
- }
-
- public DbNcShankModel UpdateShank(int shankId, DTONewNcShankModel dtoShank)
- {
- DbNcShankModel ncShank = FindShankWithTools(shankId);
-
- return UpdateShank(ncShank, dtoShank);
- }
-
- public DbNcShankModel UpdateShank(DbNcShankModel dbShank, DTONewNcShankModel dtoShank)
- {
- dbShank.Balluf = dtoShank.Balluf;
- dbShank.MagazinePositionType = dtoShank.MagazinePositionType;
-
- dbCtx.SaveChanges();
-
- dbCtx.Entry(dbShank).Collection(x => x.Tools).Load();
-
- return dbShank;
- }
-
- public DbNcShankModel DeleteNcShank(int shankId)
- {
- DbNcShankModel shank = FindShankWithTools(shankId);
- DeleteNcShank(shank);
-
- return shank;
- }
-
- public void DeleteNcShank(DbNcShankModel shank)
- {
- dbCtx.Shanks.Remove(shank);
-
- dbCtx.SaveChanges();
- }
-
- public DbNcMagazinePositionModel UpdatePosition(DbNcMagazinePositionModel dbPos, DTONcMagazinePositionModel dtoPos)
- {
- dbCtx.MagazinePositions.Attach(dbPos);
- dbPos.Type = dtoPos.Type;
- dbPos.Disabled = dtoPos.Disabled;
-
- dbCtx.SaveChanges();
-
- return dbPos;
- }
-
- public DbNcMagazinePositionModel LoadShankInMagazine(byte magazineId, byte positionId, DbNcShankModel shank)
- {
- dbCtx.Shanks.Attach(shank);
- // Set ids with new positions
- shank.MagazineId = magazineId;
- shank.PositionId = positionId;
-
- // Set original Ids
- shank.OriginMagazineId = magazineId;
- shank.OriginPositionId = positionId;
-
- dbCtx.SaveChanges();
-
- return FindMagazinePosition(magazineId, positionId);
- }
-
- public DbNcMagazinePositionModel UnloadShankInMagazine(byte magazineId, byte positionId, DbNcShankModel shank)
- {
- dbCtx.Shanks.Attach(shank);
- // set id to null
- shank.MagazineId = null;
- shank.PositionId = null;
-
- shank.OriginMagazineId = null;
- shank.OriginPositionId = null;
-
- dbCtx.SaveChanges();
-
- return FindMagazinePosition(magazineId, positionId);
- }
-
- public DTONcShankModel LoadToolIntoShank(DbNcToolModel tool, short shankId)
- {
- dbCtx.Tools.Attach(tool);
- // Set tool shankId
- tool.ShankId = shankId;
-
- dbCtx.SaveChanges();
-
- return GetShank(shankId);
- }
-
- public DTONcShankModel UnloadToolFromShank(DbNcToolModel tool)
- {
- dbCtx.Tools.Attach(tool);
- int? shankId = tool.ShankId;
- // Set to null shankId
- tool.ShankId = null;
-
- dbCtx.SaveChanges();
-
- return GetShank(shankId.Value);
- }
-
- public void SetupMagazinePositions(List config)
- {
- dbCtx.MagazinePositions.AddRange(config);
- dbCtx.SaveChanges();
- }
-
- public void UpdateToolsData(List tools)
- {
- foreach (var tool in tools)
- {
- DbNcToolModel tmpTool = dbCtx.Tools.Where(x => x.ToolId == tool.ToolId).FirstOrDefault();
- tmpTool = tool;
- }
-
- dbCtx.SaveChanges();
- }
-
- public DTOExportToolTableModel GetExportData()
- {
- return new DTOExportToolTableModel
- {
- Tools = FindTools(),
- Families = FindFamilies(),
- Shanks = FindShanks()
- .Select(x => {
- // Reset positional Data
- x.MagazineId = null;
- x.PositionId = null;
- x.OriginMagazineId = null;
- x.OriginPositionId = null;
-
- return x; })
- .ToList()
- };
- }
-
- public List ImportData(DTOExportToolTableModel data)
- {
- List importStatus = new List();
-
- List tools = FindTools();
- List families = FindFamilies();
- List shanks = FindShanks();
-
- if(data.Families != null)
- // loop thought new families
- foreach (var family in data.Families)
- {
- // Check if not exist
- if (families.FirstOrDefault(x => x.FamilyId == family.FamilyId) == null)
- {
- dbCtx.Families.Add(family);
- // Set status
- importStatus.Add(new DTOImportStatusModel()
- {
- Id = family.FamilyId,
- Status = IMPORT_STATUS.OK.ToString(),
- Type = "FAMILY"
- });
- }
- else
- {
- // Set duplicated status
- importStatus.Add(new DTOImportStatusModel()
- {
- Id = family.FamilyId,
- Status = IMPORT_STATUS.EXIST.ToString(),
- Type = "FAMILY"
- });
- }
- }
-
- if(data.Shanks != null)
- // loop thought new shanks
- foreach (var shank in data.Shanks)
- {
- // Check if not exist
- if (shanks.FirstOrDefault(x => x.ShankId == shank.ShankId) == null)
- {
- dbCtx.Shanks.Add(shank);
- importStatus.Add(new DTOImportStatusModel()
- {
- Id = shank.ShankId,
- Status = IMPORT_STATUS.OK.ToString(),
- Type = "SHANK"
- });
- }
- else
- {
- importStatus.Add(new DTOImportStatusModel()
- {
- Id = shank.ShankId,
- Status = IMPORT_STATUS.EXIST.ToString(),
- Type = "SHANK"
- });
- }
- }
-
- if(data.Tools != null)
- // loop thought new tools
- foreach (var tool in data.Tools)
- {
- // Check if not exist
- if (tools.FirstOrDefault(x => x.ToolId == tool.ToolId) == null)
- {
- dbCtx.Tools.Add(tool);
- importStatus.Add(new DTOImportStatusModel()
- {
- Id = tool.ToolId,
- Status = IMPORT_STATUS.EXIST.ToString(),
- Type = "TOOL"
- });
- }
- else
- {
- importStatus.Add(new DTOImportStatusModel()
- {
- Id = tool.ToolId,
- Status = IMPORT_STATUS.EXIST.ToString(),
- Type = "TOOL"
- });
- }
- }
-
- // Save
- dbCtx.SaveChanges();
-
- return importStatus;
- }
-
- }
-}
\ No newline at end of file
diff --git a/Thermo.Active.Database/DatabaseContext.cs b/Thermo.Active.Database/DatabaseContext.cs
index ca40fcc0..f2ca59d6 100644
--- a/Thermo.Active.Database/DatabaseContext.cs
+++ b/Thermo.Active.Database/DatabaseContext.cs
@@ -35,7 +35,6 @@ namespace Thermo.Active.Database
// Tool tables
public DbSet Families { get; set; }
public DbSet Shanks { get; set; }
- public DbSet Tools { get; set; }
public DbSet MagazinePositions { get; set; }
public DbSet Queue { get; set; }
// Alarms
diff --git a/Thermo.Active.Database/Migrations/Configuration.cs b/Thermo.Active.Database/Migrations/Configuration.cs
index a001cdc6..442b8348 100644
--- a/Thermo.Active.Database/Migrations/Configuration.cs
+++ b/Thermo.Active.Database/Migrations/Configuration.cs
@@ -42,7 +42,9 @@ namespace Thermo.Active.Database.Migrations
new FunctionAccessModel() { Name = HEADS_CMD, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 6},
new FunctionAccessModel() { Name = AXES_SELECTION, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 7},
- new FunctionAccessModel() { Name = TOOL_MANAGER, Area = TOOLING_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 8},
+#if false
+ new FunctionAccessModel() { Name = TOOL_MANAGER, Area = TOOLING_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 8 },
+#endif
new FunctionAccessModel() { Name = MAINTENANCE, Area = MAINTENANCE_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 9},
diff --git a/Thermo.Active.Database/Thermo.Active.Database.csproj b/Thermo.Active.Database/Thermo.Active.Database.csproj
index 8bb4ffd8..5b8a67ae 100644
--- a/Thermo.Active.Database/Thermo.Active.Database.csproj
+++ b/Thermo.Active.Database/Thermo.Active.Database.csproj
@@ -115,7 +115,6 @@
-
diff --git a/Thermo.Active.Model/ConfigModels/MagazineNamesModel.cs b/Thermo.Active.Model/ConfigModels/MagazineNamesModel.cs
deleted file mode 100644
index 2d6e6e03..00000000
--- a/Thermo.Active.Model/ConfigModels/MagazineNamesModel.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.ConfigModels
-{
- public class MagazineNamesModel
- {
- public int MagazineId { get; set; }
-
- public bool AssistedTooling { get; set; }
-
- public Dictionary LocalizedNames { get; set; }
- }
-}
diff --git a/Thermo.Active.Model/ConfigModels/ToolManagerConfigModel.cs b/Thermo.Active.Model/ConfigModels/ToolManagerConfigModel.cs
deleted file mode 100644
index 61f5e328..00000000
--- a/Thermo.Active.Model/ConfigModels/ToolManagerConfigModel.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.ConfigModels
-{
- public class ToolManagerConfigModel
- {
-
- public string ToolMetricType { get; set; }
- public bool FamilyOpt { get; set; }
- public bool ShankOpt { get; set; }
- public bool MagPosTypeOpt { get; set; }
- public bool OffsetOpt { get; set; }
- public bool ReviveOpt { get; set; }
- public bool GammaOpt { get; set; }
- public bool LifeOpt { get; set; }
- public bool TcpOpt { get; set; }
- public bool CoolingOpt { get; set; }
- public bool MultidimensionalShankOpt { get; set; }
- public bool SelfAdaptivePathOpt { get; set; }
- public bool DynamicCompensationOpt { get; set; }
- public bool BallufOpt { get; set; }
- public bool IntegrityCheckOpt { get; set; }
-
- public CooligTranslations CooligsTranslations { get; set; }
-
- public List MagazineNames { get; set; }
-
- public List ToolTypes { get; set; }
- }
-
- public class CooligTranslations
- {
- public Dictionary Cooling { get; set; }
- public Dictionary Cooling1 { get; set; }
- public Dictionary Cooling2 { get; set; }
- public Dictionary Cooling3 { get; set; }
- public Dictionary Cooling4 { get; set; }
- public Dictionary Cooling5 { get; set; }
- public Dictionary Cooling6 { get; set; }
- public Dictionary Cooling7 { get; set; }
- }
-}
diff --git a/Thermo.Active.Model/ConfigModels/ToolTypeConfigModel.cs b/Thermo.Active.Model/ConfigModels/ToolTypeConfigModel.cs
deleted file mode 100644
index 7e4d8976..00000000
--- a/Thermo.Active.Model/ConfigModels/ToolTypeConfigModel.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.ConfigModels
-{
- public class ToolTypeConfigModel
- {
- public int Id { get; set; }
-
- public bool Disabled { get; set; }
-
- public Dictionary LocalizedNames { get; set; }
- }
-}
diff --git a/Thermo.Active.Model/Constants.cs b/Thermo.Active.Model/Constants.cs
index c1dc190f..24cde93b 100644
--- a/Thermo.Active.Model/Constants.cs
+++ b/Thermo.Active.Model/Constants.cs
@@ -148,7 +148,6 @@ namespace Thermo.Active.Model
public class AREAS
{
public const string PRODUCTION_KEY = "production";
- public const string TOOLING_KEY = "tooling";
public const string REPORT_KEY = "report";
public const string ALARMS_KEY = "alarms";
public const string MAINTENANCE_KEY = "maintenance";
@@ -158,6 +157,8 @@ namespace Thermo.Active.Model
public const string UNDER_HOOD = "underHood";
public const string JOBEDITOR_KEY = "jobeditor";
public const string USERS_KEY = "users";
+ public const string THERMO_KEY = "tooling";
+ public const string RISC_KEY = "risc";
}
// Config File Names
@@ -198,9 +199,6 @@ namespace Thermo.Active.Model
public const string NC_SOFTKEYS_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "ncSoftKeyConfigValidator.xsd";
public const string NC_SOFTKEYS_CONFIG_PATH = CONFIG_DIRECTORY + "ncSoftKeyConfig.xml";
- 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 CMS_CONNECT_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "cmsConnectConfigValidator.xsd";
public const string CMS_CONNECT_CONFIG_PATH = CONFIG_DIRECTORY + "cmsConnectConfig.xml";
@@ -241,14 +239,11 @@ namespace Thermo.Active.Model
public const string SEND_NC_SOFTKEYS_DATA = "SEND_NC_SOFTKEYS_DATA";
public const string SEND_HEADS_DATA = "SEND_HEADS_DATA";
public const string SEND_AXIS_NAMES_DATA = "SEND_AXIS_NAMES_DATA";
- public const string SEND_MAGAZINES_STATUS = "SEND_MAGAZINES_STATUS";
public const string SEND_ACTIVE_PROGRAM_DATA = "SEND_ACTIVE_PROGRAM_DATA";
- public const string UPDATE_TOOLS_DATA = "UPDATE_TOOLS_DATA";
- public const string NC_MAGAZINE_IS_ACTIVE = "UPDATE_NC_MAGAZINE_STATUS";
public const string SEND_QUEUE_DATA = "SEND_QUEUE_DATA";
public const string SEND_M155_DATA = "SEND_M155_DATA";
public const string SEND_SCADA_DATA = "SEND_SCADA_DATA";
- public const string ASSISTED_TOOLING_DATA = "ASSISTED_TOOLING_DATA";
+ public const string SEND_RECIPE_STATUS = "SEND_RECIPE_STATUS";
public const string BROADCAST_DATA = "BROADCAST_DATA";
@@ -271,18 +266,16 @@ namespace Thermo.Active.Model
public const string NC_SOFTKEY = "ncSoftkeys";
public const string USER_SOFTKEY = "userSoftkeys";
public const string HEADS_CMD = "headsCmd";
- public const string TOOL_MANAGER = "toolManager";
public const string MAINTENANCE = "maintenance";
public const string AXES_SELECTION = "axesSoftkeys";
+ public const string THERMO_MANAGER = "thermoManager";
+ public const string RISC_MANAGER = "riscManager";
}
public static class API_ERROR_KEYS
{
public const string INCORRECT_PARAMETERS = "error_incorrect_parameters";
- public const string MAGAZINE_POSITION_OCCUPIED = "error_magazine_position_occupied";
- public const string TOOL_IS_MOUNTED = "error_tool_mounted";
public const string OPTION_NOT_ACTIVE = "error_option_not_active";
- public const string MAG_POS_DISABLED = "error_mag_pos_disabled";
public const string ID_ALREADY_EXIST = "error_id_already_exist";
public const string PASSWORD_IS_INVALID = "error_password_is_invalid";
public const string IMPORT_FILE_NOT_VALID = "error_import_file_not_valid";
diff --git a/Thermo.Active.Model/DTOModels/DTOHeadModel.cs b/Thermo.Active.Model/DTOModels/DTOHeadModel.cs
index 44591fc0..8ac417f3 100644
--- a/Thermo.Active.Model/DTOModels/DTOHeadModel.cs
+++ b/Thermo.Active.Model/DTOModels/DTOHeadModel.cs
@@ -57,67 +57,13 @@ namespace Thermo.Active.Model.DTOModels
}
}
- public class DTOToolInSpindleModel
- {
- // Siemens data
- public string ToolName;
- public int ChildId;
- // Fanuc-Osai
- public int FamilyId;
- public int ShankId;
-
- public bool Disabled { get; set; }
- public bool Broken { get; set; }
- public bool Measured { get; set; }
- public int ResidualLife { get; set; }
-
- public int MaxSpeed { get; set; }
- public byte MaxLoad { get; set; }
-
- public override bool Equals(object obj)
- {
- // Object is not a DTOSpindleModel
- if (!(obj is DTOToolInSpindleModel item))
- return false;
-
- // Compare the fields
- if (ToolName != item.ToolName)
- return false;
-
- if (ChildId != item.ChildId)
- return false;
-
- if (Disabled != item.Disabled)
- return false;
-
- if (Broken != item.Broken)
- return false;
-
- if (Measured != item.Measured)
- return false;
-
- if (ResidualLife != item.ResidualLife)
- return false;
-
- if (MaxSpeed != item.MaxSpeed)
- return false;
-
- if (MaxLoad != item.MaxLoad)
- return false;
-
- return true;
- }
- }
-
public class DTOSpindleModel : DTOHeadModel
{
public int ActualSpeed;
public short Load;
- public ushort MountedTool;
public bool Configured;
public ROTATION Rotation;
public bool FixedHead;
- public DTOToolInSpindleModel ToolData;
public override bool Equals(object obj)
{
@@ -132,18 +78,12 @@ namespace Thermo.Active.Model.DTOModels
if (Load != item.Load)
return false;
- if (MountedTool != item.MountedTool)
- return false;
-
if (Configured != item.Configured)
return false;
if (Rotation != item.Rotation)
return false;
- if (ToolData != null && !ToolData.Equals(item.ToolData))
- return false;
-
// Call Parent equals
return base.Equals(item);
}
diff --git a/Thermo.Active.Model/DTOModels/DTOStartupConfigurationModel.cs b/Thermo.Active.Model/DTOModels/DTOStartupConfigurationModel.cs
index e325d831..d7a2dc51 100644
--- a/Thermo.Active.Model/DTOModels/DTOStartupConfigurationModel.cs
+++ b/Thermo.Active.Model/DTOModels/DTOStartupConfigurationModel.cs
@@ -10,7 +10,6 @@ namespace Thermo.Active.Model.DTOModels
public class DTOStartupConfigurationModel
{
public AreasConfigModel ProductionConfig;
- public AreasConfigModel ToolingConfig;
public AreasConfigModel ReportConfig;
public AreasConfigModel AlarmsConfig;
public AreasConfigModel MaintenanceConfig;
diff --git a/Thermo.Active.Model/DTOModels/JobModels/DTOMetadataFieldsModel.cs b/Thermo.Active.Model/DTOModels/JobModels/DTOMetadataFieldsModel.cs
index add26fd4..d185ff58 100644
--- a/Thermo.Active.Model/DTOModels/JobModels/DTOMetadataFieldsModel.cs
+++ b/Thermo.Active.Model/DTOModels/JobModels/DTOMetadataFieldsModel.cs
@@ -7,12 +7,10 @@ namespace Thermo.Active.Model.DTOModels.JobModels
{
public string Description;
public TimeSpan ExecutionTime;
- public List Tools;
public List Customs;
public DTOMetadataFieldsModel()
{
- Tools = new List();
Customs = new List();
}
}
diff --git a/Thermo.Active.Model/DTOModels/JobModels/DTOMetadataModel.cs b/Thermo.Active.Model/DTOModels/JobModels/DTOMetadataModel.cs
index d4bcda06..37edce0e 100644
--- a/Thermo.Active.Model/DTOModels/JobModels/DTOMetadataModel.cs
+++ b/Thermo.Active.Model/DTOModels/JobModels/DTOMetadataModel.cs
@@ -5,13 +5,11 @@ namespace Thermo.Active.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/Thermo.Active.Model/DTOModels/ToolModels/DTOAssistedToolingModel.cs b/Thermo.Active.Model/DTOModels/ToolModels/DTOAssistedToolingModel.cs
deleted file mode 100644
index 60fdbeac..00000000
--- a/Thermo.Active.Model/DTOModels/ToolModels/DTOAssistedToolingModel.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using static CMS_CORE_Library.Models.DataStructures;
-
-namespace Thermo.Active.Model.DTOModels.ToolModels
-{
- public class DTOAssistedToolingModel
- {
- public ushort ToolId { get; set; }
- public ushort MagazineId { get; set; }
- public ushort PositionId { get; set; }
- public ASSISTED_TOOLING_ACTION Action { get; set; }
- }
-
- public class DTOAssistedToolingEndValueModel : AssistedToolingModel
- {
- public DTOAssistedToolingEndValueModel()
- {
-
- }
-
- public DTOAssistedToolingEndValueModel(AssistedToolingModel data)
- {
- Action = data.Action;
- IsActive = data.IsActive;
- MagazineId = data.MagazineId;
- PositionId = data.PositionId;
- ToolId = data.ToolId;
- }
-
- public override bool Equals(object obj)
- {
-
- if (!(obj is DTOAssistedToolingEndValueModel item))
- return false;
-
- if (IsActive != item.IsActive)
- return false;
-
- if (ToolId != item.ToolId)
- return false;
-
- if (MagazineId != item.MagazineId)
- return false;
-
- if (PositionId != item.PositionId)
- return false;
-
- if (Action != item.Action)
- return false;
-
- return true;
- }
-
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
- }
-}
\ No newline at end of file
diff --git a/Thermo.Active.Model/DTOModels/ToolModels/DTOEdgeModel.cs b/Thermo.Active.Model/DTOModels/ToolModels/DTOEdgeModel.cs
deleted file mode 100644
index 8c3c3e7c..00000000
--- a/Thermo.Active.Model/DTOModels/ToolModels/DTOEdgeModel.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using CMS_CORE_Library.Models;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-
-namespace Thermo.Active.Model.DTOModels.ToolModels
-{
- public class DTOEdgeModel
- {
- public double ResidualLife { get; set; }
-
- public double NominalLife { get; set; }
-
- public double PreAlmLife { get; set; }
-
- [Required]
- public Dictionary EdgeAdditionalParams { get; set; }
-
- public static explicit operator EdgeModel(DTOEdgeModel obj)
- {
- return new EdgeModel()
- {
- Id = 0,
- NominalLife = obj.NominalLife,
- ResidualLife = obj.ResidualLife,
- PreAlmLife = obj.PreAlmLife,
- EdgeAdditionalParams = obj.EdgeAdditionalParams
- };
- }
- }
-}
\ No newline at end of file
diff --git a/Thermo.Active.Model/DTOModels/ToolModels/DTOExportToolTableModel.cs b/Thermo.Active.Model/DTOModels/ToolModels/DTOExportToolTableModel.cs
deleted file mode 100644
index ac88d8a9..00000000
--- a/Thermo.Active.Model/DTOModels/ToolModels/DTOExportToolTableModel.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using Thermo.Active.Model.DatabaseModels;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.DTOModels.ToolModels
-{
- public class DTOExportToolTableModel
- {
- public List Tools { get; set; }
- public List Families { get; set; }
- public List Shanks { get; set; }
- }
-
- public class DTOImportStatusModel
- {
- public int Id { get; set; }
-
- public string Status { get; set; }
-
- public string Type { get; set; }
- }
-
- public enum IMPORT_STATUS
- {
- OK = 0,
- EXIST = 1
- }
-}
diff --git a/Thermo.Active.Model/DTOModels/ToolModels/DTOMagazineStatusModel.cs b/Thermo.Active.Model/DTOModels/ToolModels/DTOMagazineStatusModel.cs
deleted file mode 100644
index 7aebcdc9..00000000
--- a/Thermo.Active.Model/DTOModels/ToolModels/DTOMagazineStatusModel.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using CMS_CORE_Library.Models;
-using static CMS_CORE_Library.Models.DataStructures;
-
-namespace Thermo.Active.Model.DTOModels.ToolModels
-{
- public class DTOMagazineActionModel
- {
- public MAGAZINE_ACTIONS action;
- public int OriginMagazine;
- public int OriginPosition;
- public int DestinationMagazine;
- public int DestinationPosition;
- public MagazineActionToolModel Tool;
-
- public static explicit operator DTOMagazineActionModel(MagazineActionModel magazineStatus)
- {
- return new DTOMagazineActionModel()
- {
- action = magazineStatus.Action,
- OriginMagazine = magazineStatus.OriginMagazine,
- OriginPosition = magazineStatus.OriginPosition,
- DestinationMagazine = magazineStatus.DestinationMagazine,
- DestinationPosition = magazineStatus.DestinationPosition,
- Tool = magazineStatus.Tool
- };
- }
-
- public override bool Equals(object obj)
- {
-
- // Object is not a DTOMagazineStatusModel instance
- if (!(obj is DTOMagazineActionModel item))
- return false;
-
- if (item.action != action)
- return false;
-
- return true;
- }
-
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
- }
-}
diff --git a/Thermo.Active.Model/DTOModels/ToolModels/DTONcFamilyModel.cs b/Thermo.Active.Model/DTOModels/ToolModels/DTONcFamilyModel.cs
deleted file mode 100644
index 018f138f..00000000
--- a/Thermo.Active.Model/DTOModels/ToolModels/DTONcFamilyModel.cs
+++ /dev/null
@@ -1,242 +0,0 @@
-using Thermo.Active.Model.DatabaseModels;
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.DTOModels.ToolModels
-{
- public class DTONewNcFamilyModel
- {
- [Required]
- public string Name { get; set; }
-
- [Required]
- public byte ToolType { get; set; }
-
- [Required]
- public byte RightSize { get; set; }
-
- [Required]
- public byte LeftSize { get; set; }
-
- [Required]
- public byte TcpTable { get; set; }
-
- [Required]
- public byte Gamma { get; set; }
-
- [Required]
- public byte RotationType { get; set; }
-
- [Required]
- public bool Cooling { get; set; }
- [Required]
- public bool Cooling1 { get; set; }
- [Required]
- public bool Cooling2 { get; set; }
- [Required]
- public bool Cooling3 { get; set; }
- [Required]
- public bool Cooling4 { get; set; }
- [Required]
- public bool Cooling5 { get; set; }
- [Required]
- public bool Cooling6 { get; set; }
- [Required]
- public bool Cooling7 { get; set; }
-
- [Required]
- public int MaxSpeed { get; set; }
-
- [Required]
- public byte MaxLoad { get; set; }
-
- [Required]
- public byte MinLoadPctAutoload { get; set; }
-
- [Required]
- public byte MaxLoadPctAutoload { get; set; }
-
- [Required]
- public byte DynamicCompensation { get; set; }
-
- [Required]
- public byte MinLoadDynamicCompensation { get; set; }
-
- [Required]
- public byte MaxLoadDynamicCompensation { get; set; }
-
- [Required]
- public byte LifeType { get; set; }
-
- [Required]
- public int NominalLife { get; set; }
-
- [Required]
- public int ReviveDelta { get; set; }
-
- public static explicit operator DTONewNcFamilyModel(DbNcFamilyModel obj)
- {
- // Get bit values
- BitArray coolingByte = new BitArray(new byte[] { obj.CoolingByte });
- bool[] bits = new bool[8];
- coolingByte.CopyTo(bits, 0);
-
- return new DTONcFamilyModel()
- {
- Id = obj.FamilyId,
- Name = obj.Name,
- ToolType = obj.ToolType,
- RightSize = obj.RightSize,
- LeftSize = obj.LeftSize,
- TcpTable = obj.TcpTable,
- Gamma = obj.Gamma,
- RotationType = obj.RotationType,
- Cooling = bits[0],
- Cooling1 = bits[1],
- Cooling2 = bits[2],
- Cooling3 = bits[3],
- Cooling4 = bits[4],
- Cooling5 = bits[5],
- Cooling6 = bits[6],
- Cooling7 = bits[7],
- MaxSpeed = obj.MaxSpeed,
- MaxLoad = obj.MaxLoad,
- MinLoadDynamicCompensation = obj.MinLoadDynamicCompensation,
- MaxLoadDynamicCompensation = obj.MaxLoadDynamicCompensation,
- MaxLoadPctAutoload = obj.MaxLoadPctAutoload,
- MinLoadPctAutoload = obj.MinLoadPctAutoload,
- DynamicCompensation = obj.DynamicCompensation,
- LifeType = obj.LifeType,
- NominalLife = obj.NominalLife,
- ReviveDelta = obj.ReviveDelta
- };
- }
-
- public static explicit operator DbNcFamilyModel(DTONewNcFamilyModel obj)
- {
- // Prepare status byte
- bool[] result = new bool[8] { obj.Cooling, obj.Cooling1, obj.Cooling2, obj.Cooling3, obj.Cooling4, obj.Cooling5, obj.Cooling6, obj.Cooling7 };
- byte coolingByte = ConvertArrayToByte(result);
-
- return new DbNcFamilyModel()
- {
- Name = obj.Name,
- ToolType = obj.ToolType,
- RightSize = obj.RightSize,
- LeftSize = obj.LeftSize,
- TcpTable = obj.TcpTable,
- Gamma = obj.Gamma,
- RotationType = obj.RotationType,
- CoolingByte = coolingByte,
- MaxSpeed = obj.MaxSpeed,
- MaxLoad = obj.MaxLoad,
- MinLoadDynamicCompensation = obj.MinLoadDynamicCompensation,
- MaxLoadDynamicCompensation = obj.MaxLoadDynamicCompensation,
- MaxLoadPctAutoload = obj.MaxLoadPctAutoload,
- MinLoadPctAutoload = obj.MinLoadPctAutoload,
- DynamicCompensation = obj.DynamicCompensation,
- LifeType = obj.LifeType,
- NominalLife = obj.NominalLife,
- ReviveDelta = obj.ReviveDelta,
- };
- }
-
- protected static byte ConvertArrayToByte(bool[] bits)
- {
- BitArray bitField = new BitArray(bits); //BitArray takes a bool[]
- byte[] bytes = new byte[1];
- bitField.CopyTo(bytes, 0);
-
- return bytes[0];
- }
- }
-
- public class DTONcFamilyModel : DTONewNcFamilyModel
- {
- public short Id { get; set; }
-
- public List ChildTools { get; set; }
-
- public static explicit operator DTONcFamilyModel(DbNcFamilyModel obj)
- {
- List tools = new List();
-
- if (obj.Tools != null)
- foreach (DbNcToolModel tool in obj.Tools)
- {
- tools.Add((DTONcToolModel)tool);
- }
-
- // Get bit values
- BitArray coolingByte = new BitArray(new byte[] { obj.CoolingByte });
- bool[] bits = new bool[8];
- coolingByte.CopyTo(bits, 0);
-
- return new DTONcFamilyModel()
- {
- Id = obj.FamilyId,
- Name = obj.Name,
- ToolType = obj.ToolType,
- RightSize = obj.RightSize,
- LeftSize = obj.LeftSize,
- TcpTable = obj.TcpTable,
- Gamma = obj.Gamma,
- RotationType = obj.RotationType,
- Cooling = bits[0],
- Cooling1 = bits[1],
- Cooling2 = bits[2],
- Cooling3 = bits[3],
- Cooling4 = bits[4],
- Cooling5 = bits[5],
- Cooling6 = bits[6],
- Cooling7 = bits[7],
- MaxSpeed = obj.MaxSpeed,
- MaxLoad = obj.MaxLoad,
- MinLoadDynamicCompensation = obj.MinLoadDynamicCompensation,
- MaxLoadDynamicCompensation = obj.MaxLoadDynamicCompensation,
- MaxLoadPctAutoload = obj.MaxLoadPctAutoload,
- MinLoadPctAutoload = obj.MinLoadPctAutoload,
- DynamicCompensation = obj.DynamicCompensation,
- LifeType = obj.LifeType,
- NominalLife = obj.NominalLife,
- ReviveDelta = obj.ReviveDelta,
- ChildTools = tools
- };
- }
-
- public static explicit operator DbNcFamilyModel(DTONcFamilyModel obj)
- {
- // Prepare status byte
- bool[] result = new bool[8] { obj.Cooling, obj.Cooling1, obj.Cooling2, obj.Cooling3, obj.Cooling4, obj.Cooling5, obj.Cooling6, obj.Cooling7 };
- byte coolingByte = ConvertArrayToByte(result);
-
- return new DbNcFamilyModel()
- {
- FamilyId = obj.Id,
- Name = obj.Name,
- ToolType = obj.ToolType,
- RightSize = obj.RightSize,
- LeftSize = obj.LeftSize,
- TcpTable = obj.TcpTable,
- Gamma = obj.Gamma,
- RotationType = obj.RotationType,
- CoolingByte = coolingByte,
- MaxSpeed = obj.MaxSpeed,
- MaxLoad = obj.MaxLoad,
- MinLoadDynamicCompensation = obj.MinLoadDynamicCompensation,
- MaxLoadDynamicCompensation = obj.MaxLoadDynamicCompensation,
- MaxLoadPctAutoload = obj.MaxLoadPctAutoload,
- MinLoadPctAutoload = obj.MinLoadPctAutoload,
- DynamicCompensation = obj.DynamicCompensation,
- LifeType = obj.LifeType,
- NominalLife = obj.NominalLife,
- ReviveDelta = obj.ReviveDelta,
- };
- }
- }
-}
diff --git a/Thermo.Active.Model/DTOModels/ToolModels/DTONcMagazinePositionModel.cs b/Thermo.Active.Model/DTOModels/ToolModels/DTONcMagazinePositionModel.cs
deleted file mode 100644
index 50af1469..00000000
--- a/Thermo.Active.Model/DTOModels/ToolModels/DTONcMagazinePositionModel.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using Thermo.Active.Model.DatabaseModels;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.DTOModels.ToolModels
-{
- public class DTONcMagazinePositionModel
- {
- public byte MagazineId { get; set; }
-
- public int PositionId { get; set; }
-
- [Required]
- public bool Disabled { get; set; }
-
- [Required]
- public byte Type { get; set; }
-
- public int? ShankId { get; set; }
-
- public static explicit operator DTONcMagazinePositionModel(DbNcMagazinePositionModel obj)
- {
- return new DTONcMagazinePositionModel()
- {
- MagazineId = obj.MagazineId,
- PositionId = obj.PositionId,
- Disabled = obj.Disabled,
- Type = obj.Type
- };
- }
-
- public static explicit operator DbNcMagazinePositionModel(DTONcMagazinePositionModel obj)
- {
- return new DbNcMagazinePositionModel()
- {
- MagazineId = obj.MagazineId,
- PositionId = obj.PositionId,
- Disabled = obj.Disabled,
- Type = obj.Type
- };
- }
- }
-}
diff --git a/Thermo.Active.Model/DTOModels/ToolModels/DTONcMountedShankModel.cs b/Thermo.Active.Model/DTOModels/ToolModels/DTONcMountedShankModel.cs
deleted file mode 100644
index 306401d2..00000000
--- a/Thermo.Active.Model/DTOModels/ToolModels/DTONcMountedShankModel.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.DTOModels.ToolModels
-{
- public class DTONcMountedShankModel
- {
- public byte PositionId;
- public byte MagazineId;
- public int ShankId;
- }
-}
diff --git a/Thermo.Active.Model/DTOModels/ToolModels/DTONcShankModel.cs b/Thermo.Active.Model/DTOModels/ToolModels/DTONcShankModel.cs
deleted file mode 100644
index 58696241..00000000
--- a/Thermo.Active.Model/DTOModels/ToolModels/DTONcShankModel.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-using Thermo.Active.Model.DatabaseModels;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-
-namespace Thermo.Active.Model.DTOModels.ToolModels
-{
- public class DTONewNcShankModel
- {
- [Required]
- public ushort? Balluf { get; set; }
-
- [Required]
- public byte MagazinePositionType { get; set; }
-
- public static explicit operator DTONewNcShankModel(DbNcShankModel obj)
- {
- return new DTONewNcShankModel()
- {
- Balluf = (ushort)obj.Balluf,
- MagazinePositionType = obj.MagazinePositionType
- };
- }
-
- public static explicit operator DbNcShankModel(DTONewNcShankModel obj)
- {
- return new DbNcShankModel()
- {
- Balluf = obj.Balluf,
- MagazinePositionType = obj.MagazinePositionType
- };
- }
- }
-
- public class DTONcShankModel : DTONewNcShankModel
- {
- public short Id { get; set; }
-
- [Range(1, byte.MaxValue)]
- public byte? MagazineId { get; set; }
-
- [Range(1, ushort.MaxValue)]
- public int? PositionId { get; set; }
-
- [Range(1, byte.MaxValue)]
- public byte? OriginMagazineId { get; set; }
-
- [Range(1, ushort.MaxValue)]
- public int? OriginPositionId { get; set; }
-
- public int MaxLeft { get; set; }
-
- public int MaxRight { get; set; }
-
- public List ChildsTools { get; set; }
-
- public static explicit operator DTONcShankModel(DbNcShankModel obj)
- {
- List tools = new List();
-
- if (obj.Tools != null)
- foreach (DbNcToolModel tool in obj.Tools)
- {
- tools.Add((DTONcToolModel)tool);
- }
-
- return new DTONcShankModel()
- {
- Id = obj.ShankId,
- Balluf = (ushort?)obj.Balluf,
- MagazinePositionType = obj.MagazinePositionType,
- MagazineId = obj.MagazineId,
- PositionId = obj.PositionId,
- OriginMagazineId = obj.OriginMagazineId,
- OriginPositionId = obj.OriginPositionId,
- ChildsTools = tools
- };
- }
-
- public static explicit operator DbNcShankModel(DTONcShankModel obj)
- {
- return new DbNcShankModel()
- {
- ShankId = obj.Id,
- Balluf = obj.Balluf,
- MagazinePositionType = obj.MagazinePositionType,
- MagazineId = obj.MagazineId,
- PositionId = obj.PositionId,
- OriginMagazineId = obj.OriginMagazineId,
- OriginPositionId = obj.OriginPositionId,
- };
- }
- }
-}
\ No newline at end of file
diff --git a/Thermo.Active.Model/DTOModels/ToolModels/DTONcToolModel.cs b/Thermo.Active.Model/DTOModels/ToolModels/DTONcToolModel.cs
deleted file mode 100644
index b2cf2f65..00000000
--- a/Thermo.Active.Model/DTOModels/ToolModels/DTONcToolModel.cs
+++ /dev/null
@@ -1,209 +0,0 @@
-using CMS_CORE_Library.Models;
-using Thermo.Active.Model.DatabaseModels;
-using System.Collections;
-using System.ComponentModel.DataAnnotations;
-
-namespace Thermo.Active.Model.DTOModels.ToolModels
-{
-
- public class DTONcTool
- {
- [Required]
- public short OffsetLength { get; set; }
-
- [Required]
- public int ResidualLife { get; set; }
-
- [Required]
- public int ResidualRevive { get; set; }
-
- [Required]
- // Foreign keys
- public short FamilyId { get; set; }
-
- [Required]
- public bool Disabled { get; set; }
-
- [Required]
- public bool Broken { get; set; }
-
- [Required]
- public bool Measured { get; set; }
-
- [Required]
- public bool IntegrityCheck { get; set; }
-
- [Required]
- public bool ClockwiseRotation { get; set; }
-
- [Required]
- public bool CounterClockwiseRotation { get; set; }
-
- public short? ShankId { get; set; } = null;
-
- public static explicit operator DTONcTool(DbNcToolModel obj)
- {
- // Get bit values
- BitArray statusBits = new BitArray(obj.Status);
- bool[] bits = new bool[8];
- statusBits.CopyTo(bits, 0);
-
- return new DTONcTool()
- {
- FamilyId = obj.FamilyId,
- ShankId = (short)(obj.ShankId == null ? 0 : obj.ShankId.Value),
- OffsetLength = obj.OffsetLength,
- ResidualLife = obj.ResidualLife,
- ResidualRevive = obj.ResidualRevive,
- Disabled = bits[0],
- Broken = bits[1],
- Measured = bits[2],
- IntegrityCheck = bits[3],
- ClockwiseRotation = bits[4],
- CounterClockwiseRotation = bits[5],
- };
- }
-
- public static explicit operator DbNcToolModel(DTONcTool obj)
- {
- // Prepare status byte
- bool[] result = new bool[8] { obj.Disabled, obj.Broken, obj.Measured, obj.IntegrityCheck, obj.ClockwiseRotation, obj.CounterClockwiseRotation, false, false };
- byte status = ConvertArrayToByte(result);
-
- return new DbNcToolModel()
- {
- FamilyId = obj.FamilyId,
- ShankId = obj.ShankId,
- OffsetLength = obj.OffsetLength,
- ResidualLife = obj.ResidualLife,
- ResidualRevive = obj.ResidualRevive,
- Status = status
- };
- }
-
- protected static byte ConvertArrayToByte(bool[] bits)
- {
- BitArray bitField = new BitArray(bits); //BitArray takes a bool[]
- byte[] bytes = new byte[1];
- bitField.CopyTo(bytes, 0);
-
- return bytes[0];
- }
- }
-
- public class DTONcToolModel : DTONewNcToolModel
- {
- public short Id { get; set; }
-
- public OffsetModel Offset1 { get; set; }
-
- public OffsetModel Offset2 { get; set; }
-
- public OffsetModel Offset3 { get; set; }
-
-
- public static explicit operator DTONcToolModel(DbNcToolModel obj)
- {
- // Get bit values
- BitArray statusBits = new BitArray(new byte[] { obj.Status });
- bool[] bits = new bool[8];
- statusBits.CopyTo(bits, 0);
-
- return new DTONcToolModel()
- {
- Id = obj.ToolId,
- FamilyId = obj.FamilyId,
- ShankId = obj.ShankId,
- OffsetLength = obj.OffsetLength,
- ResidualLife = obj.ResidualLife,
- ResidualRevive = obj.ResidualRevive,
- Disabled = bits[0],
- Broken = bits[1],
- Measured = bits[2],
- IntegrityCheck = bits[3],
- ClockwiseRotation = bits[4],
- CounterClockwiseRotation = bits[5],
- OffsetId1 = obj.OffsetId1,
- OffsetId2 = obj.OffsetId2,
- OffsetId3 = obj.OffsetId3
- };
- }
-
- public static explicit operator DbNcToolModel(DTONcToolModel obj)
- {
- // Prepare status byte
- bool[] result = new bool[8] { obj.Disabled, obj.Broken, obj.Measured, obj.IntegrityCheck, obj.ClockwiseRotation, obj.CounterClockwiseRotation, false, false };
- byte status = ConvertArrayToByte(result);
-
- return new DbNcToolModel()
- {
- ToolId = obj.Id,
- FamilyId = obj.FamilyId,
- ShankId = obj.ShankId,
- OffsetLength = obj.OffsetLength,
- ResidualLife = obj.ResidualLife,
- ResidualRevive = obj.ResidualRevive,
- Status = status,
- OffsetId1 = obj.OffsetId1,
- OffsetId2 = obj.OffsetId2,
- OffsetId3 = obj.OffsetId3
- };
- }
- }
-
- public class DTONewNcToolModel : DTONcTool
- {
- public short? OffsetId1 { get; set; }
-
- public short? OffsetId2 { get; set; }
-
- public short? OffsetId3 { get; set; }
-
-
- public static explicit operator DTONewNcToolModel(DbNcToolModel obj)
- {
- // Get bit values
- BitArray statusBits = new BitArray(obj.Status);
- bool[] bits = new bool[8];
- statusBits.CopyTo(bits, 0);
-
- return new DTONewNcToolModel()
- {
- FamilyId = obj.FamilyId,
- ShankId = (short)(obj.ShankId == null ? 0 : obj.ShankId.Value),
- OffsetLength = obj.OffsetLength,
- ResidualLife = obj.ResidualLife,
- ResidualRevive = obj.ResidualRevive,
- Disabled = bits[0],
- Broken = bits[1],
- Measured = bits[2],
- IntegrityCheck = bits[3],
- ClockwiseRotation = bits[4],
- CounterClockwiseRotation = bits[5],
- OffsetId1 = obj.OffsetId1,
- OffsetId2 = obj.OffsetId2,
- OffsetId3 = obj.OffsetId3
- };
- }
-
- public static explicit operator DbNcToolModel(DTONewNcToolModel obj)
- {
- // Prepare status byte
- bool[] result = new bool[8] { obj.Disabled, obj.Broken, obj.Measured, obj.IntegrityCheck, obj.ClockwiseRotation, obj.CounterClockwiseRotation, false, false};
- byte status = ConvertArrayToByte(result);
-
- return new DbNcToolModel()
- {
- FamilyId = obj.FamilyId,
- ShankId = obj.ShankId,
- OffsetLength = obj.OffsetLength,
- ResidualLife = obj.ResidualLife,
- ResidualRevive = obj.ResidualRevive,
- Status = status,
- OffsetId1 = obj.OffsetId1,
- OffsetId2 = obj.OffsetId2,
- OffsetId3 = obj.OffsetId3
- };
- }
- }
-}
\ No newline at end of file
diff --git a/Thermo.Active.Model/DTOModels/ToolModels/DTONewToolDataModel.cs b/Thermo.Active.Model/DTOModels/ToolModels/DTONewToolDataModel.cs
deleted file mode 100644
index 071e997a..00000000
--- a/Thermo.Active.Model/DTOModels/ToolModels/DTONewToolDataModel.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.DTOModels.ToolModels
-{
- public class DTONewToolDataModel
- {
- public Dictionary UpdatedStatus;
- public Dictionary UpdatedLives;
- }
-}
diff --git a/Thermo.Active.Model/DTOModels/ToolModels/DTONewToolWithFamilyModel.cs b/Thermo.Active.Model/DTOModels/ToolModels/DTONewToolWithFamilyModel.cs
deleted file mode 100644
index 386facf8..00000000
--- a/Thermo.Active.Model/DTOModels/ToolModels/DTONewToolWithFamilyModel.cs
+++ /dev/null
@@ -1,138 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.DTOModels.ToolModels
-{
- // Tool with family data
-
- public class DTONewNcToolWithFamilyModel : DTONewNcToolModel
- {
- // Family fields
- public string Name { get; set; }
-
- public byte ToolType { get; set; }
-
- public byte RightSize { get; set; }
-
- public byte LeftSize { get; set; }
-
- public byte TcpTable { get; set; }
-
- public byte Gamma { get; set; }
-
- public byte RotationType { get; set; }
-
- public bool Cooling { get; set; }
-
- public bool Cooling1 { get; set; }
-
- public bool Cooling2 { get; set; }
-
- public bool Cooling3 { get; set; }
-
- public bool Cooling4 { get; set; }
-
- public bool Cooling5 { get; set; }
-
- public bool Cooling6 { get; set; }
-
- public bool Cooling7 { get; set; }
-
- public int MaxSpeed { get; set; }
-
- public byte MaxLoad { get; set; }
-
- public byte MinLoadPctAutoload { get; set; }
-
- public byte MaxLoadPctAutoload { get; set; }
-
- public byte DynamicCompensation { get; set; }
-
- public byte MinLoadDynamicCompensation { get; set; }
-
- public byte MaxLoadDynamicCompensation { get; set; }
-
- public byte LifeType { get; set; }
-
- public int NominalLife { get; set; }
-
- public int ReviveDelta { get; set; }
- }
-
-
- public class DTONcToolWithFamilyModel : DTONcToolModel
- {
- // Family fields
- [Required]
- public string Name { get; set; }
-
- [Required]
- public byte ToolType { get; set; }
-
- [Required]
- public byte RightSize { get; set; }
-
- [Required]
- public byte LeftSize { get; set; }
-
- [Required]
- public byte TcpTable { get; set; }
-
- [Required]
- public byte Gamma { get; set; }
-
- [Required]
- public byte RotationType { get; set; }
-
- [Required]
- public bool Cooling { get; set; }
- [Required]
- public bool Cooling1 { get; set; }
- [Required]
- public bool Cooling2 { get; set; }
- [Required]
- public bool Cooling3 { get; set; }
- [Required]
- public bool Cooling4 { get; set; }
- [Required]
- public bool Cooling5 { get; set; }
- [Required]
- public bool Cooling6 { get; set; }
- [Required]
- public bool Cooling7 { get; set; }
-
- [Required]
- public int MaxSpeed { get; set; }
-
- [Required]
- public byte MaxLoad { get; set; }
-
- [Required]
- public byte MinLoadPctAutoload { get; set; }
-
- [Required]
- public byte MaxLoadPctAutoload { get; set; }
-
- [Required]
- public byte DynamicCompensation { get; set; }
-
- [Required]
- public byte MinLoadDynamicCompensation { get; set; }
-
- [Required]
- public byte MaxLoadDynamicCompensation { get; set; }
-
- [Required]
- public byte LifeType { get; set; }
-
- [Required]
- public int NominalLife { get; set; }
-
- [Required]
- public int ReviveDelta { get; set; }
- }
-}
diff --git a/Thermo.Active.Model/DTOModels/ToolModels/DTOSelfAdaptiveModel.cs b/Thermo.Active.Model/DTOModels/ToolModels/DTOSelfAdaptiveModel.cs
deleted file mode 100644
index 99f94d3c..00000000
--- a/Thermo.Active.Model/DTOModels/ToolModels/DTOSelfAdaptiveModel.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using CMS_CORE_Library.Models;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-
-namespace Thermo.Active.Model.DTOModels.ToolModels
-{
- public class DTOSelfAdaptiveModel
- {
- public byte Step { get; set; }
- }
-}
\ No newline at end of file
diff --git a/Thermo.Active.Model/DTOModels/ToolModels/DTOShankModel.cs b/Thermo.Active.Model/DTOModels/ToolModels/DTOShankModel.cs
deleted file mode 100644
index 0aec9f04..00000000
--- a/Thermo.Active.Model/DTOModels/ToolModels/DTOShankModel.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-using CMS_CORE_Library.Models;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-
-namespace Thermo.Active.Model.DTOModels.ToolModels
-{
- public class DTOShankModel
- {
- public int Id;
- [Required]
- public string Name { get; set; }
- [Required]
- public bool IsEnabled { get; set; }
- [Required]
- public bool IsInhibited { get; set; }
- [Required]
- public bool InChangeTool { get; set; }
- [Required]
- public bool InFixedPlace { get; set; }
- [Required]
- public bool InUse { get; set; }
- [Required]
- public int LeftSize { get; set; }
- [Required]
- public int RightSize { get; set; }
- [Required]
- public int MagazinePositionType { get; set; }
-
- public List ChildsTools { get; set; }
-
- public static explicit operator ShankModel(DTOShankModel obj)
- {
- List childs = obj.ChildsTools?.Select(x => new ShankChildModel
- {
- Id = x.Id,
- FamilyName = x.FamilyName,
- MultitoolId = x.MultitoolId,
- ToolType = x.ToolType
- }).ToList();
-
-
- return new ShankModel()
- {
- Id = 0,
- Name = obj.Name,
- IsEnabled = obj.IsEnabled,
- IsInhibited = obj.IsInhibited,
- InChangeTool = obj.InChangeTool,
- InFixedPlace = obj.InFixedPlace,
- InUse = obj.InUse,
- LeftSize = obj.LeftSize,
- RightSize = obj.RightSize,
- MagazinePositionType = obj.MagazinePositionType,
- ChildsTools = childs
- };
- }
- }
- public class DTOShankChildModel
- {
- public int Id;
- [Required]
- public int MultitoolId;
- [Required]
- public string FamilyName;
- [Required]
- public int ToolType;
- }
-}
diff --git a/Thermo.Active.Model/DTOModels/ToolModels/DTOSiemensToolModel.cs b/Thermo.Active.Model/DTOModels/ToolModels/DTOSiemensToolModel.cs
deleted file mode 100644
index f9d1d8a2..00000000
--- a/Thermo.Active.Model/DTOModels/ToolModels/DTOSiemensToolModel.cs
+++ /dev/null
@@ -1,128 +0,0 @@
-using CMS_CORE_Library.Models;
-using System.ComponentModel.DataAnnotations;
-using static CMS_CORE_Library.Models.DataStructures;
-
-namespace Thermo.Active.Model.DTOModels.ToolModels
-{
- public class DTOSiemensToolModel
- {
- [Required]
- public string FamilyName { get; set; }
-
- [Required]
- public int MagazinePositionType { get; set; }
-
- [Required]
- public int ToolType { get; set; }
-
- public SIEMENS_LIFE_TYPE LifeType { get; set; }
-
- [Required]
- public int LeftSize { get; set; }
-
- [Required]
- public int RightSize { get; set; }
-
- [Required]
- public double MaxSpeed { get; set; }
-
- [Required]
- public double MaxAcceleration { get; set; }
-
- [Required]
- public ROTATION Rotation { get; set; }
-
- [Required]
- public bool Cooling1 { get; set; }
-
- [Required]
- public bool Cooling2 { get; set; }
-
- [Required]
- public bool IsEnabled { get; set; }
-
- [Required]
- public bool IsActive { get; set; }
-
- [Required]
- public bool InFixedPlace { get; set; }
-
- [Required]
- public bool IsInhibited { get; set; }
-
- [Required]
- public bool IsMeasured { get; set; }
-
- [Required]
- public bool InChangeTool { get; set; }
-
- [Required]
- public bool IsInUse { get; set; }
-
- [Required]
- public bool PreAlarm { get; set; }
- // Custom fields
- [Required]
- public int Load { get; set; }
-
- [Required]
- public int Gamma { get; set; }
-
- [Required]
- public int MaxLoadPctAutoload { get; set; }
-
- [Required]
- public int MinLoadPctAutoload { get; set; }
-
- [Required]
- public int ToolTypeCode { get; set; }
-
- public DTONcShankModel Shank { get; set; }
-
- public static explicit operator SiemensToolModel(DTOSiemensToolModel dtoModel)
- {
- return new SiemensToolModel()
- {
- MagazinePositionType = dtoModel.MagazinePositionType,
- ToolType = dtoModel.ToolType,
- LifeType = dtoModel.LifeType,
- FamilyName = dtoModel.FamilyName,
- MaxSpeed = dtoModel.MaxSpeed,
- //MaxAcceleration = dtoModel.MaxAcceleration,
- IsEnabled = dtoModel.IsEnabled,
- IsActive = dtoModel.IsActive,
- IsInhibited = dtoModel.IsInhibited,
- IsInUse = dtoModel.IsInUse,
- IsMeasured = dtoModel.IsMeasured,
- InChangeTool = dtoModel.InChangeTool,
- InFixedPlace = dtoModel.InFixedPlace,
- PreAlarm = dtoModel.PreAlarm,
-
- Cooling1 = dtoModel.Cooling1,
- Cooling2 = dtoModel.Cooling2,
- LeftSize = dtoModel.LeftSize,
- RightSize = dtoModel.RightSize,
- Rotation = dtoModel.Rotation,
-
- Load = dtoModel.Load,
- Gamma = dtoModel.Gamma,
- MaxLoadPctAutoload = dtoModel.MaxLoadPctAutoload,
- MinLoadPctAutoload = dtoModel.MinLoadPctAutoload,
- ToolTypeCode = dtoModel.ToolTypeCode
- };
- }
- }
-
- public class DTOMagazinesPositionsModel
- {
- [Required]
- public bool Disabled { get; set; }
- }
-
- public class DTOFamilyModel
- {
- [Required]
- public string Name { get; set; }
- }
-
-}
\ No newline at end of file
diff --git a/Thermo.Active.Model/DTOModels/ToolModels/DTOUpdateMagazineModel.cs b/Thermo.Active.Model/DTOModels/ToolModels/DTOUpdateMagazineModel.cs
deleted file mode 100644
index addd6019..00000000
--- a/Thermo.Active.Model/DTOModels/ToolModels/DTOUpdateMagazineModel.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System.ComponentModel.DataAnnotations;
-
-namespace Thermo.Active.Model.DTOModels.ToolModels
-{
- public class DTOSiemensUpdateMagazineModel
- {
- [Required]
- public int ToolId { get; set; }
- }
-
- public class DTONcUpdateMagazineModel
- {
- [Required]
- public int ShankId { get; set; }
- }
-}
\ No newline at end of file
diff --git a/Thermo.Active.Model/DatabaseModels/NcFamilyModel.cs b/Thermo.Active.Model/DatabaseModels/NcFamilyModel.cs
index 7344453b..2336f030 100644
--- a/Thermo.Active.Model/DatabaseModels/NcFamilyModel.cs
+++ b/Thermo.Active.Model/DatabaseModels/NcFamilyModel.cs
@@ -18,9 +18,6 @@ namespace Thermo.Active.Model.DatabaseModels
[Column("name")]
public string Name { get; set; }
- [Column("type")]
- public byte ToolType { get; set; }
-
[Column("right_size")]
public byte RightSize { get; set; }
@@ -69,16 +66,12 @@ namespace Thermo.Active.Model.DatabaseModels
[Column("revive_delta")]
public int ReviveDelta { get; set; }
- [JsonIgnore]
- [IgnoreDataMember]
- public List Tools { get; set; }
public static explicit operator NcFamilyModel(DbNcFamilyModel obj)
{
return new NcFamilyModel()
{
FamilyId = (ushort)obj.FamilyId,
- ToolType = obj.ToolType,
RightSize = obj.RightSize,
LeftSize = obj.LeftSize,
TcpTable = obj.TcpTable,
@@ -103,7 +96,6 @@ namespace Thermo.Active.Model.DatabaseModels
return new DbNcFamilyModel()
{
FamilyId = (short)obj.FamilyId,
- ToolType = obj.ToolType,
RightSize = obj.RightSize,
LeftSize = obj.LeftSize,
TcpTable = obj.TcpTable,
diff --git a/Thermo.Active.Model/DatabaseModels/NcShankModel.cs b/Thermo.Active.Model/DatabaseModels/NcShankModel.cs
index 36b44a60..b305dd7c 100644
--- a/Thermo.Active.Model/DatabaseModels/NcShankModel.cs
+++ b/Thermo.Active.Model/DatabaseModels/NcShankModel.cs
@@ -39,11 +39,6 @@ namespace Thermo.Active.Model.DatabaseModels
[IgnoreDataMember]
public DbNcMagazinePositionModel MagazinePosition { get; set; }
-
- [JsonIgnore]
- [IgnoreDataMember]
- public List Tools { get; set; }
-
public static explicit operator NcShankModel(DbNcShankModel obj)
{
return new NcShankModel()
diff --git a/Thermo.Active.Model/DatabaseModels/NcToolModel.cs b/Thermo.Active.Model/DatabaseModels/NcToolModel.cs
deleted file mode 100644
index 0038799a..00000000
--- a/Thermo.Active.Model/DatabaseModels/NcToolModel.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-using CMS_CORE_Library.Models;
-using Newtonsoft.Json;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Runtime.Serialization;
-
-namespace Thermo.Active.Model.DatabaseModels
-{
- [Table("tool")]
- public class DbNcToolModel
- {
- [Key]
- [DatabaseGenerated(DatabaseGeneratedOption.None)]
- [Column("id")]
- public short ToolId { get; set; }
-
- [Column("offset_length")]
- public short OffsetLength { get; set; }
-
- [Column("residual_life")]
- public int ResidualLife { get; set; }
-
- [Column("residual_revive")]
- public int ResidualRevive { get; set; }
-
- [Column("status")]
- public byte Status { get; set; }
-
- // Foreign keys
- [Column("family_id")]
- [ForeignKey("Family")]
- public short FamilyId { get; set; }
-
- [Column("shank_id")]
- [DatabaseGenerated(DatabaseGeneratedOption.None)]
-
- [ForeignKey("Shank")]
- public short? ShankId { get; set; }
-
- [Column("offsetId1")]
- public short? OffsetId1 { get; set; }
-
- [Column("offsetId2")]
- public short? OffsetId2 { get; set; }
-
- [Column("offsetId3")]
- public short? OffsetId3 { get; set; }
-
- [JsonIgnore]
- [IgnoreDataMember]
- public virtual DbNcFamilyModel Family { get; set; }
-
- [JsonIgnore]
- [IgnoreDataMember]
- public virtual DbNcShankModel Shank { get; set; }
-
- public static explicit operator NcToolModel(DbNcToolModel obj)
- {
- return new NcToolModel()
- {
- ToolId = obj.ToolId,
- FamilyId = obj.FamilyId,
- OffsetLength = obj.OffsetLength,
- ResidualLife = (ushort)obj.ResidualLife,
- Status = obj.Status,
- ResidualRevive = (ushort)obj.ResidualRevive,
- ShankId = (short)(obj.ShankId == null ? 0 : obj.ShankId.Value),
- OffsetId1 = (ushort)(obj.OffsetId1 == null ? 0 : obj.OffsetId1.Value),
- OffsetId2 = (ushort)(obj.OffsetId2 == null ? 0 : obj.OffsetId2.Value),
- OffsetId3 = (ushort)(obj.OffsetId3 == null ? 0 : obj.OffsetId3.Value)
- };
- }
-
- public static explicit operator DbNcToolModel(NcToolModel obj)
- {
- return new DbNcToolModel()
- {
- ToolId = obj.ToolId,
- FamilyId = obj.FamilyId,
- OffsetLength = obj.OffsetLength,
- ResidualLife = (ushort)obj.ResidualLife,
- Status = obj.Status,
- ResidualRevive = (ushort)obj.ResidualRevive,
- ShankId = obj.ShankId == 0 ? null : (short?)obj.ShankId,
- OffsetId1 = obj.OffsetId1 == 0 ? null : (short?)obj.OffsetId1,
- OffsetId2 = obj.OffsetId2 == 0 ? null : (short?)obj.OffsetId2,
- OffsetId3 = obj.OffsetId3 == 0 ? null : (short?)obj.OffsetId3
- };
- }
- }
-}
\ No newline at end of file
diff --git a/Thermo.Active.Model/Thermo.Active.Model.csproj b/Thermo.Active.Model/Thermo.Active.Model.csproj
index b5572c5c..8f58bf38 100644
--- a/Thermo.Active.Model/Thermo.Active.Model.csproj
+++ b/Thermo.Active.Model/Thermo.Active.Model.csproj
@@ -67,15 +67,12 @@
-
-
-
@@ -93,7 +90,6 @@
-
@@ -120,10 +116,6 @@
-
-
-
-
@@ -144,17 +136,6 @@
-
-
-
-
-
-
-
-
-
-
-
DtsGenerator
diff --git a/Thermo.Active.NC/NcAdapter.cs b/Thermo.Active.NC/NcAdapter.cs
index b0654fa0..474b973e 100644
--- a/Thermo.Active.NC/NcAdapter.cs
+++ b/Thermo.Active.NC/NcAdapter.cs
@@ -870,53 +870,18 @@ namespace Thermo.Active.NC
OverrideEditable = head.OverrideEditable,
ActualSpeed = head.ActualSpeed_Pressure,
Load = head.Load_Abrasive,
- MountedTool = (ushort)head.MountedTool_Vacum,
Override = head.Override,
IsActive = head.IsActive,
IsSelected = head.IsSelected,
AbrasiveIsActive = head.AbrasiveIsActive,
Configured = head.Configured,
Rotation = head.Rotation,
- WorkedTime = head.WorkedTime,
- ToolData = head.Tool == null ? null : new DTOToolInSpindleModel()
- {
- ChildId = head.Tool.ChildId,
- ToolName = head.Tool.ToolName,
- Disabled = head.Tool.Disabled,
- Measured = head.Tool.Measured,
- Broken = head.Tool.Broken,
- MaxSpeed = (int)head.Tool.MaxSpeed,
- MaxLoad = (byte)head.Tool.MaxLoad,
- ResidualLife = (int)head.Tool.ResidualLife
- }
- });
- }
- break;
-
- case HEAD_TYPE.AWJ:
- {
- float vacumValue = (float)head.MountedTool_Vacum / 100;
- heads.Add(new DTOAbrasiveWaterJet()
- {
- Id = head.Id,
- Process = head.Process,
- Type = configuredHead.Type.ToString(),
- FixedHead = configuredHead.FixedHead,
- inWarning = vacumValue >= configuredHead.WarningLimit,
- inAlarm = vacumValue >= configuredHead.AlarmLimit,
- OverrideEditable = head.OverrideEditable,
- ActualPressure = head.ActualSpeed_Pressure,
- Abrasive = Convert.ToUInt16(head.Load_Abrasive),
- Vacum = vacumValue,
- Override = head.Override,
- IsActive = head.IsActive,
- IsSelected = head.IsSelected,
- AbrasiveIsActive = head.AbrasiveIsActive,
WorkedTime = head.WorkedTime
});
}
break;
+
case HEAD_TYPE.WJ:
{
heads.Add(new DTOWaterJet()
diff --git a/Thermo.Active.NC/NcToolTableAdapter.cs b/Thermo.Active.NC/NcToolTableAdapter.cs
deleted file mode 100644
index 763b81bb..00000000
--- a/Thermo.Active.NC/NcToolTableAdapter.cs
+++ /dev/null
@@ -1,911 +0,0 @@
-using CMS_CORE_Library.Models;
-using Thermo.Active.Database.Controllers;
-using Thermo.Active.Model.DatabaseModels;
-using Thermo.Active.Model.DTOModels.ToolModels;
-using Thermo.Active.Utils;
-using System.Collections.Generic;
-using System.Data.Entity;
-using System.Linq;
-using static CMS_CORE_Library.Models.DataStructures;
-using static Thermo.Active.Config.ServerConfig;
-using static Thermo.Active.Model.Constants;
-
-namespace Thermo.Active.NC
-{
- public class NcToolTableAdapter : NcAdapter
- {
- public CmsError GetToolsData(out List dtoTools)
- {
- dtoTools = new List();
-
- CmsError cmsError = NO_ERROR;
-
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- List tools = toolsManager.FindToolsWithDependencies();
-
- foreach (DbNcToolModel tool in tools)
- {
- DTONcToolModel dtoTool = (DTONcToolModel)tool;
-
- cmsError = GetToolData(tool, ref dtoTool);
-
- dtoTools.Add(dtoTool);
- }
-
- return cmsError;
- }
- }
-
- public CmsError GetToolData(DbNcToolModel tool, ref DTONcToolModel dtoTool)
- {
- dtoTool = (DTONcToolModel)tool;
-
- OffsetModel offset = new OffsetModel();
- CmsError cmsError = NO_ERROR;
-
- if (tool.OffsetId1 != null && tool.OffsetId1 != 0)
- {
- // Read first offset data
- cmsError = numericalControl.TOOLS_ROffset((short)tool.OffsetId1, ref offset);
- if (cmsError.IsError())
- return cmsError;
-
- dtoTool.Offset1 = offset;
- }
- if (tool.OffsetId2 != null && tool.OffsetId2 != 0)
- {
- // Read second offset data
- cmsError = numericalControl.TOOLS_ROffset((short)tool.OffsetId2, ref offset);
- if (cmsError.IsError())
- return cmsError;
-
- dtoTool.Offset2 = offset;
- }
- if (tool.OffsetId3 != null && tool.OffsetId3 != 0)
- {
- // Read third offset data
- cmsError = numericalControl.TOOLS_ROffset((short)tool.OffsetId3, ref offset);
- if (cmsError.IsError())
- return cmsError;
-
- dtoTool.Offset3 = offset;
- }
-
- return cmsError;
- }
-
- public CmsError AddTool(DTONewNcToolModel tool, out DTONcToolModel dtoTool, short toolId)
- {
- dtoTool = new DTONcToolModel();
-
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- DbNcToolModel ncTool = toolsManager.AddTool(tool, toolId);
-
- if (!ToolManagerConfig.OffsetOpt)
- {
- CmsError cmsError = UpdateToolOffsetId(ncTool.ToolId, 1, ncTool.ToolId, out DTONcToolModel toolWithOffset);
- if (cmsError.IsError())
- return cmsError;
-
- ncTool.OffsetId1 = ncTool.ToolId;
- }
-
- GetToolData(ncTool, ref dtoTool);
-
- return NO_ERROR;
- }
- }
-
- public CmsError UpdateTool(int toolId, DTONewNcToolModel newTool, out DTONcToolModel toolWithOffsets, DTONewNcToolWithFamilyModel dtoToolWithFamily)
- {
- toolWithOffsets = new DTONcToolModel();
- CmsError cmsError = NO_ERROR;
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- using (var dbContextTransaction = toolsManager.dbCtx.Database.BeginTransaction())
- {
- // If family option is not active, update family data
- if (!ToolManagerConfig.FamilyOpt)
- {
- // Copy only family
- DTONewNcFamilyModel newFamily = new DTONewNcFamilyModel();
- SupportFunctions.CopyProperties(dtoToolWithFamily, newFamily);
- // Update only family data
- newFamily = (DTONcFamilyModel)toolsManager.UpdateFamily(dtoToolWithFamily.FamilyId, newFamily);
- }
-
- // Update database tool Tool
- DbNcToolModel dbTool = toolsManager.UpdateTool(toolId, newTool);
-
- // Populate updated tool with offset data
- cmsError = GetToolData(dbTool, ref toolWithOffsets);
- if (cmsError.IsError())
- {
- dbContextTransaction.Rollback();
- return cmsError;
- }
-
- bool startIsActive = false;
-
- // Check if tool is loaded into a shank
- if (dbTool.ShankId != null)
- {
- // Check if shank is loaded into magazine
- DbNcShankModel shank = toolsManager.FindShankWithTools(dbTool.ShankId.Value);
- if (shank.MagazineId != null)
- {
- startIsActive = true;
- // Create backup of data stored on the NC and block memory/files accesses
- cmsError = numericalControl.TOOLS_WStartEditData();
- if (cmsError.IsError())
- {
- ManageErrorAndTransaction(cmsError, dbContextTransaction, startIsActive);
- return cmsError;
- }
-
- // If family option is not active, update NC data
- //if (!ToolManagerConfig.FamilyOpt)
- //{
- // Update Nc families
- cmsError = UpdateNcFamily(toolsManager);
- if (cmsError.IsError())
- ManageErrorAndTransaction(cmsError, dbContextTransaction, true);
- //}
-
- // Update tool
- cmsError = UpdateNcTools(toolsManager);
- }
- }
-
- ManageErrorAndTransaction(cmsError, dbContextTransaction, startIsActive);
-
- return NO_ERROR;
- }
- }
- }
-
- public CmsError UpdateNcTools(NcToolManagerController toolsManager = null)
- {
- if (toolsManager == null)
- toolsManager = new NcToolManagerController();
-
- List shanks = toolsManager
- .FindShanks()
- .Where(x => x.MagazineId != null)
- .Select(x => (NcShankModel)x)
- .ToList();
-
- // Get tools
- List tools = toolsManager
- .FindTools()
- .Select(x => (NcToolModel)x)
- .Where(x => shanks.Any(y => y.ShankId == x.ShankId)) // Find only mounted tools
- .ToList();
-
- // Update tools
- return numericalControl.TOOLS_WUpdateTools(tools);
- }
-
- public CmsError UpdateOffset(short offsetId, OffsetModel offsetData)
- {
- return numericalControl.TOOLS_WOffset(offsetId, ref offsetData);
- }
-
- public CmsError UpdateToolOffsetId(int toolId, int positionId, short offsetId, out DTONcToolModel toolWithOffsets)
- {
- toolWithOffsets = new DTONcToolModel();
-
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- using (var dbContextTransaction = toolsManager.dbCtx.Database.BeginTransaction())
- {
- // Update database tool Tool
- DbNcToolModel dbTool = toolsManager.UpdateToolOffset(toolId, positionId, offsetId);
-
- // Populate updated tool with offset data
- CmsError cmsError = GetToolData(dbTool, ref toolWithOffsets);
- if (cmsError.IsError())
- {
- dbContextTransaction.Rollback();
- return cmsError;
- }
-
- bool startIsActive = false;
-
- // Check if tool is loaded into a shank
- if (dbTool.ShankId != null)
- {
- // Check if shank is loaded into magazine
- DbNcShankModel shank = toolsManager.FindShankWithTools(dbTool.ShankId.Value);
- if (shank.MagazineId != null)
- {
- startIsActive = true;
- // Create backup of data stored on the NC and block file accesses
- cmsError = numericalControl.TOOLS_WStartEditData();
- if (cmsError.IsError())
- {
- ManageErrorAndTransaction(cmsError, dbContextTransaction, startIsActive);
- return cmsError;
- }
-
- // R tool
- cmsError = UpdateNcTools(toolsManager);
- }
- }
-
- ManageErrorAndTransaction(cmsError, dbContextTransaction, startIsActive);
-
- return NO_ERROR;
- }
- }
- }
-
- public CmsError DeleteNcTool(DbNcToolModel tool)
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- using (var dbContextTransaction = toolsManager.dbCtx.Database.BeginTransaction())
- {
- if (!ToolManagerConfig.FamilyOpt)
- {
- DbNcFamilyModel fam = toolsManager.FindFamily(tool.FamilyId);
- // Check if family is connected to other tools
- if (fam != null && fam.Tools.Count() == 1)
- {
- toolsManager.DeleteFamily(fam.FamilyId);
- }
- }
-
- DbNcShankModel shank = null;
- if (!ToolManagerConfig.ShankOpt && tool.ShankId != null)
- {
- // If option is active find & delete tool shank
- shank = toolsManager.FindShankWithTools(tool.ShankId.Value);
-
- toolsManager.DeleteNcShank(shank.ShankId);
- }
-
- // Delete db tool
- toolsManager.DeleteTool(tool.ToolId);
-
- bool startIsActive = false;
- CmsError cmsError = NO_ERROR;
-
- if (tool.ShankId != null && shank != null)
- {
- if (shank.MagazineId != null)
- {
- startIsActive = true;
- // Create backup of data stored on the NC and block file accesses
- cmsError = numericalControl.TOOLS_WStartEditData();
- if (cmsError.IsError())
- {
- ManageErrorAndTransaction(cmsError, dbContextTransaction, startIsActive);
- return cmsError;
- }
-
- // Update Nc data
- cmsError = UpdateNcTools(toolsManager);
- }
- }
-
- ManageErrorAndTransaction(cmsError, dbContextTransaction, startIsActive);
-
- return cmsError;
- }
- }
- }
-
- public CmsError UpdateShank(int shankId, DTONewNcShankModel dtoShank, out DTONcShankModel shank)
- {
- shank = new DTONcShankModel();
-
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- using (var dbContextTransaction = toolsManager.dbCtx.Database.BeginTransaction())
- {
- bool startIsActive = false;
- CmsError cmsError = NO_ERROR;
-
- // Update db data
- shank = (DTONcShankModel)toolsManager.UpdateShank(shankId, dtoShank);
- if (shank.MagazineId != null)
- {
- startIsActive = true;
- // Create backup of data stored on the NC and block file accesses
- cmsError = numericalControl.TOOLS_WStartEditData();
- if (cmsError.IsError())
- {
- ManageErrorAndTransaction(cmsError, dbContextTransaction, startIsActive);
- return cmsError;
- }
-
- // Update nc data
- cmsError = UpdateNcShanks(toolsManager);
- }
-
- ManageErrorAndTransaction(cmsError, dbContextTransaction, startIsActive);
-
- return cmsError;
- }
- }
- }
-
- public CmsError DeleteNcShank(int shankId)
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- CmsError cmsError = NO_ERROR;
- using (var dbContextTransaction = toolsManager.dbCtx.Database.BeginTransaction())
- {
- // Delete database shank
- DbNcShankModel deletedShank = toolsManager.DeleteNcShank(shankId);
- bool startIsActive = false;
- if (deletedShank.MagazineId != null)
- {
- startIsActive = true;
- // Create backup of data stored on the NC and block file accesses
- cmsError = numericalControl.TOOLS_WStartEditData();
- if (cmsError.IsError())
- {
- ManageErrorAndTransaction(cmsError, dbContextTransaction, startIsActive);
- return cmsError;
- }
-
- // Update nc data
- cmsError = UpdateNcShanks(toolsManager);
- }
-
- ManageErrorAndTransaction(cmsError, dbContextTransaction, startIsActive);
-
- return cmsError;
- }
- }
- }
-
- private CmsError UpdateNcShanks(NcToolManagerController toolsManager)
- {
- // Get mounted shanks
- List shanks = toolsManager
- .FindShanks()
- .Where(x => x.MagazineId != null)
- .Select(x => (NcShankModel)x)
- .ToList();
-
- // Update nc data
- return numericalControl.TOOLS_WUpdateShanks(shanks);
- }
-
- public DTONcFamilyModel AddFamily(DTONcFamilyModel family)
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- return (DTONcFamilyModel)toolsManager.AddFamily(family);
- }
- }
-
- public CmsError UpdateFamily(int familyId, DTONewNcFamilyModel family, out DTONcFamilyModel newFamily)
- {
- newFamily = new DTONcFamilyModel();
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- using (var dbContextTransaction = toolsManager.dbCtx.Database.BeginTransaction())
- {
- // Update db family
- newFamily = (DTONcFamilyModel)toolsManager.UpdateFamily(familyId, family);
-
- // Create backup of data stored on the NC and block file accesses
- CmsError cmsError = numericalControl.TOOLS_WStartEditData();
- if (cmsError.IsError())
- {
- ManageErrorAndTransaction(cmsError, dbContextTransaction, true);
- return cmsError;
- }
-
- // Update Nc families
- cmsError = UpdateNcFamily(toolsManager);
-
- ManageErrorAndTransaction(cmsError, dbContextTransaction, true);
-
- return cmsError;
- }
- }
- }
-
- public CmsError DeleteNcFamily(int famId)
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- using (var dbContextTransaction = toolsManager.dbCtx.Database.BeginTransaction())
- {
- // Create backup of data stored on the NC and block file accesses
- CmsError cmsError = numericalControl.TOOLS_WStartEditData();
- if (cmsError.IsError())
- return cmsError;
-
- // Check if shank opt is disabled
- if (!ToolManagerConfig.ShankOpt)
- {
- // If the relationship is 1:1 (tool:shank) i have to remove shanks manually
- // Tools are deleted thanks to foreign keys constraint
- List shanks = toolsManager.FindShanksByFamilyId(famId);
- foreach (var shank in shanks)
- {
- if (shank != null)
- toolsManager.DeleteNcShank(shank.ShankId);
- }
- }
-
- toolsManager.DeleteFamily(famId);
-
- // Update Nc families
- cmsError = UpdateNcFamily(toolsManager);
-
- ManageErrorAndTransaction(cmsError, dbContextTransaction, true);
-
- return cmsError;
- }
- }
- }
-
- private CmsError UpdateNcFamily(NcToolManagerController toolsManager)
- {
- // Get mounted shanks
- List shanks = toolsManager
- .FindShanks()
- .Where(x => x.MagazineId != null)
- .Select(x => (NcShankModel)x)
- .ToList();
-
- // Get tools
- List tools = toolsManager
- .FindTools()
- .Select(x => (NcToolModel)x)
- .Where(x => shanks.Any(y => y.ShankId == x.ShankId)) // Find only mounted tools
- .ToList();
-
- List families = toolsManager
- .FindFamilies()
- .Select(x => (NcFamilyModel)x)
- .Where(x => tools.Any(y => y.FamilyId == x.FamilyId)) // Find only families of mounted tools
- .ToList();
-
- // Update nc families
- return numericalControl.TOOLS_WUpdateFamilies(families);
- }
-
- public CmsError UpdateMagazinePosition(DbNcMagazinePositionModel dbPos, DTONcMagazinePositionModel dtoPos, out DTONcMagazinePositionModel magPos)
- {
- magPos = new DTONcMagazinePositionModel();
-
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- using (DbContextTransaction dbContextTransaction = toolsManager.dbCtx.Database.BeginTransaction())
- {
- // Create backup of data stored on the NC and block file accesses
- CmsError cmsError = StartEditData();
- if (cmsError.IsError())
- {
- ManageErrorAndTransaction(cmsError, dbContextTransaction, true);
- return cmsError;
- }
-
- // Update database data
- magPos = (DTONcMagazinePositionModel)toolsManager.UpdatePosition(dbPos, dtoPos);
-
- // Get magazines positions
- List positions = toolsManager.FindMagazinesPositions()
- .Select(x => (NcMagazinePositionModel)x)
- .ToList();
- // Update Nc data
- cmsError = numericalControl.TOOLS_WUpdateMagazinePositions(positions);
-
- ManageErrorAndTransaction(cmsError, dbContextTransaction, true);
-
- return cmsError;
- }
- }
- }
-
- private void ManageErrorAndTransaction(CmsError cmsError, DbContextTransaction dbContextTransaction, bool ncStartIsActive)
- {
- // Check cmsError, manage transaction and if startIsActive = true manage Nc backup created with TOOLS_WStartEditData()
- if (cmsError.IsError())
- {
- // Close transaction
- dbContextTransaction.Rollback();
- // Restore backup
- if (ncStartIsActive)
- numericalControl.TOOLS_WRestoreBackup();
- }
- else
- {
- // Close transaction
- dbContextTransaction.Commit();
- // Stop editing ncData
- if (ncStartIsActive)
- numericalControl.TOOLS_WStopEditData();
- }
- }
-
- public DTONcShankModel LoadIntoShank(DbNcToolModel tool, short shankId)
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- return toolsManager.LoadToolIntoShank(tool, shankId);
- }
- }
-
- public DTONcShankModel UnloadFromShank(DbNcToolModel tool)
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- return toolsManager.UnloadToolFromShank(tool);
- }
- }
-
- public CmsError SetupNcToolManager()
- {
- CmsError cmsError = UpdateMagazinePositionConf(out bool newDb);
- if (cmsError.IsError())
- return cmsError;
-
- cmsError = WriteOption();
- if (cmsError.IsError())
- return cmsError;
-
- using (NcToolManagerController toolManager = new NcToolManagerController())
- {
- // If database was empty read data from NC and update database
- if (newDb)
- {
- List tools = new List();
- List families = new List();
- List shanks = new List();
-
- // Read data from Nc memory
- cmsError = numericalControl.TOOLS_RStoredData(ref tools, ref families, ref shanks);
- if (cmsError.IsError())
- return cmsError;
-
- // Check if there are data
- if (tools.Count() > 0 || families.Count() > 0 || shanks.Count() > 0)
- {
- // Populate import object
- DTOExportToolTableModel exp = new DTOExportToolTableModel()
- {
- Tools = tools.Select(x => (DbNcToolModel)x).ToList(),
- Families = families.Select(x =>
- {
- var fam = (DbNcFamilyModel)x;
- fam.Name = "Fam" + fam.FamilyId.ToString();
- return fam;
- }).ToList(),
- Shanks = shanks.Select(x => (DbNcShankModel)x).ToList()
- };
-
- // Import
- toolManager.ImportData(exp);
- }
- }
-
- List databaseTool = toolManager.GetTools();
- bool exist = false;
- if (databaseTool != null && databaseTool.Count() > 0)
- // Check options consistency with database data
- exist = databaseTool.Exists(x =>
- (!ToolManagerConfig.FamilyOpt && x.FamilyId != x.Id) || // Check family
- (!ToolManagerConfig.ShankOpt && x.ShankId != x.Id) || // Check shanks
- (!ToolManagerConfig.OffsetOpt && x.OffsetId1 != x.Id && x.OffsetId2 != null && x.OffsetId3 != null) // Check offsets
- );
-
- if (exist)
- return OPTION_NOT_CONSISTENT_ERROR;
-
- // Check if there are blocked magazines, and release them
- cmsError = RestoreTableLock();
- if (cmsError.IsError())
- return cmsError;
-
- }
-
- return NO_ERROR;
- }
-
- public CmsError UpdateMagazinePositionConf(out bool newDb)
- {
- newDb = false;
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- // Get database configured positions
- List dbPositions = toolsManager.FindMagazinesPositions();
- if (dbPositions.Count <= 0)
- {
- // THe software is using a new database
- newDb = true;
-
- CmsError cmsError = GetMagazineConfiguration(out List config);
- if (cmsError.IsError())
- return cmsError;
-
- // Setup new positions list in order to be saved in the database
- List fromConfigPosition = new List();
- foreach (var conf in config)
- {
- for (byte i = 1; i <= conf.MaxPositions; i++)
- {
- // Create new position
- fromConfigPosition.Add(new DbNcMagazinePositionModel()
- {
- MagazineId = conf.Id,
- PositionId = i,
- Disabled = false,
- Type = 0
- });
- }
- }
-
- // Update database
- toolsManager.SetupMagazinePositions(fromConfigPosition);
-
- return cmsError;
- }
-
- return NO_ERROR;
- }
- }
-
- public CmsError WriteOption()
- {
- ToolManagerOptionsModel options = new ToolManagerOptionsModel();
- SupportFunctions.CopyProperties(ToolManagerConfig, options);
-
- return numericalControl.TOOLS_WOptions(options);
- }
-
- public CmsError GetMagazineConfiguration(out List config)
- {
- config = new List();
- // Read configuration
- return numericalControl.TOOLS_RMagazineConfig(ref config);
- }
-
- public CmsError StartEditData()
- {
- return numericalControl.TOOLS_WStartEditData();
- }
-
- public CmsError StopEditData()
- {
- return numericalControl.TOOLS_WStopEditData();
- }
-
- public CmsError StartEditTooling(int magazineId)
- {
- return numericalControl.TOOLS_WStartEditTooling(magazineId);
- }
-
- public CmsError StopEditTooling(int magazineId)
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- // Get mounted shanks
- List shanks = toolsManager
- .FindShanks()
- .Where(x => x.MagazineId != null)
- .Select(x => (NcShankModel)x)
- .ToList();
- // Update shanks
- CmsError cmsError = numericalControl.TOOLS_WUpdateShanks(shanks);
- if (cmsError.IsError())
- return cmsError;
-
- // Get magazine positions
- List positions = toolsManager.FindMagazinesPositions()
- .Select(x => (NcMagazinePositionModel)x)
- .ToList();
- // Update positions
- cmsError = numericalControl.TOOLS_WUpdateMagazinePositions(positions);
- if (cmsError.IsError())
- return cmsError;
-
- // Get tools
- List tools = toolsManager
- .FindTools()
- .Select(x => (NcToolModel)x)
- .Where(x => shanks.Any(y => y.ShankId == x.ShankId)) // Find only mounted tools
- .ToList();
-
- // Update tools
- cmsError = numericalControl.TOOLS_WUpdateTools(tools);
- if (cmsError.IsError())
- return cmsError;
-
- // Get families
- List families = toolsManager
- .FindFamilies()
- .Select(x => (NcFamilyModel)x)
- .Where(x => tools.Any(y => y.FamilyId == x.FamilyId)) // Find only families of mounted tools
- .ToList();
-
- // Update families
- cmsError = numericalControl.TOOLS_WUpdateFamilies(families);
- if (cmsError.IsError())
- return cmsError;
- }
-
- return numericalControl.TOOLS_WStopEditTooling(magazineId);
- }
-
- public CmsError GetUpdatedToolsData(out Dictionary updatedStatus, out Dictionary updatedLives)
- {
- updatedStatus = new Dictionary();
- updatedLives = new Dictionary();
- return numericalControl.TOOLS_RUpdatedToolsData(ref updatedStatus, ref updatedLives);
- }
-
- public CmsError CheckIfShankCanFit(int magazineId, int positionId, DbNcShankModel shankToBeLoaded)
- {
- CmsError cmsError = GetMagazineConfiguration(out List magazinesConfig);
- if (cmsError.IsError())
- return cmsError;
-
- NcMagazineConfigModel magConfig = magazinesConfig.FirstOrDefault(x => x.Id == magazineId);// Get only current magazine config
- if (magConfig == null)
- return INCORRECT_PARAMETERS_ERROR;
-
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- List magazineMountedTools = toolsManager.GetMountedTools();
-
- // Check if there is a tool already mounted the selected position (magazineId, positionId)
- var toolAlreadyMounted = magazineMountedTools.FirstOrDefault(x => x.Shank.MagazineId == magazineId && x.Shank.PositionId == positionId);
- if (toolAlreadyMounted != null)
- return MAGAZINE_POSITION_OCCUPIED_ERROR;
-
- // Get shank occupied space
- toolsManager.GetShankMaxSpaceOccupied(shankToBeLoaded.ShankId, out int maxRight, out int maxLeft);
-
- // Check if tool can fit in the position considering other tools
- foreach (var mountedTool in magazineMountedTools)
- {
- // Check if is not the same position && if is different check if the position is on the same magazine
- if (mountedTool.Shank.PositionId != positionId && mountedTool.Shank.MagazineId == magazineId)
- {
- int decPosition, incPosition;
- decPosition = incPosition = mountedTool.Shank.PositionId.Value;
- // if it is a circular magazine move position before ( for left case ) or after ( right case ) the location you want to mount the tool
- if (magConfig.Type != NC_MAGAZINE_TYPE.BOX_MAGAZINE)
- {
- decPosition = decPosition < positionId ? decPosition + magConfig.MaxPositions : decPosition;
- incPosition = incPosition > positionId ? incPosition - magConfig.MaxPositions : incPosition;
- }
-
- // Right check
- if (positionId < decPosition)
- {
- if (!(magConfig.Type == NC_MAGAZINE_TYPE.BOX_MAGAZINE && mountedTool.Shank.PositionId == 1))
- {
- // Calculate left space occupied (with mounted shank)
- double leftMounted = decPosition - (mountedTool.Family.LeftSize / 2.0);
- // Calculate right space needed (with shank to be loaded)
- double rightToBeMount = positionId + (maxRight / 2.0);
- if (leftMounted < rightToBeMount)
- return MAGAZINE_POSITION_OCCUPIED_ERROR;
- }
- }
-
- // Left check
- if (positionId > incPosition)
- {
- if (!(magConfig.Type == NC_MAGAZINE_TYPE.BOX_MAGAZINE && mountedTool.Shank.PositionId == magConfig.MaxPositions))
- {
- // Calculate right space occupied (with mounted shank)
- double rightMounted = incPosition + (mountedTool.Family.RightSize / 2.0);
- // Calculate left space needed (with shank to be loaded)
- double leftToBeMounted = positionId - (maxLeft / 2.0);
- if (rightMounted > leftToBeMounted)
- return MAGAZINE_POSITION_OCCUPIED_ERROR;
- }
- }
- }
- }
- }
-
- return NO_ERROR;
- }
-
- public CmsError GetNcMagazineStatus(out Dictionary status)
- {
- status = new Dictionary();
- return numericalControl.TOOLS_RMagazineStatus(ref status);
- }
-
- public CmsError StartAssistedToolingProcedure(ushort toolId, ushort familyId, ushort shankId, ushort magazineId, ushort positionId, ASSISTED_TOOLING_ACTION action)
- {
- return numericalControl.PLC_WAssistedToolingCmd(toolId, familyId, shankId, magazineId, positionId, action);
- }
-
- public CmsError ReadAssistedToolingProcedure(out DTOAssistedToolingEndValueModel data)
- {
- data = new DTOAssistedToolingEndValueModel();
- AssistedToolingModel tmpData = new AssistedToolingModel();
- CmsError cmsError = numericalControl.PLC_RAssistedToolingData(ref tmpData);
- if (cmsError.IsError())
- return cmsError;
-
- data = new DTOAssistedToolingEndValueModel(tmpData);
-
- return cmsError;
- }
-
- public CmsError TerminateAssistedProcedure(int magazineId, bool writeData)
- {
- if (writeData)
- {
- CmsError cmsError = StartEditTooling(magazineId);
- if (!cmsError.IsError())
- {
- // Write tool table new data
- cmsError = StopEditTooling(magazineId);
- if (!cmsError.IsError())
- {
- // Close procedure
- return numericalControl.PLC_WTerminateAssistedToolingProcedure();
- }
- }
- return cmsError;
- }
- else
- {
- return numericalControl.PLC_WTerminateAssistedToolingProcedure();
- }
- }
-
- public CmsError GetSelfAdaptiveStep(out DTOSelfAdaptiveModel step)
- {
- step = new DTOSelfAdaptiveModel();
- byte intStep = 0;
-
- //Get the value
- CmsError cmsError = numericalControl.TOOLS_RAdatpivePathStep(ref intStep);
- step.Step = intStep;
- return cmsError;
- }
-
- public CmsError SetSelfAdaptiveStep(DTOSelfAdaptiveModel step)
- {
- //Limit Value
- if (step.Step > 100)
- step.Step = 100;
- if (step.Step < 0)
- step.Step = 0;
-
- //Set the value
- return numericalControl.TOOLS_WAdatpivePathStep(step.Step);
- }
-
- public CmsError RestoreTableLock()
- {
- List ids = new List();
- // check if there are magazines blocked by Active previously
- CmsError cmsError = numericalControl.TOOLS_RMagazineBlock(ref ids);
- if (cmsError.IsError())
- return cmsError;
-
- if (ids.Count() > 0)
- {
- // Update tables
- cmsError = StopEditTooling(ids.FirstOrDefault());
- if (cmsError.IsError())
- return cmsError;
- // Free magazines
- return numericalControl.TOOLS_WFreeMagazines();
- }
-
- return NO_ERROR;
- }
- }
-}
\ No newline at end of file
diff --git a/Thermo.Active.NC/SiemensToolTableAdapter.cs b/Thermo.Active.NC/SiemensToolTableAdapter.cs
deleted file mode 100644
index 4e3cc91c..00000000
--- a/Thermo.Active.NC/SiemensToolTableAdapter.cs
+++ /dev/null
@@ -1,272 +0,0 @@
-using CMS_CORE_Library.Models;
-using Thermo.Active.Model.DTOModels.ToolModels;
-using System.Collections.Generic;
-using System.Linq;
-using static Thermo.Active.Config.ServerConfig;
-using static Thermo.Active.Model.Constants;
-
-namespace Thermo.Active.NC
-{
- public class SiemensToolTableAdapter : NcAdapter
- {
- public CmsError GetToolTableConfiguration(out ToolTableConfiguration config)
- {
- config = new ToolTableConfiguration();
- CmsError cmsError = numericalControl.TOOLS_RConfiguration(ref config);
- if (cmsError.IsError())
- return cmsError;
-
- // Set magazine assisted tooling from config
- foreach (var magConfig in ToolManagerConfig.MagazineNames)
- {
- var mag = config.Magazines.FirstOrDefault(x => magConfig.MagazineId == x.Id);
- if (mag != null)
- mag.AssistedToolingIsActive = magConfig.AssistedTooling;
- }
-
- config.RadiusMetricType = (ToolManagerConfig.ToolMetricType == RADIUS_METRIC);
-
- config.SelfAdaptivePathOptionActive = true;
- if (!ToolManagerConfig.SelfAdaptivePathOpt)
- config.SelfAdaptivePathOptionActive = false;
-
- if (NcConfig.NcVendor != NC_VENDOR.SIEMENS && NcConfig.NcVendor != NC_VENDOR.DEMO)
- {
- // Setup options
- config.FamilyOptionActive = true;
- config.MultitoolOptionActive = true;
- config.OffsetOptionActive = true;
- config.LifeOption = true;
-
- // Add categories to be removed
- List categories = new List();
- if (!ToolManagerConfig.ShankOpt)
- {
- config.MultitoolOptionActive = false;
- categories.Add("shankType");
- config.ToolsConfiguration = config.ToolsConfiguration.Where(x => !(x.Name == "shankId")).ToList();
- }
-
- if (!ToolManagerConfig.FamilyOpt)
- {
- config.FamilyOptionActive = false;
- categories.Add("family");
- config.ToolsConfiguration = config.ToolsConfiguration.Where(x => !(x.Name == "familyId")).ToList();
- config.ToolsConfiguration = config.FamiliesConfiguration.FamilyConfiguration.Concat(config.ToolsConfiguration).ToList();
- }
-
- if (!ToolManagerConfig.OffsetOpt)
- config.OffsetOptionActive = false;
-
- categories.Add("offset");
-
- if (!ToolManagerConfig.TcpOpt)
- categories.Add("tcp");
-
- if (!ToolManagerConfig.CoolingOpt)
- categories.Add("cooling");
-
- if (!ToolManagerConfig.DynamicCompensationOpt)
- categories.Add("dynamicCompensation");
-
- if (!ToolManagerConfig.GammaOpt)
- categories.Add("gamma");
-
- if (!ToolManagerConfig.LifeOpt)
- {
- categories.Add("life");
- config.LifeOption = false;
- }
-
- if (!ToolManagerConfig.MagPosTypeOpt)
- categories.Add("magPos");
-
- if (!ToolManagerConfig.MultidimensionalShankOpt)
- categories.Add("shankOpt");
-
- if (!ToolManagerConfig.SelfAdaptivePathOpt)
- categories.Add("selfAdaptive");
-
- if (!ToolManagerConfig.BallufOpt)
- categories.Add("balluf");
-
- if (!ToolManagerConfig.ReviveOpt)
- categories.Add("revive");
-
- if (!ToolManagerConfig.IntegrityCheckOpt)
- categories.Add("integrityCheck");
-
- // Remove category from configurations
- config.ToolsConfiguration = config.ToolsConfiguration.Where(x => !categories.Contains(x.Category) && !categories.Contains(x.SubCategory)).ToList();
-
- // Remove categories from familyConfig
- config.FamiliesConfiguration.FamilyConfiguration = config.FamiliesConfiguration.FamilyConfiguration.Where(x => !categories.Contains(x.Category)).ToList();
- // Remove also SUBCATEGORIES because "ReadOnlyFamily" configuration has category field not populated
- config.FamiliesConfiguration.FamilyReadOnlyConfiguration = config.FamiliesConfiguration.FamilyReadOnlyConfiguration.Where(x => !categories.Contains(x.SubCategory)).ToList();
-
- config.ShanksConfiguration.ShankConfiguration = config.ShanksConfiguration.ShankConfiguration.Where(x => !categories.Contains(x.Category)).ToList();
- config.MagazinePosConfiguration = config.MagazinePosConfiguration.Where(x => !categories.Contains(x.Category)).ToList();
-
- // Update tool types list
- config.FamiliesConfiguration.FamilyConfiguration.Where(x => x.Name == "toolType").FirstOrDefault().SelectValues = GetToolTypeList();
- }
- else if (NcConfig.NcVendor == NC_VENDOR.SIEMENS) // IF == SIEMENS
- {
- // Update Tool types list
- config.ToolsConfiguration.Where(x => x.Name == "toolTypeCode").FirstOrDefault().SelectValues = GetToolTypeList();
- }
-
- return cmsError;
- }
-
- private Dictionary GetToolTypeList()
- {
- return ToolManagerConfig
- .ToolTypes.Where(x => !x.Disabled)
- .ToDictionary(x => x.Id, x => x.Id.ToString());
- }
-
- public CmsError GetToolTableData(out List config)
- {
- config = new List();
- return numericalControl.TOOLS_RToolsData(ref config);
- }
-
- public CmsError GetShanksData(out List shanks)
- {
- shanks = new List();
- return numericalControl.TOOLS_RShanksData(ref shanks);
- }
-
- public CmsError GetFamiliesData(out List families)
- {
- families = new List();
- return numericalControl.TOOLS_RFamilyData(ref families);
- }
-
- public CmsError GetMagazinesPositionsData(out List magazinesPositions)
- {
- magazinesPositions = new List();
- return numericalControl.TOOLS_RMagazinePositions(ref magazinesPositions);
- }
-
- public CmsError GetMagazineStatus(out DTOMagazineActionModel magazineStatus)
- {
- // Set up models
- magazineStatus = new DTOMagazineActionModel();
- MagazineActionModel libModel = new MagazineActionModel();
- // Read status from NC
- CmsError cmsError = numericalControl.TOOLS_RMagazineAction(ref libModel);
- if (cmsError.IsError())
- return cmsError;
-
- magazineStatus = (DTOMagazineActionModel)libModel;
-
- return cmsError;
- }
-
- public CmsError AddTool(ref SiemensToolModel tool)
- {
- return numericalControl.TOOLS_WAddTool(ref tool);
- }
-
- public CmsError UpdateTool(ref SiemensToolModel tool)
- {
- return numericalControl.TOOLS_WUpdateTool(ref tool);
- }
-
- public CmsError AddFamily(string name, out FamilyModel family)
- {
- family = new FamilyModel()
- {
- Name = name
- };
-
- return numericalControl.TOOLS_WAddFamily(ref family);
- }
-
- public CmsError AddShank(ref ShankModel shank)
- {
- return numericalControl.TOOLS_WAddShank(ref shank);
- }
-
- public CmsError UpdateShank(ref ShankModel shank)
- {
- return numericalControl.TOOLS_WUpdateShank(ref shank);
- }
-
- public CmsError UpdateFamilyName(string oldName, string newName)
- {
- return numericalControl.TOOLS_WUpdateFamilyData(oldName, newName);
- }
-
- public CmsError UpdateMagazinePosition(PositionModel magazinePosition)
- {
- return numericalControl.TOOLS_WUpdatePosition(magazinePosition);
- }
-
- public CmsError DeleteTool(int id)
- {
- return numericalControl.TOOLS_WDeleteTool(id);
- }
-
- public CmsError DeleteShank(int id)
- {
- return numericalControl.TOOLS_WDeleteShank(id);
- }
-
- public CmsError DeleteFamily(string name)
- {
- return numericalControl.TOOLS_WDeleteFamily(name);
- }
-
- public CmsError AddEdge(int toolId, ref EdgeModel edge)
- {
- return numericalControl.TOOLS_WAddEdge(toolId, ref edge);
- }
-
- public CmsError UpdateEdge(int toolId, ref EdgeModel edge)
- {
- return numericalControl.TOOLS_WUpdateEdge(toolId, ref edge);
- }
-
- public CmsError DeleteEdge(int toolId, int edgeId)
- {
- return numericalControl.TOOLS_WDeleteEdge(toolId, edgeId);
- }
-
- public CmsError GetMagazinePositionsAndTools(int magazineId, out List magazinePos)
- {
- magazinePos = new List();
- return numericalControl.TOOLS_RMountedTools(magazineId, ref magazinePos);
- }
-
- public CmsError GetNotInMagazinesTools(out List multiTools, out List tools)
- {
- multiTools = new List();
- tools = new List();
- return numericalControl.TOOLS_RAvailableTools(ref multiTools, ref tools);
- }
-
- public CmsError LoadToolInMagazine(int magazineId, NewToolInMagazineModel newMag, out MountedToolModel mounted)
- {
- mounted = new MountedToolModel();
- return numericalControl.TOOLS_WLoadToolInMagazine(magazineId, newMag, ref mounted);
- }
-
- public CmsError UnloadToolInMagazine(int magazineId, int positionId)
- {
- return numericalControl.TOOLS_WUnloadToolFromMagazine(magazineId, positionId);
- }
-
- public CmsError LoadTooolIntoShank(int shankId, int positionId, int toolId)
- {
- return numericalControl.TOOLS_WLoadToolIntoShank(shankId, positionId, toolId);
- }
-
- public CmsError UnloadTooolFromShank(int shankId, int positionId)
- {
- return numericalControl.TOOLS_WUnloadToolFromShank(shankId, positionId);
- }
- }
-}
\ No newline at end of file
diff --git a/Thermo.Active.NC/Thermo.Active.NC.csproj b/Thermo.Active.NC/Thermo.Active.NC.csproj
index 6403ab16..77bfb046 100644
--- a/Thermo.Active.NC/Thermo.Active.NC.csproj
+++ b/Thermo.Active.NC/Thermo.Active.NC.csproj
@@ -49,9 +49,7 @@
-
-
diff --git a/Thermo.Active.Utils/supportFunctions.cs b/Thermo.Active.Utils/supportFunctions.cs
index bf12feed..f8762885 100644
--- a/Thermo.Active.Utils/supportFunctions.cs
+++ b/Thermo.Active.Utils/supportFunctions.cs
@@ -249,7 +249,6 @@ namespace Thermo.Active.Utils
{
job.Metadata.Generics.Description = metasFromFile.Description;
job.Metadata.Generics.ExecutionTime = metasFromFile.ExecutionTime;
- job.Metadata.Tools = metasFromFile.Tools;
job.Metadata.Customs = metasFromFile.Customs;
}
}
@@ -349,7 +348,6 @@ namespace Thermo.Active.Utils
{
jobData.Metadata.Generics.Description = metasFromFile.Description;
jobData.Metadata.Generics.ExecutionTime = metasFromFile.ExecutionTime;
- jobData.Metadata.Tools = metasFromFile.Tools;
jobData.Metadata.Customs = metasFromFile.Customs;
}
}
diff --git a/Thermo.Active/Controllers/WebApi/ConfigurationController.cs b/Thermo.Active/Controllers/WebApi/ConfigurationController.cs
index 49e93f0c..b43b9117 100644
--- a/Thermo.Active/Controllers/WebApi/ConfigurationController.cs
+++ b/Thermo.Active/Controllers/WebApi/ConfigurationController.cs
@@ -24,7 +24,6 @@ namespace Thermo.Active.Controllers.WebApi
ScadaConfig = ScadaConfig,
MaintenanceConfig = MaintenanceConfig,
ReportConfig = ReportConfig,
- ToolingConfig = ToolingConfig,
UtilitiesConfig = UtilitiesConfig,
JobEditorConfig = JobEditorConfig,
UsersConfig = UsersConfig
@@ -127,20 +126,6 @@ namespace Thermo.Active.Controllers.WebApi
return Ok(alarmsConfig);
}
- [Route("tool_manager"), HttpGet]
- public IHttpActionResult GetToolTableConfiguration()
- {
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
- CmsError libraryError = ncAdapter.GetToolTableConfiguration(out ToolTableConfiguration toolTableConfiguration);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok(toolTableConfiguration);
- }
- }
-
[Route("cmscontact"), HttpGet]
public IHttpActionResult GetCmsContact()
{
diff --git a/Thermo.Active/Controllers/WebApi/LanguageController.cs b/Thermo.Active/Controllers/WebApi/LanguageController.cs
index 9ff377aa..3cfebb08 100644
--- a/Thermo.Active/Controllers/WebApi/LanguageController.cs
+++ b/Thermo.Active/Controllers/WebApi/LanguageController.cs
@@ -54,20 +54,9 @@ namespace Thermo.Active.Controllers.WebApi
Dictionary alarmsNames = GetPlcAlarmsTranslations(language);
Dictionary headsNames = GetLocalizedHeadsNames(language);
- Dictionary magazinesNames = GetToolManagerTranslations(language);
Dictionary scadaTranslations = GetScadaTranslations(language);
- // Cooling
- if (NcConfig.NcVendor != NC_VENDOR.SIEMENS)
- {
- Dictionary coolingNames = GetCoolingTranslations(language);
- foreach (var coolingItem in coolingNames)
- {
- translations[coolingItem.Key] = coolingItem.Value;
- }
- }
-
// Concat maintenances dictionary with translations dictionary
translations = translations.Concat(maintenanceNames).ToDictionary(x => x.Key, x => x.Value);
// Softkeys
@@ -76,8 +65,6 @@ namespace Thermo.Active.Controllers.WebApi
translations = translations.Concat(alarmsNames).ToDictionary(x => x.Key, x => x.Value);
// Heads
translations = translations.Concat(headsNames).ToDictionary(x => x.Key, x => x.Value);
- // Magazines
- translations = translations.Concat(magazinesNames).ToDictionary(x => x.Key, x => x.Value);
// Scada
translations = translations.Concat(scadaTranslations).ToDictionary(x => x.Key, x => x.Value);
@@ -173,86 +160,6 @@ namespace Thermo.Active.Controllers.WebApi
}
}
- private static Dictionary GetCoolingTranslations(string language)
- {
- Dictionary dictionary = new Dictionary();
-
- // Find translated key
- var key = ToolManagerConfig.CooligsTranslations.Cooling.Where(x => x.Key == language).FirstOrDefault();
- if (key.Value != null)
- {
- // Add translated value \
- dictionary.Add("tooling_family_param_cooling", key.Value);
- dictionary.Add("tooling_equipment_param_cooling", key.Value);
- }
- key = ToolManagerConfig.CooligsTranslations.Cooling1.Where(x => x.Key == language).FirstOrDefault();
- if (key.Value != null)
- {
- dictionary.Add("tooling_family_param_cooling1", key.Value);
- dictionary.Add("tooling_equipment_param_cooling1", key.Value);
- }
- key = ToolManagerConfig.CooligsTranslations.Cooling2.Where(x => x.Key == language).FirstOrDefault();
- if (key.Value != null)
- {
- dictionary.Add("tooling_family_param_cooling2", key.Value);
- dictionary.Add("tooling_equipment_param_cooling2", key.Value);
- }
- key = ToolManagerConfig.CooligsTranslations.Cooling3.Where(x => x.Key == language).FirstOrDefault();
- if (key.Value != null)
- {
- dictionary.Add("tooling_family_param_cooling3", key.Value);
- dictionary.Add("tooling_equipment_param_cooling3", key.Value);
- }
- key = ToolManagerConfig.CooligsTranslations.Cooling4.Where(x => x.Key == language).FirstOrDefault();
- if (key.Value != null)
- {
- dictionary.Add("tooling_family_param_cooling4", key.Value);
- dictionary.Add("tooling_equipment_param_cooling4", key.Value);
- }
- key = ToolManagerConfig.CooligsTranslations.Cooling5.Where(x => x.Key == language).FirstOrDefault();
- if (key.Value != null)
- {
- dictionary.Add("tooling_family_param_cooling5", key.Value);
- dictionary.Add("tooling_equipment_param_cooling5", key.Value);
- }
- key = ToolManagerConfig.CooligsTranslations.Cooling6.Where(x => x.Key == language).FirstOrDefault();
- if (key.Value != null)
- {
- dictionary.Add("tooling_family_param_cooling6", key.Value);
- dictionary.Add("tooling_equipment_param_cooling6", key.Value);
- }
- key = ToolManagerConfig.CooligsTranslations.Cooling7.Where(x => x.Key == language).FirstOrDefault();
- if (key.Value != null)
- {
- dictionary.Add("tooling_family_param_cooling7", key.Value);
- dictionary.Add("tooling_equipment_param_cooling7", key.Value);
- }
- return dictionary;
- }
-
- private static Dictionary GetToolManagerTranslations(string language)
- {
- Dictionary translatedNames = new Dictionary();
-
- foreach (var mag in ToolManagerConfig.MagazineNames)
- {
- translatedNames.Add(
- "magazine_name_" + mag.MagazineId,
- GetValueFromLocalizationList(mag.LocalizedNames, language, "Magazine_" + mag.MagazineId)
- );
- }
-
- foreach(var toolType in ToolManagerConfig.ToolTypes)
- {
- translatedNames.Add(
- "tooling_equipment_list_select_" + toolType.Id,
- GetValueFromLocalizationList(toolType.LocalizedNames, language, "Magazine_" + toolType.Id)
- );
- }
-
- return translatedNames;
- }
-
private static Dictionary GetScadaTranslations(string language)
{
Dictionary translatedNames = new Dictionary();
diff --git a/Thermo.Active/Controllers/WebApi/NcToolManagerController.cs b/Thermo.Active/Controllers/WebApi/NcToolManagerController.cs
deleted file mode 100644
index 45e25a29..00000000
--- a/Thermo.Active/Controllers/WebApi/NcToolManagerController.cs
+++ /dev/null
@@ -1,1052 +0,0 @@
-using CMS_CORE_Library.Models;
-using Newtonsoft.Json;
-using Thermo.Active.Database.Controllers;
-using Thermo.Active.Model.DatabaseModels;
-using Thermo.Active.Model.DTOModels;
-using Thermo.Active.Model.DTOModels.ToolModels;
-using Thermo.Active.NC;
-using Thermo.Active.Utils;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Net.Http;
-using System.Text;
-using System.Threading.Tasks;
-using System.Web;
-using System.Web.Http;
-using static Thermo.Active.Config.ServerConfig;
-using static Thermo.Active.Listeners.SignalRStaticObjects;
-using static Thermo.Active.Model.Constants;
-
-namespace Thermo.Active.Controllers.WebApi
-{
- [RoutePrefix("api/tool_manager/nc")]
- public class NcToolManagerApiController : ApiController
- {
- #region Tools
-
- [Route("tools"), HttpGet]
- public IHttpActionResult GetNcToolTable()
- {
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- ncAdapter.Connect();
- CmsError cmsError = ncAdapter.GetToolsData(out List tools);
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- // Add family data to tools
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- // Get families
- List families = toolsManager.GetFamilies();
-
- List toolsWithFamilies = new List();
- // Create tool&family return objecs
- foreach (var tool in tools)
- {
- toolsWithFamilies.Add
- (
- CreateToolAndFamilyObj( // Create return model with family data & tool data
- tool,
- families.Where(x => x.Id == tool.FamilyId).FirstOrDefault() // Find matching family
- )
- );
- }
-
- return Ok(toolsWithFamilies);
- }
- }
- }
-
- [Route("tool/{toolId:int}/{familyId:int}"), HttpPost]
- public IHttpActionResult AddToolWithId(short toolId, short familyId)
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- // Check if exists a tool with the same id
- DbNcToolModel dbTool = toolsManager.FindTool(toolId);
- if (dbTool != null)
- return BadRequest(API_ERROR_KEYS.ID_ALREADY_EXIST);
-
- // Create default family
- DTONcFamilyModel defaultFamily = new DTONcFamilyModel();
- // Copy data from static obj preconfigured
- SupportFunctions.CopyProperties(DTO_TOOL_WITH_FAM, defaultFamily);
-
- // Overwrite the custom model id
- defaultFamily.Id = familyId;
-
- // Check if FAMILY option is active
- if (ToolManagerConfig.FamilyOpt)
- {
- // Check if id is already occupied
- DbNcFamilyModel dbFam = null;
-
- // Check Family id
- // 0 : Create new family
- // N : Set tool familyId with input id
-
- if (familyId == 0)
- // Add new family
- dbFam = toolsManager.AddFamily(defaultFamily);
- else
- {
- // check if family exist & set da
- dbFam = toolsManager.FindFamily(familyId);
- if (dbFam == null)
- return BadRequest(API_ERROR_KEYS.INCORRECT_PARAMETERS);
- }
-
- // Set return value
- //DTO_TOOL_WITH_FAM.FamilyId = dbFam.FamilyId;
- //DTO_TOOL_WITH_FAM.Name = dbFam.Name;
-
- SupportFunctions.CopyProperties(dbFam, DTO_TOOL_WITH_FAM);
- }
- else
- {
- defaultFamily.Id = toolId;
- // Add new family
- DbNcFamilyModel dbFam = toolsManager.AddFamily(defaultFamily);
-
- // Set return value
- DTO_TOOL_WITH_FAM.FamilyId = dbFam.FamilyId;
- DTO_TOOL_WITH_FAM.Name = dbFam.Name;
- }
-
- // Check if option is active
- if (!ToolManagerConfig.ShankOpt)
- {
- // If option is not active create a shank
- DTONewNcShankModel newShank = new DTONewNcShankModel()
- {
- Balluf = 0,
- MagazinePositionType = 0
- };
-
- // Create a new shank
- DbNcShankModel ncShank = toolsManager.AddShank(newShank, toolId);
- // Connect tool to new shank
- DTO_TOOL_WITH_FAM.ShankId = ncShank.ShankId;
- }
- else
- DTO_TOOL_WITH_FAM.ShankId = null;
- }
-
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- ncAdapter.Connect();
-
- // Add tool
- CmsError cmsError = ncAdapter.AddTool(DTO_TOOL_WITH_FAM, out DTONcToolModel newTool, toolId);
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- // if offset option is disabled set first offset id equal to toolId
- if (!ToolManagerConfig.OffsetOpt)
- {
- ncAdapter.UpdateToolOffsetId(newTool.Id, 1, newTool.Id, out DTONcToolModel toolWithOffset);
- newTool.OffsetId1 = newTool.Id;
- newTool.Offset1 = toolWithOffset.Offset1;
- }
-
- return Ok(CreateToolAndFamilyObj(newTool, DTO_TOOL_WITH_FAM));
- }
- }
-
- [Route("tool/{toolId:int}"), HttpPut]
- public IHttpActionResult PutTool(int toolId, [FromBody][Required]DTONewNcToolWithFamilyModel dtoToolWithFamily)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- DbNcToolModel tool = null;
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- // Check if tool exists
- tool = toolsManager.FindTool(toolId);
- if (tool == null)
- return NotFound();
-
- // Check if tool is mounted in spindle
- if (ToolIsInSpindle(toolId))
- return BadRequest(API_ERROR_KEYS.TOOL_IS_MOUNTED);
-
- if (tool.FamilyId != dtoToolWithFamily.FamilyId)
- {
- // Check if family exists
- DbNcFamilyModel fam = toolsManager.FindFamily(dtoToolWithFamily.FamilyId);
- if (fam == null)
- return BadRequest(API_ERROR_KEYS.INCORRECT_PARAMETERS);
-
- // Change return fam data
- if (ToolManagerConfig.FamilyOpt)
- {
- dtoToolWithFamily.Name = fam.Name;
- }
- }
-
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- ncAdapter.Connect();
-
- // Update
- CmsError cmsError = ncAdapter.UpdateTool(toolId, dtoToolWithFamily, out DTONcToolModel newTool, dtoToolWithFamily);
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- return Ok(CreateToolAndFamilyObj(newTool, dtoToolWithFamily));
- }
- }
- }
-
- [Route("tool/{toolId:int}"), HttpDelete]
- public IHttpActionResult DeleteTool(int toolId)
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- DbNcToolModel tool = toolsManager.FindToolWithDependencies(toolId);
- if (tool == null)
- return NotFound();
-
- // Check if tool is mounted in magazine (a tool to be mounted in spindle must be in magazine)
- if(tool.Shank != null && tool.Shank.MagazineId != null && tool.Shank.PositionId != null)
- return BadRequest(API_ERROR_KEYS.TOOL_IS_MOUNTED);
-
- // Check if tool is mounted in spindle
- //if (ToolIsInSpindle(toolId))
- // return BadRequest(API_ERROR_KEYS.TOOL_IS_MOUNTED);
-
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- ncAdapter.Connect();
-
- CmsError cmsError;
- cmsError = ncAdapter.DeleteNcTool(tool);
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- return Ok();
- }
- }
- }
-
- #endregion Tools
-
- #region Offsets
-
- [Route("offset/{offsetId:int}"), HttpPut]
- public IHttpActionResult UpdateOffset(short offsetId, OffsetModel offsetData)
- {
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- ncAdapter.Connect();
-
- CmsError cmsError = ncAdapter.UpdateOffset(offsetId, offsetData);
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- offsetData.Id = offsetId;
-
- return Ok(offsetData);
- }
- }
-
- [Route("tool/{toolId:int}/position/{positionId:int}/offset/{offsetId:int}"), HttpPut]
- public IHttpActionResult UpdateToolOffset(int toolId, int positionId, short offsetId)
- {
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- ncAdapter.Connect();
-
- CmsError cmsError = ncAdapter.UpdateToolOffsetId(toolId, positionId, offsetId, out DTONcToolModel tool);
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- return Ok(tool);
- }
- }
-
- #endregion Offsets
-
- #region Shanks
-
- [Route("shanks"), HttpGet]
- public IHttpActionResult GetShanks()
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- return Ok(toolsManager.GetShanks());
- }
- }
-
- [Route("shank/{shankId:int}"), HttpPost]
- public IHttpActionResult AddShank(short shankId)
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- // Check if exists a tool with the same id
- DbNcShankModel dbShank = toolsManager.FindShank(shankId);
- if (dbShank != null)
- return BadRequest(API_ERROR_KEYS.ID_ALREADY_EXIST);
- }
-
- if (!ToolManagerConfig.ShankOpt)
- return BadRequest(API_ERROR_KEYS.OPTION_NOT_ACTIVE);
-
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- DTONewNcShankModel dtoShank = new DTONewNcShankModel()
- {
- Balluf = 0,
- MagazinePositionType = 0
- };
- DTONcShankModel shank = (DTONcShankModel)toolsManager.AddShank(dtoShank, shankId);
-
- return Ok(shank);
- }
- }
-
- [Route("shank/{shankId:int}"), HttpPut]
- public IHttpActionResult PutShank(int shankId, [FromBody][Required]DTONewNcShankModel dtoShank)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- // Check if shank exists
- DbNcShankModel shank = toolsManager.FindShankWithTools(shankId);
- if (shank == null)
- return NotFound();
-
- // Check if tools are mounted in spindle
- foreach (var tool in shank.Tools)
- {
- if (ToolIsInSpindle(tool.ToolId))
- return BadRequest(API_ERROR_KEYS.TOOL_IS_MOUNTED);
- }
-
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- CmsError cmsError = ncAdapter.Connect();
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- // Update shank
- cmsError = ncAdapter.UpdateShank(shankId, dtoShank, out DTONcShankModel newShank);
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- return Ok(newShank);
- }
- }
- }
-
- [Route("shank/{shankId:int}"), HttpDelete]
- public IHttpActionResult DeleteShank(int shankId)
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- // Check if shank exists
- DbNcShankModel shank = toolsManager.FindShankWithTools(shankId);
- if (shank == null)
- return NotFound();
-
- // Check if tools are mounted in spindle
- foreach (var tool in shank.Tools)
- {
- if (ToolIsInSpindle(tool.ToolId))
- return BadRequest(API_ERROR_KEYS.TOOL_IS_MOUNTED);
- }
-
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- CmsError cmsError = ncAdapter.Connect();
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- cmsError = ncAdapter.DeleteNcShank(shank.ShankId);
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- return Ok();
- }
- }
- }
-
- #endregion Shanks
-
- #region Families
-
- [Route("families"), HttpGet]
- public IHttpActionResult GetFamilies()
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- List families = toolsManager.GetFamilies();
-
- return Ok(families);
- }
- }
-
- [Route("family/{familyId:int}"), HttpPost]
- public IHttpActionResult AddFamily(short familyId)
- {
- // Create default family
- DTONcFamilyModel defaultFamily = new DTONcFamilyModel();
- // Copy data from static obj configured
- SupportFunctions.CopyProperties(DTO_TOOL_WITH_FAM, defaultFamily);
- defaultFamily.Id = familyId;
-
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- DTONcFamilyModel newFamily = ncAdapter.AddFamily(defaultFamily);
-
- return Ok(newFamily);
- }
- }
-
- [Route("family/{familyId:int}"), HttpPut]
- public IHttpActionResult PutFamily(int familyId, [FromBody][Required]DTONewNcFamilyModel dtoFamily)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- // Check if family exists
- DbNcFamilyModel family = toolsManager.FindFamily(familyId);
- if (family == null)
- return NotFound();
-
- // Check if tools are mounted in spindle
- foreach (var tool in family.Tools)
- {
- if (ToolIsInSpindle(tool.ToolId))
- return BadRequest(API_ERROR_KEYS.TOOL_IS_MOUNTED);
- }
-
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- CmsError cmsError = ncAdapter.Connect();
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- // Update into db and NC
- cmsError = ncAdapter.UpdateFamily(familyId, dtoFamily, out DTONcFamilyModel newFamily);
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- return Ok(newFamily);
- }
- }
- }
-
- [Route("family/{familyId:int}"), HttpDelete]
- public IHttpActionResult DeleteFamily(int familyId)
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- // Find if exists
- DbNcFamilyModel family = toolsManager.FindFamily(familyId);
- if (family == null)
- return NotFound();
-
- // Check if tools are mounted in spindle
- foreach (var tool in family.Tools)
- {
- //
- var t = toolsManager.FindToolWithDependencies(tool.ToolId);
- if(t.Shank != null && t.Shank.MagazineId != null && t.Shank.PositionId != null)
- return BadRequest(API_ERROR_KEYS.TOOL_IS_MOUNTED);
-
- //if (ToolIsInSpindle(tool.ToolId))
- // return BadRequest(API_ERROR_KEYS.TOOL_IS_MOUNTED);
- }
-
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- CmsError cmsError = ncAdapter.Connect();
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- //Delete
- cmsError = ncAdapter.DeleteNcFamily(familyId);
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- return Ok();
- }
- }
- }
-
- #endregion Families
-
- #region Magazine positions
-
- [Route("magazines_positions"), HttpGet]
- public IHttpActionResult GetMagazinesPositions()
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- List magazines = toolsManager.FindMagazinesPositions();
-
- return Ok(magazines);
- }
- }
-
- [Route("magazine/{magazineId:int}/positions"), HttpGet]
- public IHttpActionResult GetMagazinesPositions(byte magazineId)
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- List magazine = toolsManager.GetMagazinePositions(magazineId);
-
- return Ok(magazine);
- }
- }
-
- [Route("magazine/{magazineId}/position/{positionId}"), HttpPut]
- public IHttpActionResult PutMagazinePosition([Required]byte magazineId, [Required]byte positionId, [FromBody]DTONcMagazinePositionModel dtoPos)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- // Check if magazine&position exists
- DbNcMagazinePositionModel pos = toolsManager.FindMagazinePosition(magazineId, positionId);
- if (pos == null)
- return NotFound();
-
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- ncAdapter.Connect();
- CmsError cmsError = ncAdapter.UpdateMagazinePosition(pos, dtoPos, out DTONcMagazinePositionModel newPos);
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- return Ok(newPos);
- }
- }
- }
-
- #endregion Magazine positions
-
-
- [Route("magazine/{magazineId:int}/mounted_shanks"), HttpGet]
- public IHttpActionResult GetMagazineTools(byte magazineId)
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- // Check if magazine exists
- List pos = toolsManager.FindMagazinePositions(magazineId);
- if (pos.Count <= 0)
- return NotFound();
-
- List mountedShank = toolsManager.GetMountedShanks(magazineId);
-
- return Ok(mountedShank);
- }
- }
-
- [Route("magazine/available_shanks"), HttpGet]
- public IHttpActionResult GetAvailableShanks()
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- List shanks = new List();
-
- shanks = toolsManager.GetAvailableShanksWithChilds();
-
- return Ok(shanks);
- }
- }
-
- [Route("magazine/available_tools"), HttpGet]
- public IHttpActionResult GetAvailableTools()
- {
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- List tools = toolsManager.GetAvailableTools();
-
- return Ok(tools);
- }
- }
-
- [Route("magazine/{magazineId:int}/load/position/{positionId:int}"), HttpPut]
- public IHttpActionResult LoadToolInToMagazine(byte magazineId, byte positionId, [FromBody][Required] DTONcUpdateMagazineModel shankId)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
- if (shankId.ShankId == 0)
- return BadRequest(API_ERROR_KEYS.INCORRECT_PARAMETERS);
-
- DTONcShankModel dtoShank = new DTONcShankModel();
-
- // Check data
- DbNcShankModel shank;
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- // Check if shank exists
- shank = toolsManager.FindShankWithTools(shankId.ShankId);
- if (shank == null)
- return BadRequest(API_ERROR_KEYS.INCORRECT_PARAMETERS);
-
- // Check if shank is already loaded somewhere
- if (shank.MagazineId != null)
- return BadRequest(API_ERROR_KEYS.TOOL_IS_MOUNTED);
-
- // Check if magazine position exists
- DbNcMagazinePositionModel magPos = toolsManager.FindMagazinePosition(magazineId, positionId);
- if (magPos == null)
- return BadRequest(API_ERROR_KEYS.INCORRECT_PARAMETERS);
- // Check position type
- //if (shank.Tools.FirstOrDefault().Family.ToolType != magPos.Type)
- // return BadRequest(API_ERROR_KEYS.INCORRECT_PARAMETERS);
-
- // Check if the mag pos is disabled
- if (magPos.Disabled == true)
- return BadRequest(API_ERROR_KEYS.MAG_POS_DISABLED);
-
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- // Get Configuration
- ncAdapter.Connect();
-
- // Check if shank can fit
- CmsError cmsError = ncAdapter.CheckIfShankCanFit(
- magazineId,
- positionId,
- shank // mounted tools
- );
-
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- dtoShank = toolsManager.GetShank(shank.ShankId);
- }
-
- // Update shank data
- DTONcMagazinePositionModel magazinePos = (DTONcMagazinePositionModel)toolsManager.LoadShankInMagazine(magazineId, positionId, shank);
- // Set shankId
- magazinePos.ShankId = shank.ShankId;
-
- dtoShank.MagazineId = magazineId;
- dtoShank.PositionId = positionId;
-
- return Ok(dtoShank);
- }
- }
-
- [Route("magazine/{magazineId:int}/unload/position/{positionId:int}"), HttpPut]
- public IHttpActionResult UnloadToolInToMagazine(byte magazineId, byte positionId, [FromBody][Required] DTONcUpdateMagazineModel shankId)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
- if (shankId.ShankId == 0)
- return BadRequest(API_ERROR_KEYS.INCORRECT_PARAMETERS);
-
- // Check data
- DbNcShankModel shank;
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- // Check if shank exists
- shank = toolsManager.FindShankWithTools(shankId.ShankId);
- if (shank == null)
- return BadRequest(API_ERROR_KEYS.INCORRECT_PARAMETERS);
-
- // Check if tools are mounted in spindle
- foreach (var tool in shank.Tools)
- {
- if (ToolIsInSpindle(tool.ToolId))
- return BadRequest(API_ERROR_KEYS.TOOL_IS_MOUNTED);
- }
-
- // Check if magazine position exists
- DbNcMagazinePositionModel magPos = toolsManager.FindMagazinePosition(magazineId, positionId);
- if (magPos == null)
- return BadRequest(API_ERROR_KEYS.INCORRECT_PARAMETERS);
- //// Check if the mag pos is disabled
- //if (magPos.Disabled == true)
- // return BadRequest(API_ERROR_KEYS.INCORRECT_PARAMETERS);
-
- // Check if magazine position is not occupied
- DbNcShankModel shankMounted = toolsManager.FindShanksByPositions(magazineId, positionId);
- if (shankMounted == null)
- return BadRequest(API_ERROR_KEYS.INCORRECT_PARAMETERS);
-
- DTONcMagazinePositionModel magazinePos = (DTONcMagazinePositionModel)toolsManager.UnloadShankInMagazine(magazineId, positionId, shank);
-
- return Ok(magazinePos);
- }
- }
-
- [Route("shank/{shankId:int}/load/tool/{toolId:int}"), HttpPut]
- public IHttpActionResult LoadToolIntoShank(short shankId, int toolId)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- DbNcToolModel tool;
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- // Check if shank exists
- DbNcShankModel shank = toolsManager.FindShankWithTools(shankId);
- if (shank == null)
- return BadRequest(API_ERROR_KEYS.INCORRECT_PARAMETERS);
-
- tool = toolsManager.FindTool(toolId);
- if (tool == null)
- return BadRequest(API_ERROR_KEYS.INCORRECT_PARAMETERS);
- }
-
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- ncAdapter.Connect();
-
- DTONcShankModel shank = ncAdapter.LoadIntoShank(tool, shankId);
-
- return Ok(shank);
- }
- }
-
- [Route("shank/{shankId:int}/unload/tool/{toolId:int}"), HttpPut]
- public IHttpActionResult UnloadToolIntoShank(int shankId, int toolId)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- DbNcToolModel tool;
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- // Check if shank exists
- DbNcShankModel shank = toolsManager.FindShankWithTools(shankId);
- if (shank == null)
- return BadRequest(API_ERROR_KEYS.INCORRECT_PARAMETERS);
-
- tool = toolsManager.FindTool(toolId);
- if (tool == null)
- return BadRequest(API_ERROR_KEYS.INCORRECT_PARAMETERS);
- }
-
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- ncAdapter.Connect();
-
- DTONcShankModel shank = ncAdapter.UnloadFromShank(tool);
-
- return Ok(shank);
- }
- }
-
- [Route("start_edit_tooling/{magazineId:int}"), HttpPut]
- public IHttpActionResult StartEditTooling(int magazineId)
- {
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- ncAdapter.Connect();
-
- CmsError cmsError = ncAdapter.StartEditTooling(magazineId);
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- return Ok();
- }
- }
-
- [Route("stop_edit_tooling/{magazineId:int}"), HttpPut]
- public IHttpActionResult StopEditTooling(int magazineId)
- {
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- ncAdapter.Connect();
-
- Stopwatch st = new Stopwatch();
- st.Restart();
- CmsError cmsError = ncAdapter.StopEditTooling(magazineId);
- Console.WriteLine("TOOL TABLE WRITE TIME " + st.ElapsedMilliseconds);
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- return Ok();
- }
- }
-
- [Route("assisted_tooling/"), HttpPost]
- public IHttpActionResult StartAssistedTooling(DTOAssistedToolingModel data)
- {
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- ncAdapter.Connect();
-
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- var tool = toolsManager.FindTool(data.ToolId);
- if (tool == null)
- return BadRequest();
-
- CmsError cmsError = ncAdapter.StartAssistedToolingProcedure(data.ToolId, (ushort)tool.FamilyId, (ushort)tool.ShankId, data.MagazineId, data.PositionId, data.Action);
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
- }
-
- return Ok();
- }
- }
-
- [Route("export"), HttpPost]
- public IHttpActionResult ExportToolTable()
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- DTOExportToolTableModel expData = toolsManager.GetExportData();
-
- return Ok(expData);
- }
- }
-
- [Route("import"), HttpPost]
- public async Task ImportToolTable()
- {
- // Check whether the POST operation is MultiPart?
- if (!Request.Content.IsMimeMultipartContent())
- throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
-
- var filesReadToProvider = await Request.Content.ReadAsMultipartAsync();
-
- var stream = filesReadToProvider.Contents.FirstOrDefault();
- if (stream == null)
- return BadRequest();
-
- var fileBytes = await stream.ReadAsByteArrayAsync();
-
- // Convert bytes into json string
- string jsonString = Encoding.UTF8.GetString(fileBytes);
-
- bool val = IsValidJson(jsonString, out DTOExportToolTableModel importData);
- if (!val)
- return BadRequest(API_ERROR_KEYS.IMPORT_FILE_NOT_VALID);
-
- if(importData.Families == null || importData.Shanks == null || importData.Tools == null)
- return BadRequest(API_ERROR_KEYS.IMPORT_FILE_NOT_VALID);
-
- using (NcToolManagerController toolsManager = new NcToolManagerController())
- {
- // Import data in the database
- List importStatus = toolsManager.ImportData(importData);
-
- return Ok(importStatus);
- }
- }
-
- [Route("selfadaptivepathstep"), HttpGet]
- public IHttpActionResult GetSelfAdaptivePathStep()
- {
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- DTOSelfAdaptiveModel sam;
-
- CmsError cmsError = ncAdapter.Connect();
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- cmsError = ncAdapter.GetSelfAdaptiveStep(out sam);
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- return Ok(sam);
- }
- }
-
- [Route("selfadaptivepathstep"), HttpPut]
- public IHttpActionResult SetSelfAdaptivePathStep([FromBody][Required]DTOSelfAdaptiveModel dtoSelfAdaptiveModel)
- {
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- CmsError cmsError = ncAdapter.Connect();
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- cmsError = ncAdapter.SetSelfAdaptiveStep(dtoSelfAdaptiveModel);
- if (cmsError.IsError())
- return BadRequest(cmsError.localizationKey);
-
- return Ok();
- }
- }
- #region Private Functions
-
- private static DTONcToolWithFamilyModel DTO_TOOL_WITH_FAM = new DTONcToolWithFamilyModel()
- {
- Id = 0,
- Name = DEFAULT_FAM_NAME,
- OffsetId1 = null,
- OffsetId2 = null,
- OffsetId3 = null,
- LeftSize = 1,
- RightSize = 1
- };
-
- private bool IsValidJson(string jsonString, out DTOExportToolTableModel data)
- {
- data = new DTOExportToolTableModel();
- if (string.IsNullOrWhiteSpace(jsonString))
- return false;
-
- try
- {
- // Deserialize the string into DTO object
- data = JsonConvert.DeserializeObject(jsonString);
- return true;
- }
- catch (Exception)
- {
- return false;
- }
- }
-
- private DTONcToolWithFamilyModel CreateToolAndFamilyObj(DTONcToolModel tool, DTONewNcToolWithFamilyModel familyData)
- {
- DTONcToolWithFamilyModel familyTool = new DTONcToolWithFamilyModel();
- // Copy family fields
- SupportFunctions.CopyProperties(familyData, familyTool);
- // Copy tool fields
- SupportFunctions.CopyProperties(tool, familyTool);
-
- return familyTool;
- }
-
- private DTONcToolWithFamilyModel CreateToolAndFamilyObj(DTONcToolModel tool, DTONcToolWithFamilyModel familyData)
- {
- DTONcToolWithFamilyModel familyTool = new DTONcToolWithFamilyModel();
- // Copy family fields
- SupportFunctions.CopyProperties(familyData, familyTool);
- // Copy tool fields
- SupportFunctions.CopyProperties(tool, familyTool);
-
- return familyTool;
- }
-
- private DTONcToolWithFamilyModel CreateToolAndFamilyObj(DTONcToolModel tool, DTONcFamilyModel familyData)
- {
- DTONcToolWithFamilyModel familyTool = new DTONcToolWithFamilyModel();
- // Copy family fields
- SupportFunctions.CopyProperties(familyData, familyTool);
- // Copy tool fields
- SupportFunctions.CopyProperties(tool, familyTool);
-
- return familyTool;
- }
-
- private bool ToolIsInSpindle(int toolId)
- {
- foreach (var head in LastHeadsData.ToList())
- {
- if (head is DTOSpindleModel)
- {
- var spindle = head as DTOSpindleModel;
- if (!spindle.FixedHead && spindle.MountedTool == toolId)
- return true;
- }
- }
-
- return false;
- }
-
- #endregion
- }
-
- //[Route("tool_old"), HttpPost]
- //public IHttpActionResult AddTool([FromBody][Required]DTONewNcToolWithFamilyModel dtoToolWithFamily)
- //{
- // if (!ModelState.IsValid)
- // return BadRequest(ModelState);
-
- // short familyId = 0;
- // using (NcToolManagerController toolsManager = new NcToolManagerController())
- // {
- // // Check if option is active
- // if (ToolManagerConfig.FamilyOpt)
- // {
- // if (dtoToolWithFamily.FamilyId == 0)
- // {
- // // If param equal to 0 create a new family
- // DTONcFamilyModel newFamily = new DTONcFamilyModel() { Name = "NewFamily", LeftSize = 1, RightSize = 1 };
- // // Add new family & update family id
- // DbNcFamilyModel newFam = toolsManager.AddFamily(newFamily);
- // dtoToolWithFamily.FamilyId = newFam.FamilyId;
- // dtoToolWithFamily.Name = newFam.Name;
- // }
- // else
- // {
- // // Check if family exists
- // DbNcFamilyModel fam = toolsManager.FindFamily(dtoToolWithFamily.FamilyId);
- // if (fam == null)
- // return BadRequest(API_ERROR_KEYS.INCORRECT_PARAMETERS);
-
- // // Update return data
- // if (ToolManagerConfig.FamilyOpt)
- // {
- // dtoToolWithFamily.Name = fam.Name;
- // }
- // }
- // }
- // else
- // {
- // // Copy only family data from tool&fam model
- // DTONcFamilyModel newFamily = new DTONcFamilyModel();
- // SupportFunctions.CopyProperties(dtoToolWithFamily, newFamily);
-
- // // Add new family
- // DbNcFamilyModel dbFam = toolsManager.AddFamily(newFamily);
- // if (dbFam == null)
- // return BadRequest(API_ERROR_KEYS.INCORRECT_PARAMETERS);
- // dtoToolWithFamily.FamilyId = dbFam.FamilyId;
-
- // // Set common id
- // familyId = dbFam.FamilyId;
- // }
-
- // // Check if option is active
- // if (!ToolManagerConfig.ShankOpt)
- // {
- // // If option is not active create a shank
- // DTONewNcShankModel newShank = new DTONewNcShankModel()
- // {
- // Balluf = 0,
- // MagazinePositionType = 0
- // };
-
- // // Create a new shank
- // DbNcShankModel ncShank = toolsManager.AddShank(newShank, familyId);
- // // Connect tool to new shank
- // dtoToolWithFamily.ShankId = ncShank.ShankId;
- // }
- // else
- // dtoToolWithFamily.ShankId = null;
- // }
-
- // using (ncAdapter ncAdapter = new ncAdapter())
- // {
- // ncAdapter.Connect();
-
- // // Add tool
- // CmsError cmsError = ncAdapter.AddTool(dtoToolWithFamily, out DTONcToolModel newTool, familyId);
- // if (cmsError.IsError())
- // return BadRequest(cmsError.localizationKey);
-
- // return Ok(CreateToolAndFamilyObj(newTool, dtoToolWithFamily));
- // }
- //}
-
-}
\ No newline at end of file
diff --git a/Thermo.Active/Controllers/WebApi/SiemensToolManagerController.cs b/Thermo.Active/Controllers/WebApi/SiemensToolManagerController.cs
deleted file mode 100644
index 68e49411..00000000
--- a/Thermo.Active/Controllers/WebApi/SiemensToolManagerController.cs
+++ /dev/null
@@ -1,449 +0,0 @@
-using CMS_CORE_Library.Models;
-using Thermo.Active.Model.DatabaseModels;
-using Thermo.Active.Model.DTOModels.ToolModels;
-using Thermo.Active.NC;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Web.Http;
-
-namespace Thermo.Active.Controllers.WebApi
-{
- [RoutePrefix("api/tool_manager")]
- public class SiemensToolManagerController : ApiController
- {
- [Route("tools"), HttpGet]
- public IHttpActionResult GetToolTable()
- {
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
- CmsError libraryError = ncAdapter.GetToolTableData(out List tools);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok(tools);
- }
- }
-
- [Route("siemens/tool"), HttpPost]
- public IHttpActionResult AddTool([FromBody][Required]DTOSiemensToolModel tool)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- // Convert from DTOModel to library model
- SiemensToolModel siemensModel = (SiemensToolModel)tool; ;
-
- ncAdapter.Connect();
- CmsError libraryError = ncAdapter.AddTool(ref siemensModel);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok(siemensModel);
- }
- }
-
- [Route("siemens/tool/{id}"), HttpPut]
- public IHttpActionResult UpdateTool(int id, [FromBody][Required]DTOSiemensToolModel tool)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- // Convert from DTOModel to library model
- SiemensToolModel siemensModel = (SiemensToolModel)tool;
- siemensModel.Id = id;
-
- ncAdapter.Connect();
- CmsError libraryError = ncAdapter.UpdateTool(ref siemensModel);
-
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok(siemensModel);
- }
- }
-
- [Route("tool/{id:int}"), HttpDelete]
- public IHttpActionResult DeleteTool(int id)
- {
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
- // Call delete library function
- CmsError libraryError = ncAdapter.DeleteTool(id);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok();
- }
- }
-
- [Route("families"), HttpGet]
- public IHttpActionResult GetFamilies()
- {
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
- CmsError libraryError = ncAdapter.GetFamiliesData(out List families);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok(families);
- }
- }
-
- [Route("family"), HttpPost]
- public IHttpActionResult AddFamily([FromBody] DTOFamilyModel family)
- {
- if (String.IsNullOrEmpty(family.Name))
- return BadRequest();
-
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
- CmsError libraryError = ncAdapter.AddFamily(family.Name, out FamilyModel newFamily);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok(newFamily);
- }
- }
-
- [Route("family/{oldName}"), HttpPut]
- public IHttpActionResult PutFamily(string oldName, [FromBody]DTOFamilyModel family)
- {
- if (string.IsNullOrEmpty(family.Name))
- return BadRequest();
-
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
-
- CmsError libraryError = ncAdapter.UpdateFamilyName(oldName, family.Name);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok(family);
- }
- }
-
- [Route("family/{name}"), HttpDelete]
- public IHttpActionResult DeleteFamily(string name)
- {
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
- // Call delete library function
- CmsError libraryError = ncAdapter.DeleteFamily(name);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok();
- }
- }
-
- [Route("magazines_positions"), HttpGet]
- public IHttpActionResult GetMagazinesPositions()
- {
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
- CmsError libraryError = ncAdapter.GetMagazinesPositionsData(out List magazines);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok(magazines);
- }
- }
-
- [Route("magazine/{magazineId:int}/positions"), HttpGet]
- public IHttpActionResult GetMagazinePositions(int magazineId)
- {
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
- CmsError libraryError = ncAdapter.GetMagazinesPositionsData(out List magazines);
- // Filter by magazine id
- magazines = magazines.Where(x => x.MagazineId == magazineId).ToList();
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok(magazines);
- }
- }
-
- [Route("magazine/{magazineId}/position/{positionId}"), HttpPut]
- public IHttpActionResult PutMagazinePosition([Required]int magazineId, [Required]int positionId, [FromBody]DTOMagazinesPositionsModel magazinesPos)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
-
- // Create Library model
- PositionModel pos = new PositionModel()
- {
- PositionId = positionId,
- MagazineId = magazineId,
- Disabled = magazinesPos.Disabled
- };
- // Update
- CmsError libraryError = ncAdapter.UpdateMagazinePosition(pos);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok();
- }
- }
-
- [Route("shanks"), HttpGet]
- public IHttpActionResult GetShanks()
- {
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
- CmsError libraryError = ncAdapter.GetShanksData(out List shanks);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok(shanks);
- }
- }
-
- [Route("shank"), HttpPost]
- public IHttpActionResult AddShank([FromBody][Required] DTOShankModel dtoShank)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ShankModel shank = (ShankModel)dtoShank;
-
- ncAdapter.Connect();
- CmsError libraryError = ncAdapter.AddShank(ref shank);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok(shank);
- }
- }
-
- [Route("shank/{shankId:int}"), HttpPut]
- public IHttpActionResult UpdateShank(int shankId, [FromBody][Required] DTOShankModel dtoShank)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ShankModel shank = (ShankModel)dtoShank;
- shank.Id = shankId;
-
- ncAdapter.Connect();
- CmsError libraryError = ncAdapter.UpdateShank(ref shank);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok(shank);
- }
- }
-
- [Route("shank/{id:int}"), HttpDelete]
- public IHttpActionResult DeleteShank(int id)
- {
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
- // Call delete library function
- CmsError libraryError = ncAdapter.DeleteShank(id);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok();
- }
- }
-
- [Route("tool/{toolId:int}/edge"), HttpPost]
- public IHttpActionResult AddEdge(int toolId, [FromBody][Required]DTOEdgeModel dtoEdge)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- using (SiemensToolTableAdapter siemensHandler = new SiemensToolTableAdapter())
- {
- siemensHandler.Connect();
-
- EdgeModel edge = (EdgeModel)dtoEdge;
-
- // Call library add methods
- CmsError libraryError = siemensHandler.AddEdge(toolId, ref edge);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok(edge);
- }
- }
-
- [Route("tool/{toolId:int}/edge/{edgeId:int}"), HttpPut]
- public IHttpActionResult UpdateEdge(int toolId, int edgeId, [FromBody][Required]DTOEdgeModel dtoEdge)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
-
- EdgeModel edge = (EdgeModel)dtoEdge;
- edge.Id = edgeId;
-
- // Call library add methods
- CmsError libraryError = ncAdapter.UpdateEdge(toolId, ref edge);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok(edge);
- }
- }
-
- [Route("tool/{toolId:int}/edge/{edgeId:int}"), HttpDelete]
- public IHttpActionResult DeleteEdge(int toolId, int edgeId)
- {
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
- // Call delete library function
- CmsError libraryError = ncAdapter.DeleteEdge(toolId, edgeId);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok();
- }
- }
-
- [Route("magazine/{magazineId:int}/mounted_tools"), HttpGet]
- public IHttpActionResult GetMagazineTools(int magazineId)
- {
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
- // Call delete library function
- CmsError libraryError = ncAdapter.GetMagazinePositionsAndTools(magazineId, out List magazinePos);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok(magazinePos);
- }
- }
-
- [Route("magazine/available_tools"), HttpGet]
- public IHttpActionResult GetAvailableTools()
- {
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
- // Call delete library function
- CmsError libraryError = ncAdapter.GetNotInMagazinesTools(out List multiTools, out List tools);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok(new
- {
- MultiTools = multiTools,
- Tools = tools
- });
- }
- }
-
- [Route("magazine/{magazineId:int}/load/position/{positionId:int}"), HttpPut]
- public IHttpActionResult LoadToolInToMagazine(int magazineId, int positionId, [FromBody][Required] DTOSiemensUpdateMagazineModel toolId)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
- if (toolId.ToolId == 0)
- return BadRequest("error_incorrect_parameters");
-
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
-
- NewToolInMagazineModel libraryMag = new NewToolInMagazineModel { PositionId = positionId, ToolId = toolId.ToolId };
- // Call delete library function
- CmsError libraryError = ncAdapter.LoadToolInMagazine(magazineId, libraryMag, out MountedToolModel mounted);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok(mounted);
- }
- }
-
- [Route("magazine/{magazineId:int}/unload/position/{positionId:int}"), HttpPut]
- public IHttpActionResult UnloadToolFromMagazine(int magazineId, int positionId)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
-
- // Call delete library function
- CmsError libraryError = ncAdapter.UnloadToolInMagazine(magazineId, positionId);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok(new
- {
- magazineId,
- positionId,
- toolId = 0
- });
- }
- }
-
- [Route("shank/{shankId:int}/load/{positionId:int}/tool/{toolId:int}"), HttpPut]
- public IHttpActionResult LoadToolIntoShank(int shankId, int positionId, int toolId)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
-
- CmsError libraryError = ncAdapter.LoadTooolIntoShank(shankId, positionId, toolId);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok();
- }
- }
-
- [Route("shank/{shankId:int}/unload/{positionId:int}"), HttpPut]
- public IHttpActionResult UnloadToolFromShank(int shankId, int positionId)
- {
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- using (SiemensToolTableAdapter ncAdapter = new SiemensToolTableAdapter())
- {
- ncAdapter.Connect();
-
- CmsError libraryError = ncAdapter.UnloadTooolFromShank(shankId, positionId);
- if (libraryError.IsError())
- return BadRequest(libraryError.localizationKey);
-
- return Ok();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Thermo.Active/Listeners/Database/SignalRDatabaseHandler.cs b/Thermo.Active/Listeners/Database/SignalRDatabaseHandler.cs
index 70e6dca6..98d4876b 100644
--- a/Thermo.Active/Listeners/Database/SignalRDatabaseHandler.cs
+++ b/Thermo.Active/Listeners/Database/SignalRDatabaseHandler.cs
@@ -2,7 +2,6 @@
using Thermo.Active.Model.DatabaseModels;
using Thermo.Active.Model.DTOModels;
using Thermo.Active.Model.DTOModels.AlarmModels;
-using Thermo.Active.Model.DTOModels.ToolModels;
using Thermo.Active.NC;
using System.Collections.Generic;
using System.Linq;
@@ -14,71 +13,6 @@ namespace Thermo.Active.Listeners.Database
{
public static class SignalRDatabaseHandler
{
- public static void UpdateToolsData(object newData)
- {
- using (NcToolManagerController controller = new NcToolManagerController())
- {
- // Convert input parameter
- DTONewToolDataModel data = newData as DTONewToolDataModel;
- if(data == null)
- return;
-
- List updatedTools = new List();
- // Check if there are new data
- if (data.UpdatedLives.Count != 0 || data.UpdatedStatus.Count != 0)
- {
- List dbTools = controller.FindTools();
- if (dbTools.Count > 0)
- {
- // Loop through new data
- foreach (var live in data.UpdatedLives)
- {
- // Find tool and update residual life
- var tmp = dbTools
- .Where(x => x.ToolId == live.Key) // Get tool by id
- ?.Select(x =>
- {
- x.ResidualLife = (int)live.Value; // Update data
- return x;
- })
- .FirstOrDefault();
-
- if (tmp != null)
- updatedTools.Add(tmp);
- }
-
- foreach (var status in data.UpdatedStatus)
- {
- var tmp = dbTools
- .Where(x => x.ToolId == status.Key) // Get tool by id
- ?.Select(x =>
- {
- x.Status = UpdateStatus(x.Status, status.Value);
- return x;
- })
- .FirstOrDefault();
-
- if (tmp != null)
- updatedTools.Add(tmp);
- }
- }
-
- // Update database
- controller.UpdateToolsData(updatedTools);
-
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- ncAdapter.Connect();
- // Update nc data
- ncAdapter.UpdateNcTools(controller);
- }
-
- // I need to update tool in spindle data
- // Clean the heads cache, so the heads thread will be sent to the next cycle
- LastHeadsData = new List();
- }
- }
- }
private static byte UpdateStatus(byte oldValue, byte newValue)
{
@@ -234,62 +168,5 @@ namespace Thermo.Active.Listeners.Database
}
}
- public static void ManageAssistedToolingProcedure(object assTool)
- {
- DTOAssistedToolingEndValueModel assToolingData = assTool as DTOAssistedToolingEndValueModel;
- if (!LastToolingData.Equals(assToolingData))
- {
- LastToolingData = assToolingData;
- if (assToolingData != null && assToolingData.IsActive)
- {
- using (NcToolManagerController toolManager = new NcToolManagerController())
- {
- switch (assToolingData.Action)
- {
- case ASSISTED_TOOLING_ACTION.UNLOAD:
- {
- // Find shank loaded in the position
- var shank = toolManager.FindShanksByPositions(assToolingData.MagazineId, assToolingData.PositionId);
- if (shank != null)
- {
- // Unload Tool from magazine
- var pos = toolManager.UnloadShankInMagazine((byte)assToolingData.MagazineId, (byte)assToolingData.PositionId, shank);
- }
- }
- break;
-
- case ASSISTED_TOOLING_ACTION.EXCHANGE:
- {
- // Find shank loaded in the position
- var shankToUnload = toolManager.FindShanksByPositions(assToolingData.MagazineId, assToolingData.PositionId);
- if (shankToUnload != null)
- {
- // Unload Tool from magazine
- var pos = toolManager.UnloadShankInMagazine((byte)assToolingData.MagazineId, (byte)assToolingData.PositionId, shankToUnload);
- }
-
- // Find shank by toolId
- var shankToLoad = toolManager.FindShankByToolId(assToolingData.ToolId);
- if (shankToLoad != null)
- {
- // Load shank in magazine
- var pos = toolManager.LoadShankInMagazine((byte)assToolingData.MagazineId, (byte)assToolingData.PositionId, shankToLoad);
- }
- }
- break;
- }
-
- using (NcToolTableAdapter ncAdapter = new NcToolTableAdapter())
- {
- ncAdapter.Connect();
- // Close procedure
- ncAdapter.TerminateAssistedProcedure(assToolingData.MagazineId,
- assToolingData.Action != ASSISTED_TOOLING_ACTION.NONE
- );
- }
- }
- }
- }
- }
}
}
\ No newline at end of file
diff --git a/Thermo.Active/Listeners/ListenersHandler.cs b/Thermo.Active/Listeners/ListenersHandler.cs
index 0b86959b..5a440f41 100644
--- a/Thermo.Active/Listeners/ListenersHandler.cs
+++ b/Thermo.Active/Listeners/ListenersHandler.cs
@@ -69,18 +69,10 @@ namespace Thermo.Active.Listeners
{
SignalRListener.SendAxesToClient(a);
}));
- infos.Add(MessageServices.Current.Subscribe(SEND_MAGAZINES_STATUS, (a, b) =>
- {
- SignalRListener.SendMagazinesStatus(a);
- }));
infos.Add(MessageServices.Current.Subscribe(SEND_ACTIVE_PROGRAM_DATA, (a, b) =>
{
SignalRListener.SendActiveProgramData(a);
}));
- infos.Add(MessageServices.Current.Subscribe(NC_MAGAZINE_IS_ACTIVE, (a, b) =>
- {
- SignalRListener.SendNcMagazineIsActive(a);
- }));
infos.Add(MessageServices.Current.Subscribe(SEND_QUEUE_DATA, (a, b) =>
{
@@ -101,14 +93,7 @@ namespace Thermo.Active.Listeners
}));
//////////////////////////// Database
- infos.Add(MessageServices.Current.Subscribe(UPDATE_TOOLS_DATA, (a, b) =>
- {
- SignalRDatabaseHandler.UpdateToolsData(a);
- }));
- infos.Add(MessageServices.Current.Subscribe(ASSISTED_TOOLING_DATA, (a, b) =>
- {
- SignalRDatabaseHandler.ManageAssistedToolingProcedure(a);
- }));
+ ///// erano tooling...
// Broadcast
infos.Add(MessageServices.Current.Subscribe(BROADCAST_DATA, (a, b) =>
diff --git a/Thermo.Active/Listeners/SignalR/SignalRListener.cs b/Thermo.Active/Listeners/SignalR/SignalRListener.cs
index 1c18362f..f98376b0 100644
--- a/Thermo.Active/Listeners/SignalR/SignalRListener.cs
+++ b/Thermo.Active/Listeners/SignalR/SignalRListener.cs
@@ -5,7 +5,6 @@ using Thermo.Active.Database.Controllers;
using Thermo.Active.Model.DTOModels;
using Thermo.Active.Model.DTOModels.AlarmModels;
using Thermo.Active.Model.DTOModels.Scada;
-using Thermo.Active.Model.DTOModels.ToolModels;
using Thermo.Active.Utils;
using System;
using System.Collections.Generic;
@@ -164,37 +163,6 @@ namespace Thermo.Active.Listeners.SignalR
{
LastHeadsData = newData;
- using(NcToolManagerController controller = new NcToolManagerController())
- {
- foreach(var head in LastHeadsData)
- {
- // Check if head is a spindle
- if (head.Type == HEAD_TYPE.SPINDLE.ToString())
- {
- if (NcConfig.NcVendor.ToUpper() != NC_VENDOR.SIEMENS)
- {
- // Convert head into child model
- var spindle = (head as DTOSpindleModel);
- // Get tool data
- var tool = controller.FindToolWithDependencies(spindle.MountedTool);
- if (tool != null)
- spindle.ToolData = new DTOToolInSpindleModel()
- {
- FamilyId = tool.FamilyId,
- ShankId = tool.ShankId ?? 0,
- Broken = ((DTONcToolModel)tool).Broken,
- Disabled = ((DTONcToolModel)tool).Disabled,
- Measured = ((DTONcToolModel)tool).Measured,
- MaxLoad = tool.Family.MaxLoad,
- MaxSpeed = tool.Family.MaxSpeed,
- ResidualLife = tool.ResidualLife
- };
- }
- }
-
- }
- }
-
// Send data to clients
context.Clients.Group("ncData").headsData(heads);
}
@@ -214,17 +182,6 @@ namespace Thermo.Active.Listeners.SignalR
}
}
- public static void SendMagazinesStatus(object magazinesStatus)
- {
- var context = GlobalHost.ConnectionManager.GetHubContext();
- if (!LastMagazineStatus.Equals(magazinesStatus))
- {
- LastMagazineStatus = magazinesStatus as DTOMagazineActionModel;
-
- context.Clients.Group("ncData").magazinesStatus(magazinesStatus);
- }
- }
-
public static void SendActiveProgramData(object programData)
{
var context = GlobalHost.ConnectionManager.GetHubContext();
@@ -343,8 +300,6 @@ namespace Thermo.Active.Listeners.SignalR
context.Clients.Group("ncData").headsData(LastHeadsData);
// Send axesNames data
context.Clients.Group("ncData").axesNames(LastAxesNamesData);
- // Send magazine status
- context.Clients.Group("ncData").magazinesStatus(LastMagazineStatus);
// Send positions
context.Clients.Group("ncData").axesPositions(LastAxesPositions);
// Send active program data
diff --git a/Thermo.Active/Listeners/SignalRStaticObjects.cs b/Thermo.Active/Listeners/SignalRStaticObjects.cs
index 7b6c1ab5..9edb263d 100644
--- a/Thermo.Active/Listeners/SignalRStaticObjects.cs
+++ b/Thermo.Active/Listeners/SignalRStaticObjects.cs
@@ -1,7 +1,6 @@
using Thermo.Active.Model.DTOModels;
using Thermo.Active.Model.DTOModels.AlarmModels;
using Thermo.Active.Model.DTOModels.Scada;
-using Thermo.Active.Model.DTOModels.ToolModels;
using System.Collections.Generic;
namespace Thermo.Active.Listeners
@@ -20,14 +19,15 @@ namespace Thermo.Active.Listeners
public static List LastHeadsData = new List();
public static DTOAxesModel LastAxesPositions = new DTOAxesModel();
public static List LastAxesNamesData = new List();
- public static DTOMagazineActionModel LastMagazineStatus = new DTOMagazineActionModel();
public static DTOActiveProgramDataModel LastProgramData = new DTOActiveProgramDataModel();
public static Dictionary LastNcMagazineIsActive = new Dictionary();
public static List LastPartProgramQueue = new List();
public static List LastM155Data = new List();
- public static List LastScadaData = new List();
- public static DTOAssistedToolingEndValueModel LastToolingData = new DTOAssistedToolingEndValueModel();
+ public static List LastScadaData = new List();
public static bool LastIsNcConnected = false;
+
+
+ // aggiugere oggetti nuovi e levare quelli che non servono +...
}
}
\ No newline at end of file
diff --git a/Thermo.Active/Thermo.Active.csproj b/Thermo.Active/Thermo.Active.csproj
index 58781720..202aa333 100644
--- a/Thermo.Active/Thermo.Active.csproj
+++ b/Thermo.Active/Thermo.Active.csproj
@@ -225,10 +225,8 @@
-
-