Przeglądaj źródła

Stable version 2.0

ricardo valls 3 lat temu
rodzic
commit
0cc48b90d5
30 zmienionych plików z 672 dodań i 335 usunięć
  1. 7 2
      WorkerService1/WebApplication3/Clases/Constants.cs
  2. 2 0
      WorkerService1/WebApplication3/Clases/DatosPostAcuifero.cs
  3. 1 0
      WorkerService1/WebApplication3/Clases/Fichero.cs
  4. 108 55
      WorkerService1/WebApplication3/Clases/Parser.cs
  5. 9 0
      WorkerService1/WebApplication3/Clases/Proceso.cs
  6. 0 1
      WorkerService1/WebApplication3/Clases/QueueWorker.cs
  7. 2 1
      WorkerService1/WebApplication3/Clases/RechargeData.cs
  8. 16 8
      WorkerService1/WebApplication3/Clases/Utilities.cs
  9. 8 7
      WorkerService1/WebApplication3/Clases/WellData.cs
  10. 1 1
      WorkerService1/WebApplication3/Clases/Worker.cs
  11. 12 7
      WorkerService1/WebApplication3/Clases/ZoneData.cs
  12. 72 50
      WorkerService1/WebApplication3/Controllers/AcuiferoController.cs
  13. 2 0
      WorkerService1/WebApplication3/Controllers/BalanceHidricoController.cs
  14. 13 6
      WorkerService1/WebApplication3/Controllers/PiezometriaController.cs
  15. 62 52
      WorkerService1/WebApplication3/Controllers/PozoController.cs
  16. 99 10
      WorkerService1/WebApplication3/Controllers/RecargasController.cs
  17. 3 2
      WorkerService1/WebApplication3/Controllers/ServiceQueueController.cs
  18. 63 44
      WorkerService1/WebApplication3/Controllers/ServicioController.cs
  19. 138 81
      WorkerService1/WebApplication3/Controllers/SimulacionController.cs
  20. 5 4
      WorkerService1/WebApplication3/Controllers/TsPiezometerController.cs
  21. 3 2
      WorkerService1/WebApplication3/Controllers/TsPozoController.cs
  22. 3 2
      WorkerService1/WebApplication3/Controllers/TsRecargaController.cs
  23. 2 0
      WorkerService1/WebApplication3/Models/Acuifero.cs
  24. 14 0
      WorkerService1/WebApplication3/Models/AquiferContext.cs
  25. 1 0
      WorkerService1/WebApplication3/Models/DatosBalanceIn.cs
  26. 1 0
      WorkerService1/WebApplication3/Models/DatosBalanceOut.cs
  27. 20 0
      WorkerService1/WebApplication3/Models/Piezometer.cs
  28. 2 0
      WorkerService1/WebApplication3/Models/Pozo.cs
  29. 2 0
      WorkerService1/WebApplication3/Models/Simulacion.cs
  30. 1 0
      WorkerService1/WebApplication3/Models/TSPozo.cs

+ 7 - 2
WorkerService1/WebApplication3/Clases/Constants.cs Wyświetl plik

@@ -7,8 +7,10 @@ namespace WebApplication3.Clases
7 7
 {
8 8
     public static class Constants
9 9
     {
10
-        public const string PathZip = @"C:\Users\Admin\Desktop\";
11
-        public const string PathExtract = @"C:\Users\Admin\Desktop\TestExtract\";
10
+        //public const string PathZip = @"C:\Users\Admin\Desktop\";
11
+        public const string PathZip = @"C:\Users\Admin\Documents\modflow_models\";
12
+        //public const string PathExtract = @"C:\Users\Admin\Desktop\TestExtract\";
13
+        public const string PathExtract = @"C:\Users\Admin\Documents\modflow_models\temp\";
12 14
         public const string PathModflow = @"C:\Users\Admin\Downloads\MF2005.1_12\MF2005.1_12\bin\mf2005.exe";
13 15
         public static readonly Dictionary<string, string> _recharge_geometry_colors = new()
14 16
         {
@@ -21,5 +23,8 @@ namespace WebApplication3.Clases
21 23
             { "7", "#660099" },
22 24
             { "8", "#266A2E" }
23 25
         };
26
+        public const string SVGFileName = "vector_image.svg";
27
+        public const string PNGFileName = "color_map.png";
28
+        public const string GeoJsonFileName = "vector_image.geojson";
24 29
     }
25 30
 }

+ 2 - 0
WorkerService1/WebApplication3/Clases/DatosPostAcuifero.cs Wyświetl plik

@@ -1,4 +1,5 @@
1 1
 using System;
2
+using System.Collections;
2 3
 using System.Collections.Generic;
3 4
 using System.Linq;
4 5
 using System.Threading.Tasks;
@@ -9,5 +10,6 @@ namespace WebApplication3.Clases
9 10
     {
10 11
         public string Nombre { get; set; }
11 12
         public Fichero Fichero { get; set; }
13
+        
12 14
     }
13 15
 }

+ 1 - 0
WorkerService1/WebApplication3/Clases/Fichero.cs Wyświetl plik

@@ -9,5 +9,6 @@ namespace WebApplication3.Clases
9 9
     {
10 10
         public string Nombre { get; set; }
11 11
         public string Base64 { get; set; }
12
+        public byte[] Test { get; set; }
12 13
     }
13 14
 }

+ 108 - 55
WorkerService1/WebApplication3/Clases/Parser.cs Wyświetl plik

@@ -75,12 +75,14 @@ namespace WebApplication3.Clases
75 75
                                 //cont += (wellData[index].ScreenIntervals * 2) - 1;
76 76
                                 intervalSkipped = true;
77 77
                                 //leemos tantas lineas hay como intervalos de pantalla (al ser 2 parametros por cada intervalo es nIntervalos * 2
78
-                                //for (int i = 0; i < wellData[index].ScreenIntervals * 2; i++)
78
+                                List<string> linesAux = new();
79 79
                                 for (int i = 0; i < wellData.ScreenIntervals * 2; i++)
80 80
                                 {
81
-                                    file.ReadLine();
81
+                                    linesAux.Add(file.ReadLine());
82 82
                                     cont++;
83 83
                                 }
84
+                                wellData.Bot = linesAux[0];
85
+                                wellData.Top = linesAux[1];
84 86
 
85 87
                                 break;
86 88
                             default:
@@ -101,18 +103,19 @@ namespace WebApplication3.Clases
101 103
                         else
102 104
                         {
103 105
                             TimeSerieInterno ts = new TimeSerieInterno();
104
-                            string aux = "";
106
+                            //string aux = "";
105 107
                             //Rate rate = new Rate();
106 108
                             ts.Hora = ln;
107 109
                             //rate.StartTime = float.Parse(ln.Replace('.', ','));
108 110
 
109 111
                             ln = file.ReadLine();
112
+                            ts.HoraEnd = ln;
110 113
                             cont++;
111 114
                             
112
-                            if(cont == finalBloque - 1)
113
-                            {
114
-                                aux = ln;
115
-                            }
115
+                            //if(cont == finalBloque - 1)
116
+                            //{
117
+                            //    aux = ln;
118
+                            //}
116 119
 
117 120
                             ln = file.ReadLine();
118 121
                             cont++;
@@ -127,14 +130,14 @@ namespace WebApplication3.Clases
127 130
                             //wellData[index].Rates.Add(rate);
128 131
                             wellData.Rates.Add(ts);
129 132
 
130
-                            if(aux != "")
131
-                            {
132
-                                ts = new TimeSerieInterno();
133
-                                ts.Hora = aux;
134
-                                ts.Valor = value;
135
-                                ts.Info = ln.Replace(exploded[0] + ' ', "");
136
-                                wellData.Rates.Add(ts);
137
-                            }
133
+                            //if(aux != "")
134
+                            //{
135
+                            //    ts = new TimeSerieInterno();
136
+                            //    ts.Hora = aux;
137
+                            //    ts.Valor = value;
138
+                            //    ts.Info = ln.Replace(exploded[0] + ' ', "");
139
+                            //    wellData.Rates.Add(ts);
140
+                            //}
138 141
                         }
139 142
                     }
140 143
 
@@ -180,14 +183,14 @@ namespace WebApplication3.Clases
180 183
                 Console.WriteLine(data[rechargeBlockInex]);
181 184
                 string[] explode = data[rechargeBlockInex].Split("\r\n");
182 185
 
183
-                for(int i = 3; i < explode.Length; i++)
186
+                for (int i = 1; i < explode.Length; i++)
184 187
                 {
185 188
                     string[] values = explode[i].Split(" ", StringSplitOptions.RemoveEmptyEntries);
186 189
 
187 190
                     //Si hay cambio de propiedad se crea otro RechargeData
188
-                    if(rechargeProperty != values[0])
191
+                    if (rechargeProperty != values[0])
189 192
                     {
190
-                        if(rechargeProperty != "")
193
+                        if (rechargeProperty != "")
191 194
                         {
192 195
                             recharges.Add(rechargeData);
193 196
                         }
@@ -195,24 +198,28 @@ namespace WebApplication3.Clases
195 198
                         rechargeData = new RechargeData();
196 199
                         rechargeData.Nombre = "Recarga_" + values[0];
197 200
                         rechargeProperty = values[0];
201
+                        //Al hacer el cambio
202
+                        i += 2;
203
+                        values = explode[i].Split(" ", StringSplitOptions.RemoveEmptyEntries);
198 204
                     }
199 205
 
200 206
                     timeSerie = new TimeSerieInterno();
201 207
                     timeSerie.Hora = values[2];
208
+                    timeSerie.HoraEnd = values[3];
202 209
                     timeSerie.Valor = values[1];
203 210
                     timeSerie.Info = values[4] + " " + values[5];
204 211
 
205 212
                     rechargeData.Rates.Add(timeSerie);
206 213
                     
207
-                    //se anyade el ultimo registro de tiempo ya que solo nos quedamos con la primera marca de tiempo de cada linea
208
-                    if(i == explode.Length - 1)
209
-                    {
210
-                        timeSerie = new TimeSerieInterno();
211
-                        timeSerie.Hora = values[3];
212
-                        timeSerie.Valor = values[1];
213
-                        timeSerie.Info = values[4] + " " + values[5];
214
-                        rechargeData.Rates.Add(timeSerie);
215
-                    }
214
+                    ////se anyade el ultimo registro de tiempo ya que solo nos quedamos con la primera marca de tiempo de cada linea
215
+                    //if(i == explode.Length - 1)
216
+                    //{
217
+                    //    timeSerie = new TimeSerieInterno();
218
+                    //    timeSerie.Hora = values[3];
219
+                    //    timeSerie.Valor = values[1];
220
+                    //    timeSerie.Info = values[4] + " " + values[5];
221
+                    //    rechargeData.Rates.Add(timeSerie);
222
+                    //}
216 223
                 }
217 224
                 recharge_geometry = data[rechargeBlockInex + layers];
218 225
 
@@ -244,6 +251,17 @@ namespace WebApplication3.Clases
244 251
 
245 252
             aux.RemoveAll(x => x.Contains("WHS") || x.Contains("NDC") || x.Contains("CLB") || x == "");
246 253
 
254
+            List<string> units = new();
255
+            foreach (string row in aux)
256
+            {
257
+                if (!aux.Contains("LIST"))
258
+                {
259
+                    string[] rowSplit = row.Split(" ", StringSplitOptions.RemoveEmptyEntries);
260
+
261
+                    units.Add(rowSplit[1]);
262
+                }
263
+            }
264
+
247 265
             foreach (string row in aux)
248 266
             {
249 267
                 string[] rowSplit = row.Split(" ", StringSplitOptions.RemoveEmptyEntries);
@@ -251,7 +269,22 @@ namespace WebApplication3.Clases
251 269
 
252 270
                 if (rowSplit[0] == "LIST" && int.Parse(rowSplit[1]) < 10)
253 271
                 {
254
-                    rowSplit[1] = "12";
272
+                    if (!units.Contains("11"))
273
+                    {
274
+                        rowSplit[1] = "11";
275
+                    } 
276
+                    else if (!units.Contains("12"))
277
+                    {
278
+                        rowSplit[1] = "12";
279
+                    }
280
+                    else if (!units.Contains("13"))
281
+                    {
282
+                        rowSplit[1] = "13";
283
+                    }
284
+                    else if (!units.Contains("14"))
285
+                    {
286
+                        rowSplit[1] = "14";
287
+                    }
255 288
                 }
256 289
 
257 290
                 //Se tiene que parsear la 3a parte del string porque contiene la ruta absoluta del ordenador donde se han originado los ficheros
@@ -419,7 +452,7 @@ namespace WebApplication3.Clases
419 452
 
420 453
         public ZoneBalance[] ParseWholeModelBalance(string textfile)
421 454
         {
422
-            
455
+
423 456
             string text = File.ReadAllText(textfile);
424 457
             string[] data = text.Split(" DRAWDOWN WILL BE SAVED ON UNIT  151 AT END OF TIME STEP   10, STRESS PERIOD", StringSplitOptions.RemoveEmptyEntries);
425 458
 
@@ -440,59 +473,77 @@ namespace WebApplication3.Clases
440 473
                 current.Type = 2;
441 474
 
442 475
 
443
-                List<string> data_aux = data[i].Split("\r\n").ToList();
444
-                string[] split = data_aux[2].Split("STRESS PERIOD");
476
+                List<string> data_aux = data[i].Split("\r\n", StringSplitOptions.RemoveEmptyEntries).ToList();
477
+                string[] split = data_aux[2].Split("STRESS PERIOD", StringSplitOptions.RemoveEmptyEntries);
445 478
 
446 479
 
447 480
                 #region IN
448
-                split = data_aux[10].Split("STORAGE =", StringSplitOptions.RemoveEmptyEntries);
481
+                split = data_aux[8].Split("STORAGE =", StringSplitOptions.RemoveEmptyEntries);
449 482
                 cummulative.In.Storage = split[1].Trim();
450 483
                 current.In.Storage = split[2].Trim();
451 484
 
452
-                split = data_aux[11].Split("CONSTANT HEAD =", StringSplitOptions.RemoveEmptyEntries);
485
+                split = data_aux[9].Split("CONSTANT HEAD =", StringSplitOptions.RemoveEmptyEntries);
453 486
                 cummulative.In.ConstantHead = split[1].Trim();
454 487
                 current.In.ConstantHead = split[2].Trim();
455 488
 
456
-                split = data_aux[12].Split("DRAINS =", StringSplitOptions.RemoveEmptyEntries);
457
-                cummulative.In.Drains = split[1].Trim();
458
-                current.In.Drains = split[2].Trim();
489
+                if (data_aux[10].Contains("DRAINS"))
490
+                {
491
+                    split = data_aux[10].Split("DRAINS =", StringSplitOptions.RemoveEmptyEntries);
492
+                    cummulative.In.Drains = split[1].Trim();
493
+                    current.In.Drains = split[2].Trim();
494
+                }
495
+                else
496
+                {
497
+                    split = data_aux[10].Split("WELLS =", StringSplitOptions.RemoveEmptyEntries);
498
+                    cummulative.In.Wells = split[1].Trim();
499
+                    current.In.Wells = split[2].Trim();
500
+                }
459 501
 
460
-                split = data_aux[13].Split("RECHARGE =", StringSplitOptions.RemoveEmptyEntries);
502
+                split = data_aux[11].Split("RECHARGE =", StringSplitOptions.RemoveEmptyEntries);
461 503
                 cummulative.In.Recharge = split[1].Trim();
462 504
                 current.In.Recharge = split[2].Trim();
463 505
 
464
-                split = data_aux[15].Split("TOTAL IN =", StringSplitOptions.RemoveEmptyEntries);
506
+                split = data_aux[13].Split("TOTAL IN =", StringSplitOptions.RemoveEmptyEntries);
465 507
                 cummulative.In.Total = split[1].Trim();
466 508
                 current.In.Total = split[2].Trim();
467 509
                 #endregion
468 510
 
469 511
                 #region OUT
470
-                split = data_aux[19].Split("STORAGE =", StringSplitOptions.RemoveEmptyEntries);
512
+                split = data_aux[16].Split("STORAGE =", StringSplitOptions.RemoveEmptyEntries);
471 513
                 cummulative.Out.Storage = split[1].Trim();
472 514
                 current.Out.Storage = split[2].Trim();
473 515
 
474
-                split = data_aux[20].Split("CONSTANT HEAD =", StringSplitOptions.RemoveEmptyEntries);
516
+                split = data_aux[17].Split("CONSTANT HEAD =", StringSplitOptions.RemoveEmptyEntries);
475 517
                 cummulative.Out.ConstantHead = split[1].Trim();
476 518
                 current.Out.ConstantHead = split[2].Trim();
477 519
 
478
-                split = data_aux[21].Split("DRAINS =", StringSplitOptions.RemoveEmptyEntries);
479
-                cummulative.Out.Drains = split[1].Trim();
480
-                current.Out.Drains = split[2].Trim();
520
+                if (data_aux[18].Contains("DRAINS"))
521
+                {
522
+                    split = data_aux[18].Split("DRAINS =", StringSplitOptions.RemoveEmptyEntries);
523
+                    cummulative.Out.Drains = split[1].Trim();
524
+                    current.Out.Drains = split[2].Trim();
525
+                }
526
+                else
527
+                {
528
+                    split = data_aux[18].Split("WELLS =", StringSplitOptions.RemoveEmptyEntries);
529
+                    cummulative.Out.Wells = split[1].Trim();
530
+                    current.Out.Wells = split[2].Trim();
531
+                }
481 532
 
482
-                split = data_aux[22].Split("RECHARGE =", StringSplitOptions.RemoveEmptyEntries);
533
+                split = data_aux[19].Split("RECHARGE =", StringSplitOptions.RemoveEmptyEntries);
483 534
                 cummulative.Out.Recharge = split[1].Trim();
484 535
                 current.Out.Recharge = split[2].Trim();
485 536
 
486
-                split = data_aux[24].Split("TOTAL OUT =", StringSplitOptions.RemoveEmptyEntries);
537
+                split = data_aux[21].Split("TOTAL OUT =", StringSplitOptions.RemoveEmptyEntries);
487 538
                 cummulative.Out.Total = split[1].Trim();
488 539
                 current.Out.Total = split[2].Trim();
489 540
                 #endregion
490 541
 
491
-                split = data_aux[26].Split("IN - OUT =", StringSplitOptions.RemoveEmptyEntries);
542
+                split = data_aux[22].Split("IN - OUT =", StringSplitOptions.RemoveEmptyEntries);
492 543
                 cummulative.TotalInOut = split[1].Trim();
493 544
                 current.TotalInOut = split[2].Trim();
494 545
 
495
-                split = data_aux[28].Split("PERCENT DISCREPANCY =", StringSplitOptions.RemoveEmptyEntries);
546
+                split = data_aux[23].Split("PERCENT DISCREPANCY =", StringSplitOptions.RemoveEmptyEntries);
496 547
                 cummulative.PercentDiscrepancy = split[1].Trim();
497 548
                 current.PercentDiscrepancy = split[2].Trim();
498 549
 
@@ -569,6 +620,8 @@ namespace WebApplication3.Clases
569 620
                             piezometria.Add(p);
570 621
                             
571 622
                         }
623
+
624
+                        Logger.WriteLog("Ya se ha leido el fichero");
572 625
                     }
573 626
                 }catch(Exception ex)
574 627
                 {
@@ -584,17 +637,17 @@ namespace WebApplication3.Clases
584 637
 
585 638
             string text = File.ReadAllText(file);
586 639
 
587
-            List<string> data = text.Split("\r\n").ToList();
640
+            List<string> data = text.Split("\r\n", StringSplitOptions.RemoveEmptyEntries).ToList();
588 641
             //string geolocationData = data[2];
589
-            string geolocation_line = data.Find(x=> x.Contains("<Georeference"));
642
+            string geolocation_line = data.Find(x => x.Contains("<Georeference"));
643
+
644
+            string[] geolocation_data = geolocation_line.Split(" ", StringSplitOptions.RemoveEmptyEntries);
645
+            string[] world_origin_x = geolocation_data[3].Split("World_Origin_X=", StringSplitOptions.RemoveEmptyEntries);
646
+            string[] world_origin_y = geolocation_data[4].Split("World_Origin_Y=", StringSplitOptions.RemoveEmptyEntries);
590 647
 
591
-            string[] geolocation_data = geolocation_line.Split(" ");
592
-            string[] world_origin_x = geolocation_data[1].Split("=");
593
-            string[] world_origin_y = geolocation_data[2].Split("=");
594 648
 
595
-            
596
-            worldX = world_origin_x[1].Replace("\"",string.Empty);
597
-            worldY = world_origin_y[1].Replace("\"",string.Empty);
649
+            worldX = world_origin_x[0].Replace("\"", string.Empty);
650
+            worldY = world_origin_y[0].Replace("\"", string.Empty);
598 651
         }
599 652
 
600 653
         public WellData[] parseWellCSV(string file)

+ 9 - 0
WorkerService1/WebApplication3/Clases/Proceso.cs Wyświetl plik

@@ -55,6 +55,15 @@ namespace WebApplication3.Clases
55 55
             proceso.StartInfo.Arguments = script+" "+headFile+" "+rows+" "+cols+" "+isolines;
56 56
             proceso.StartInfo.UseShellExecute = false;
57 57
         }
58
+
59
+        public void SetParametersSVG2Json(string workingDirectory, string fileName)
60
+        {
61
+            proceso.StartInfo.WorkingDirectory = workingDirectory;
62
+            proceso.StartInfo.FileName = "svg2geojson";
63
+            proceso.StartInfo.Arguments = fileName;
64
+            proceso.StartInfo.UseShellExecute = false;
65
+
66
+        }
58 67
         public int GetPid()
59 68
         {
60 69
             return proceso.Id;

+ 0 - 1
WorkerService1/WebApplication3/Clases/QueueWorker.cs Wyświetl plik

@@ -22,7 +22,6 @@ namespace WebApplication3.Clases
22 22
             _logger = logger;
23 23
 
24 24
             var aquiferContext = new AquiferContext();
25
-            servicioController = new ServicioController(aquiferContext);
26 25
             simulacionController = new SimulacionController(aquiferContext);
27 26
             serviceQueueController = new ServiceQueueController(aquiferContext);
28 27
         }

+ 2 - 1
WorkerService1/WebApplication3/Clases/RechargeData.cs Wyświetl plik

@@ -15,11 +15,12 @@ namespace WebApplication3.Clases
15 15
         public string Nombre { get; set; }
16 16
         public List<TimeSerieInterno> Rates { get; set; }
17 17
 
18
-        public Recarga ToRecarga(uint acuifero)
18
+        public Recarga ToRecarga(uint acuifero,uint simId)
19 19
         {
20 20
             Recarga recarga = new Recarga();
21 21
 
22 22
             recarga.IdAcuifero = acuifero;
23
+            recarga.IdSimulacion = simId;
23 24
             recarga.Nombre = this.Nombre;
24 25
 
25 26
             return recarga;

+ 16 - 8
WorkerService1/WebApplication3/Clases/Utilities.cs Wyświetl plik

@@ -2,6 +2,7 @@
2 2
 using System.Collections.Generic;
3 3
 using System.Drawing;
4 4
 using System.Drawing.Imaging;
5
+using System.IO;
5 6
 using System.Linq;
6 7
 using System.Threading.Tasks;
7 8
 
@@ -9,18 +10,15 @@ namespace WebApplication3.Clases
9 10
 {
10 11
     public static class Utilities
11 12
     {
12
-        public static bool String2Png(string data)
13
+        public static string String2Png(string data)
13 14
         {
14
-            Logger.WriteLog("im in");
15
-            bool result = true;
16 15
             List<string> rows = data.Split("\r\n",StringSplitOptions.RemoveEmptyEntries).ToList<string>();
17
-            Logger.WriteLog("rows has a lenght of" + rows.Count);
18 16
             List<string> cols = rows[0].Split(" ",StringSplitOptions.RemoveEmptyEntries).ToList<string>();
19
-            Logger.WriteLog("cols has a length of " + cols.Count);
20 17
             int width = cols.Count;
21 18
             int height = rows.Count;
22 19
             int[,] integers = new int[height, width];
23 20
             int stride = width * 4;
21
+            string fileName = @"C:\Users\Admin\Desktop\AAAA\green.png";
24 22
 
25 23
             string[,] array2Db = new string[height, width];
26 24
             for(int i= 0; i < height; i++)
@@ -34,7 +32,6 @@ namespace WebApplication3.Clases
34 32
             }
35 33
 
36 34
             // Fill array with random values
37
-            Random random = new Random();
38 35
             for (int x = 0; x < height; ++x)
39 36
             {
40 37
                 for (int y = 0; y < width; ++y)
@@ -57,9 +54,20 @@ namespace WebApplication3.Clases
57 54
 
58 55
             using (b)
59 56
             {
60
-                b.Save(@"C:\Users\Admin\Desktop\AAAA\green.png", ImageFormat.Png);
57
+                b.Save(fileName, ImageFormat.Png);
58
+            }
59
+            return fileName;
60
+        }
61
+
62
+        public static void BinaryToFile(byte[] ba, string fileName)
63
+        {
64
+            using (FileStream fs = new FileStream(fileName, FileMode.Create))
65
+            {
66
+                using (BinaryWriter bw = new BinaryWriter(fs))
67
+                {
68
+                    bw.Write(ba);
69
+                }
61 70
             }
62
-            return result;
63 71
         }
64 72
     }
65 73
 }

+ 8 - 7
WorkerService1/WebApplication3/Clases/WellData.cs Wyświetl plik

@@ -30,23 +30,24 @@ namespace WebApplication3.Clases
30 30
         public string Bot { get; set; }
31 31
         public string Top { get; set; }
32 32
         public int PumpPeriods { get; set; }
33
+        
33 34
         public List<TimeSerieInterno> Rates { get; set; }
34 35
         
35 36
 
36 37
 
37
-        public Pozo ToPozo(uint acuifero)
38
+        public Pozo ToPozo(uint acuifero, uint simId)
38 39
         {
39 40
             Pozo p = new Pozo();
40
-
41 41
             p.IdAquifero = acuifero;
42
-            p.IdSimulacion = null;
43
-            p.Longitud = this.X;
44
-            p.Latitud = this.Y;
42
+            p.IdSimulacion = simId;
43
+            p.X = this.X;
44
+            p.Y = this.Y;
45 45
             //p.Maximo = float.Parse(this.ZMax);
46
-            p.Maximo = "0";
46
+            p.Maximo = ZMax;
47 47
             //p.Minimo = float.Parse(this.ZMin);
48
-            p.Minimo = "0";
48
+            p.Minimo = ZMin;
49 49
             p.Nombre = this.WellName;
50
+            p.Active = (this.ActiveFlag) ? (uint)1 : (uint)0;
50 51
             return p;
51 52
         }
52 53
 

+ 1 - 1
WorkerService1/WebApplication3/Clases/Worker.cs Wyświetl plik

@@ -42,7 +42,7 @@ namespace WebApplication3.Clases
42 42
                         proceso.Started = false;
43 43
                         proceso.Detected = true;
44 44
 
45
-                        int terminado = await servicioController.setTerminado(proceso.GetPid());
45
+                        int terminado = await servicioController.SetTerminado(proceso.GetPid());
46 46
                         
47 47
                         if( terminado > 0)
48 48
                         {

+ 12 - 7
WorkerService1/WebApplication3/Clases/ZoneData.cs Wyświetl plik

@@ -12,6 +12,7 @@ namespace WebApplication3.Clases
12 12
         public string Storage { get; set; }
13 13
         public string ConstantHead { get; set; }
14 14
         public string Drains { get; set; }
15
+        public string Wells { get; set; }
15 16
         public string Recharge { get; set; }
16 17
         public string Total { get; set; }
17 18
 
@@ -33,19 +34,21 @@ namespace WebApplication3.Clases
33 34
             Storage = dataIn.Storage;
34 35
             ConstantHead = dataIn.ConstantHead;
35 36
             Drains = dataIn.Drains;
37
+            Wells = dataIn.Wells;
36 38
             Recharge = dataIn.Recharge;
37 39
             Total = dataIn.Total;
38 40
             ZoneConnections = new List<ZoneConnection>();
39 41
         }
40 42
 
41
-        public ZoneData(DatosBalanceOut dataIn)
43
+        public ZoneData(DatosBalanceOut dataOut)
42 44
         {
43
-            Id = dataIn.Id;
44
-            Storage = dataIn.Storage;
45
-            ConstantHead = dataIn.ConstantHead;
46
-            Drains = dataIn.Drains;
47
-            Recharge = dataIn.Recharge;
48
-            Total = dataIn.Total;
45
+            Id = dataOut.Id;
46
+            Storage = dataOut.Storage;
47
+            ConstantHead = dataOut.ConstantHead;
48
+            Drains = dataOut.Drains;
49
+            Wells = dataOut.Wells;
50
+            Recharge = dataOut.Recharge;
51
+            Total = dataOut.Total;
49 52
             ZoneConnections = new List<ZoneConnection>();
50 53
         }
51 54
 
@@ -55,6 +58,7 @@ namespace WebApplication3.Clases
55 58
             datosIn.Storage = this.Storage;
56 59
             datosIn.ConstantHead = this.ConstantHead;
57 60
             datosIn.Drains = this.Drains;
61
+            datosIn.Wells = this.Wells;
58 62
             datosIn.Recharge = this.Recharge;
59 63
             datosIn.Total = this.Total;
60 64
             datosIn.IdBalance = idBalance;
@@ -68,6 +72,7 @@ namespace WebApplication3.Clases
68 72
             datosOut.Storage = this.Storage;
69 73
             datosOut.ConstantHead = this.ConstantHead;
70 74
             datosOut.Drains = this.Drains;
75
+            datosOut.Wells = this.Wells;
71 76
             datosOut.Recharge = this.Recharge;
72 77
             datosOut.Total = this.Total;
73 78
             datosOut.IdBalance = idBalance;

+ 72 - 50
WorkerService1/WebApplication3/Controllers/AcuiferoController.cs Wyświetl plik

@@ -38,6 +38,8 @@ namespace WebApplication3.Controllers
38 38
 
39 39
         // GET: api/Acuifero/5
40 40
         [HttpGet("{id}")]
41
+        [ProducesResponseType(200)]
42
+        [ProducesResponseType(404)]
41 43
         public async Task<ActionResult<Acuifero>> GetAcuifero(uint id)
42 44
         {
43 45
             var acuifero = await _context.Acuiferos.FindAsync(id);
@@ -50,18 +52,20 @@ namespace WebApplication3.Controllers
50 52
             return acuifero;
51 53
         }
52 54
 
53
-        [HttpGet("GeoRecharge/{id}")]
54
-        public async Task<bool> GetRechargeColorMap(uint id)
55
+        [HttpGet("ColorMap/{id}")]
56
+        public async Task<ActionResult<string>> GetRechargeColorMap(uint id)
55 57
         {
56 58
             Acuifero aquifer = await _context.Acuiferos.FindAsync(id);
57 59
 
58
-            return Utilities.String2Png(aquifer.RechargeGeometry);
59
-
60
+            return Ok(aquifer.RechargeColorMap);
60 61
         }
61 62
 
62 63
         // PUT: api/Acuifero/5
63 64
         // To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
64 65
         [HttpPut("{id}")]
66
+        [ProducesResponseType(200)]
67
+        [ProducesResponseType(400)]
68
+        [ProducesResponseType(404)]
65 69
         public async Task<IActionResult> PutAcuifero(uint id, [FromBody] DatosPostAcuifero datos)
66 70
         {
67 71
 
@@ -99,6 +103,7 @@ namespace WebApplication3.Controllers
99 103
                 await _context.SaveChangesAsync();
100 104
                 Pozo[] pozos = pozoController.GetPozosAcuiferoSimulacionInicial(acuifero.Id);
101 105
                 Recarga[] recargas = recargaController.GetRecargasAcuiferoSimulacionInicial(acuifero.Id);
106
+                uint simId = GetSimZeroId(acuifero.Id);
102 107
 
103 108
                 foreach (Pozo p in pozos)
104 109
                 {
@@ -119,12 +124,12 @@ namespace WebApplication3.Controllers
119 124
                 //3- Parseamos pozos
120 125
                 if (System.IO.File.Exists(pozoFile))
121 126
                 {
122
-                    await pozoController.ParseoFichero(acuifero.Id, pozoFile);
127
+                    await pozoController.ParseoFichero(acuifero.Id, pozoFile,simId);
123 128
                 }
124 129
                 //4- Parseamos recargas
125 130
                 if (System.IO.File.Exists(recargaFile))
126 131
                 {
127
-                    await recargaController.ParseoFichero(acuifero.Id, recargaFile);
132
+                    await recargaController.ParseoFichero(acuifero.Id, recargaFile,simId);
128 133
                 }
129 134
 
130 135
             }
@@ -143,29 +148,55 @@ namespace WebApplication3.Controllers
143 148
             return CreatedAtAction("GetAcuifero", new { id = acuifero.Id }, acuifero);
144 149
         }
145 150
 
151
+        [NonAction]
152
+        public uint GetSimZeroId(uint aquiferId)
153
+        {
154
+            var sim = _context.Simulaciones.Where(x => x.IdAcuifero == aquiferId && x.SimulacionAcuifero == 0).First();
155
+
156
+            return sim.Id;
157
+        }
158
+
159
+        [HttpPost("TestBinary")]
160
+        public bool TestBinario([FromBody] DatosPostAcuifero datos)
161
+        {
162
+            string file = Constants.PathZip + "test.zip";
163
+            Utilities.BinaryToFile(datos.Fichero.Test, file);
164
+
165
+            if (System.IO.File.Exists(file)) 
166
+            {
167
+                return true;
168
+            }
169
+            else
170
+            {
171
+                return false;
172
+            }
173
+
174
+        }
146 175
         // POST: api/Acuifero
147 176
         // To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
148 177
         [HttpPost]
178
+        [ProducesResponseType(201)]
179
+        [ProducesResponseType(409)]
149 180
         public async Task<ActionResult<Acuifero>> PostAcuifero([FromBody] DatosPostAcuifero datos)
150 181
         {
151
-            Acuifero acuifero = new Acuifero();
182
+            Acuifero acuifero = new ();
152 183
             acuifero.Nombre = datos.Nombre;
153
-            string pathZip = @"C:\Users\Admin\Desktop\";
154
-            string pathExtract = @"C:\Users\Admin\Desktop\TestExtract\";
184
+            //string pathZip = @"C:\Users\Admin\Desktop\";
185
+            //string pathExtract = @"C:\Users\Admin\Desktop\TestExtract\";
155 186
             string pozoFile, recargaFile;
156 187
             List<string> files;
157 188
             Parser parser = new();
158 189
 
159
-            try
160
-            {
161
-                byte[] tempBytes = Convert.FromBase64String(datos.Fichero.Base64);
162
-                System.IO.File.WriteAllBytes(pathZip + datos.Fichero.Nombre, tempBytes);
190
+            //try
191
+            //{
192
+            //    byte[] tempBytes = Convert.FromBase64String(datos.Fichero.Base64);
193
+            //    System.IO.File.WriteAllBytes(Constants.PathZip + datos.Fichero.Nombre, tempBytes);
163 194
 
164
-            }
165
-            catch (Exception ex)
166
-            {
167
-                return Problem(ex.Message);
168
-            }
195
+            //}
196
+            //catch (Exception ex)
197
+            //{
198
+            //    return Problem(ex.Message);
199
+            //}
169 200
 
170 201
             acuifero.Fichero = datos.Fichero.Nombre;
171 202
 
@@ -174,10 +205,11 @@ namespace WebApplication3.Controllers
174 205
 
175 206
                 //Como se crea el acuifero, no tiene simulacion 0, por lo que se insertan los datos de los pozos y recargas
176 207
                 //1- Descomprimimos el fichero zip
177
-                ZipFile.ExtractToDirectory(pathZip + datos.Fichero.Nombre, pathExtract, true);
178
-                files = Directory.GetFiles(pathExtract).ToList<string>();
208
+                ZipFile.ExtractToDirectory(Constants.PathZip + datos.Fichero.Nombre, Constants.PathExtract, true);
209
+                files = Directory.GetFiles(Constants.PathExtract+datos.Nombre).ToList<string>();
179 210
                 //1.2 - Obtencion de coordenadas de origen (en el mundo) del modelo
180 211
                 string geoFile = files.Find(x => x.Contains(".vmf"));
212
+                Logger.WriteLog("geofile " + geoFile);
181 213
                 string world_origin_x, world_origin_y;
182 214
 
183 215
                 parser.GetGeolocalizationFromFile(geoFile, out world_origin_x, out world_origin_y);
@@ -188,6 +220,12 @@ namespace WebApplication3.Controllers
188 220
                 _context.Acuiferos.Add(acuifero);
189 221
                 await _context.SaveChangesAsync();
190 222
 
223
+                Simulacion sim = new ();
224
+                sim.IdAcuifero = acuifero.Id;
225
+                sim.Nombre = "Sim_0";
226
+                sim.SimulacionAcuifero = 0;
227
+                await PostSimulationZero(sim);
228
+
191 229
                 //2- Obtenemos nombre de los ficheros de pozos y recargas 
192 230
                 pozoFile = files.Find(x => x.Contains(".VMW"));
193 231
                 recargaFile = files.Find(x => x.Contains(".VMP"));
@@ -195,12 +233,12 @@ namespace WebApplication3.Controllers
195 233
                 //3- Parseamos pozos
196 234
                 if (System.IO.File.Exists(pozoFile))
197 235
                 {
198
-                    await pozoController.ParseoFichero(acuifero.Id, pozoFile);
236
+                    await pozoController.ParseoFichero(acuifero.Id, pozoFile,sim.Id);
199 237
                 }
200 238
                 //4- Parseamos recargas
201 239
                 if (System.IO.File.Exists(recargaFile))
202 240
                 {
203
-                    await recargaController.ParseoFichero(acuifero.Id, recargaFile);
241
+                    await recargaController.ParseoFichero(acuifero.Id, recargaFile, sim.Id);
204 242
                 }
205 243
             }
206 244
             catch (DbUpdateException)
@@ -218,8 +256,19 @@ namespace WebApplication3.Controllers
218 256
             return CreatedAtAction("GetAcuifero", new { id = acuifero.Id }, acuifero);
219 257
         }
220 258
 
259
+        [NonAction]
260
+        public async Task<ActionResult<Simulacion>> PostSimulationZero(Simulacion simulacion)
261
+        {
262
+            _context.Simulaciones.Add(simulacion);
263
+            await _context.SaveChangesAsync();
264
+
265
+            return CreatedAtAction("GetSimulacion", new { id = simulacion.Id }, simulacion);
266
+        }
267
+
221 268
         // DELETE: api/Acuifero/5
222 269
         [HttpDelete("{id}")]
270
+        [ProducesResponseType(404)]
271
+        [ProducesResponseType(209)]
223 272
         public async Task<IActionResult> DeleteAcuifero(int id)
224 273
         {
225 274
             var acuifero = await _context.Acuiferos.FindAsync(id);
@@ -251,33 +300,6 @@ namespace WebApplication3.Controllers
251 300
 
252 301
             return string.Empty;
253 302
         }
254
-
255
-        [NonAction]
256
-        public async Task<IActionResult> SetRechargeGeometry(uint id, string recharge_geometry)
257
-        {
258
-            Acuifero aquifer = _context.Acuiferos.Find(id);
259
-
260
-            aquifer.RechargeGeometry = recharge_geometry;
261
-
262
-            _context.Entry(aquifer).State = EntityState.Modified;
263
-
264
-            try
265
-            {
266
-                await _context.SaveChangesAsync();
267
-            }
268
-            catch (DbUpdateConcurrencyException)
269
-            {
270
-                if (!AcuiferoExists(id))
271
-                {
272
-                    return NotFound();
273
-                }
274
-                else
275
-                {
276
-                    throw;
277
-                }
278
-            }
279
-
280
-            return CreatedAtAction("GetAcuifero", new { id = aquifer.Id }, aquifer);
281
-        }
303
+        
282 304
     }
283 305
 }

+ 2 - 0
WorkerService1/WebApplication3/Controllers/BalanceHidricoController.cs Wyświetl plik

@@ -114,6 +114,8 @@ namespace WebApplication3.Controllers
114 114
         // POST: api/TsPozo
115 115
         // To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
116 116
         [HttpPost]
117
+        [ProducesResponseType(200)]
118
+        [ProducesResponseType(409)]
117 119
         public async Task<ActionResult<uint>> PostBalance(BalanceHidrico balance)
118 120
         {
119 121
             _context.BalancesHidricos.Add(balance);

+ 13 - 6
WorkerService1/WebApplication3/Controllers/PiezometriaController.cs Wyświetl plik

@@ -10,8 +10,9 @@ using WebApplication3.Clases;
10 10
 
11 11
 namespace WebApplication3.Controllers
12 12
 {
13
-    [Route("api/[controller]")]
14
-    [ApiController]
13
+    //[Route("api/[controller]")]
14
+    //[ApiController]
15
+    [ApiExplorerSettings(IgnoreApi = true)]
15 16
     public class PiezometriaController : ControllerBase
16 17
     {
17 18
         private readonly AquiferContext _context;
@@ -34,6 +35,8 @@ namespace WebApplication3.Controllers
34 35
 
35 36
         // GET: api/Pozo/5
36 37
         [HttpGet("{id}")]
38
+        [ProducesResponseType(200)]
39
+        [ProducesResponseType(404)]
37 40
         public async Task<ActionResult<Piezometria>> GetPozo(uint id)
38 41
         {            
39 42
             var piezometria = await _context.Piezometria.FindAsync(id);
@@ -89,6 +92,8 @@ namespace WebApplication3.Controllers
89 92
         // POST: api/Pozo
90 93
         // To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
91 94
         [HttpPost]
95
+        [ProducesResponseType(200)]
96
+        [ProducesResponseType(409)]
92 97
         public async Task<ActionResult<Piezometria>> PostPiezometria(Piezometria piezometria)
93 98
         {
94 99
             Logger.WriteLog("Se procede a guardar piezometria");
@@ -113,13 +118,15 @@ namespace WebApplication3.Controllers
113 118
                     throw;
114 119
                 }
115 120
             }
116
-
117
-
118
-            return CreatedAtAction("GetPiezometria", new { id = piezometria.Id }, piezometria);
121
+            
122
+            return Ok(piezometria);
123
+            //return CreatedAtAction("GetPiezometria", new { id = piezometria.Id }, piezometria);
119 124
         }
120 125
 
121 126
         // DELETE: api/Pozo/5
122 127
         [HttpDelete("{id}")]
128
+        [ProducesResponseType(404)]
129
+        [ProducesResponseType(204)]
123 130
         public async Task<IActionResult> DeletePiezometria(uint id)
124 131
         {
125 132
             var piezometria = await _context.Piezometria.FindAsync(id);
@@ -140,7 +147,7 @@ namespace WebApplication3.Controllers
140 147
         }
141 148
 
142 149
         [NonAction]
143
-        public void getDimensions(uint idSimulacion, out int rows, out int cols)
150
+        public void GetDimensions(uint idSimulacion, out int rows, out int cols)
144 151
         {
145 152
             Piezometria piezometria = _context.Piezometria.Where(x => x.IdSimulacion == idSimulacion).FirstOrDefault();
146 153
             rows = piezometria.Rows;

+ 62 - 52
WorkerService1/WebApplication3/Controllers/PozoController.cs Wyświetl plik

@@ -27,13 +27,33 @@ namespace WebApplication3.Controllers
27 27
 
28 28
         // GET: api/Pozo
29 29
         [HttpGet]
30
-        public async Task<ActionResult<IEnumerable<Pozo>>> GetPozos()
30
+        
31
+        public async Task<ActionResult<IEnumerable<DatosPozoRecarga>>> GetPozos()
31 32
         {
32
-            return await _context.Pozos.ToListAsync();
33
+            var pozos = await _context.Pozos.ToListAsync();
34
+            List<DatosPozoRecarga> result = new();
35
+
36
+            foreach(Pozo p in pozos)
37
+            {
38
+                DatosPozoRecarga datosPozo = new DatosPozoRecarga();
39
+                datosPozo.Id = p.Id;
40
+                datosPozo.Nombre = p.Nombre;
41
+                datosPozo.Latitud = p.Latitud;
42
+                datosPozo.Longitud = p.Longitud;
43
+                datosPozo.Maximo = p.Maximo;
44
+                datosPozo.Minimo = p.Minimo;
45
+                datosPozo.Simulacion = p.IdSimulacion;
46
+                datosPozo.Ts = _tsPozoController.GetTsPozo(p.Id);
47
+                result.Add(datosPozo);
48
+            }
49
+
50
+            return result;
33 51
         }
34 52
 
35 53
         // GET: api/Pozo/5
36 54
         [HttpGet("{id}")]
55
+        [ProducesResponseType(200)]
56
+        [ProducesResponseType(404)]
37 57
         public async Task<ActionResult<DatosPozoRecarga>> GetPozo(uint id)
38 58
         {            
39 59
             var pozo = await _context.Pozos.FindAsync(id);
@@ -57,9 +77,37 @@ namespace WebApplication3.Controllers
57 77
             return datosPozo;
58 78
         }
59 79
 
80
+        [HttpGet("Simulacion/{id}")]
81
+        public async Task<ActionResult<IEnumerable<DatosPozoRecarga>>> GetPozosFromSimulation(uint id)
82
+        {
83
+            var pozos = await _context.Pozos.Where(x => x.IdSimulacion == id).ToListAsync();
84
+
85
+            List<DatosPozoRecarga> result = new();
86
+
87
+            foreach (Pozo p in pozos)
88
+            {
89
+                DatosPozoRecarga datosPozo = new DatosPozoRecarga();
90
+                datosPozo.Id = p.Id;
91
+                datosPozo.Nombre = p.Nombre;
92
+                datosPozo.Latitud = p.Latitud;
93
+                datosPozo.Longitud = p.Longitud;
94
+                datosPozo.Maximo = p.Maximo;
95
+                datosPozo.Minimo = p.Minimo;
96
+                datosPozo.Simulacion = p.IdSimulacion;
97
+                datosPozo.Ts = _tsPozoController.GetTsPozo(p.Id);
98
+                result.Add(datosPozo);
99
+            }
100
+
101
+            return result;
102
+
103
+        }
104
+
60 105
         // PUT: api/Pozo/5
61 106
         // To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
62 107
         [HttpPut("{id}")]
108
+        [ProducesResponseType(201)]
109
+        [ProducesResponseType(400)]
110
+        [ProducesResponseType(404)]
63 111
         public async Task<IActionResult> PutPozo(uint id, [FromBody] DatosPozoRecarga datos)
64 112
         {
65 113
             Pozo pozo = _context.Pozos.Find(id);
@@ -100,6 +148,8 @@ namespace WebApplication3.Controllers
100 148
         // POST: api/Pozo
101 149
         // To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
102 150
         [HttpPost]
151
+        [ProducesResponseType(201)]
152
+        [ProducesResponseType(409)]
103 153
         public async Task<ActionResult<Pozo>> PostPozo([FromBody] DatosPozoRecarga datos)
104 154
         {
105 155
             Pozo pozo = new Pozo();
@@ -147,6 +197,8 @@ namespace WebApplication3.Controllers
147 197
 
148 198
         // DELETE: api/Pozo/5
149 199
         [HttpDelete("{id}")]
200
+        [ProducesResponseType(201)]
201
+        [ProducesResponseType(404)]
150 202
         public async Task<IActionResult> DeletePozo(uint id)
151 203
         {
152 204
             var pozo = await _context.Pozos.FindAsync(id);
@@ -166,53 +218,8 @@ namespace WebApplication3.Controllers
166 218
             return _context.Pozos.Any(e => e.Id == id);
167 219
         }
168 220
 
169
-        //api/Pozo/parsea/1
170
-        [HttpPost("Parsea/{acuifero}")]
171
-        public async Task<ActionResult<IEnumerable<Pozo>>> ParseoFicheroPostman(uint acuifero)
172
-        {
173
-            
174
-            Parser wellParser = new Parser();
175
-            string file = @"C:\Users\Admin\Desktop\ASD\infoPozos.VMW";
176
-            WellData[] wells =  wellParser.ParseWellData(file);
177
-
178
-            foreach(WellData w in wells)
179
-            {
180
-                Pozo pozo = w.ToPozo(acuifero);
181
-                _context.Pozos.Add(pozo);
182
-
183
-                try
184
-                {
185
-                    await _context.SaveChangesAsync();
186
-
187
-                    foreach (TimeSerieInterno ts in w.Rates)
188
-                    {
189
-                        TsPozo tsPozo = new TsPozo();
190
-                        tsPozo.IdPozo = pozo.Id;
191
-                        tsPozo.MarcaTiempo = ts.Hora;
192
-                        tsPozo.Valor = ts.Valor;
193
-
194
-                        await _tsPozoController.PostTsPozo(tsPozo);
195
-                    }
196
-
197
-                }
198
-                catch (DbUpdateException)
199
-                {
200
-                    if (PozoExists(pozo.Id))
201
-                    {
202
-                        return Conflict();
203
-                    }
204
-                    else
205
-                    {
206
-                        throw;
207
-                    }
208
-                }
209
-            }
210
-
211
-            return await _context.Pozos.ToListAsync();
212
-        }
213
-
214 221
         [NonAction]
215
-        public async Task<ActionResult<IEnumerable<Pozo>>> ParseoFichero(uint acuifero, string file)
222
+        public async Task<ActionResult<IEnumerable<Pozo>>> ParseoFichero(uint acuifero, string file,uint simId)
216 223
         {
217 224
             var s = acuifero;
218 225
             Parser wellParser = new Parser();
@@ -221,7 +228,7 @@ namespace WebApplication3.Controllers
221 228
 
222 229
             foreach (WellData w in wells)
223 230
             {
224
-                Pozo pozo = w.ToPozo(acuifero);
231
+                Pozo pozo = w.ToPozo(acuifero, simId);
225 232
                 _context.Pozos.Add(pozo);
226 233
 
227 234
                 try
@@ -233,6 +240,7 @@ namespace WebApplication3.Controllers
233 240
                         TsPozo tsPozo = new TsPozo();
234 241
                         tsPozo.IdPozo = pozo.Id;
235 242
                         tsPozo.MarcaTiempo = ts.Hora;
243
+                        tsPozo.MarcaTiempoEnd = ts.HoraEnd;
236 244
                         tsPozo.Valor = ts.Valor;
237 245
                         tsPozo.InfoComplementaria = ts.Info;
238 246
 
@@ -257,11 +265,11 @@ namespace WebApplication3.Controllers
257 265
         }
258 266
 
259 267
         [NonAction]
260
-        public async Task<ActionResult<IEnumerable<Pozo>>> PostMultipleWells(uint aquiferId,WellData[] wellDatas)
268
+        public async Task<ActionResult<IEnumerable<Pozo>>> PostMultipleWells(uint aquiferId,WellData[] wellDatas, uint simulationId)
261 269
         {
262 270
             foreach (WellData w in wellDatas)
263 271
             {
264
-                Pozo pozo = w.ToPozo(aquiferId);
272
+                Pozo pozo = w.ToPozo(aquiferId, simulationId);
265 273
                 _context.Pozos.Add(pozo);
266 274
 
267 275
                 try
@@ -312,7 +320,7 @@ namespace WebApplication3.Controllers
312 320
         public async void SetPozosSimulacion(uint? acuiferoId, uint? simulacionId)
313 321
         {
314 322
             //Obtenemos los pozos del acuifero
315
-            Pozo[] pozos = _context.Pozos.Where(x => x.IdAquifero == acuiferoId).ToArray<Pozo>();
323
+            Pozo[] pozos = _context.Pozos.Where(x => x.IdAquifero == acuiferoId && x.IdSimulacion == null).ToArray<Pozo>();
316 324
 
317 325
             foreach(Pozo p in pozos)
318 326
             {
@@ -321,6 +329,8 @@ namespace WebApplication3.Controllers
321 329
                 _context.Pozos.Add(pozo);
322 330
             }
323 331
             await _context.SaveChangesAsync();
332
+
333
+
324 334
         }
325 335
 
326 336
         [NonAction]

+ 99 - 10
WorkerService1/WebApplication3/Controllers/RecargasController.cs Wyświetl plik

@@ -27,13 +27,30 @@ namespace WebApplication3.Controllers
27 27
 
28 28
         // GET: api/Recargas
29 29
         [HttpGet]
30
-        public async Task<ActionResult<IEnumerable<Recarga>>> GetRecargas()
30
+        public async Task<ActionResult<IEnumerable<DatosPozoRecarga>>> GetRecargas()
31 31
         {
32
-            return await _context.Recargas.ToListAsync();
32
+            var recargas =  await _context.Recargas.ToListAsync();
33
+            List<DatosPozoRecarga> result = new();
34
+
35
+            foreach(Recarga r in recargas)
36
+            {
37
+                DatosPozoRecarga datosRecarga = new();
38
+                datosRecarga.Id = r.Id;
39
+                datosRecarga.Nombre = r.Nombre;
40
+                datosRecarga.Latitud = r.Latitud;
41
+                datosRecarga.Longitud = r.Longitud;
42
+                datosRecarga.Simulacion = r.IdSimulacion;
43
+                datosRecarga.Ts = tsRecargaController.GetTsRecarga(r.Id);
44
+                result.Add(datosRecarga);
45
+            }
46
+
47
+            return result;
33 48
         }
34 49
 
35 50
         // GET: api/Recargas/5
36 51
         [HttpGet("{id}")]
52
+        [ProducesResponseType(200)]
53
+        [ProducesResponseType(404)]
37 54
         public async Task<ActionResult<DatosPozoRecarga>> GetRecarga(uint id)
38 55
         {
39 56
             var recarga = await _context.Recargas.FindAsync(id);
@@ -57,8 +74,10 @@ namespace WebApplication3.Controllers
57 74
         }
58 75
 
59 76
         // PUT: api/Recargas/5
60
-        // To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
61 77
         [HttpPut("{id}")]
78
+        [ProducesResponseType(201)]
79
+        [ProducesResponseType(400)]
80
+        [ProducesResponseType(404)]
62 81
         public async Task<IActionResult> PutRecarga(uint id, [FromBody] DatosPozoRecarga datos)
63 82
         {
64 83
             Recarga recarga = _context.Recargas.Find(id);
@@ -99,8 +118,9 @@ namespace WebApplication3.Controllers
99 118
         }
100 119
 
101 120
         // POST: api/Recargas
102
-        // To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
103 121
         [HttpPost]
122
+        [ProducesResponseType(201)]
123
+        [ProducesResponseType(409)]
104 124
         public async Task<ActionResult<Recarga>> PostRecarga([FromBody] DatosPozoRecarga datos)
105 125
         {
106 126
             Recarga recarga = new Recarga();
@@ -164,7 +184,7 @@ namespace WebApplication3.Controllers
164 184
         [NonAction]
165 185
         public async void SetRecargasSimulacion(uint? acuiferoId, uint? simulacionId)
166 186
         {
167
-            Recarga[] recargas = _context.Recargas.Where(x => x.IdAcuifero == acuiferoId).ToArray<Recarga>();
187
+            Recarga[] recargas = _context.Recargas.Where(x => x.IdAcuifero == acuiferoId && x.IdSimulacion == null).ToArray<Recarga>();
168 188
 
169 189
             foreach (Recarga r in recargas)
170 190
             {
@@ -204,21 +224,89 @@ namespace WebApplication3.Controllers
204 224
         }
205 225
 
206 226
         [NonAction]
207
-        public async Task<ActionResult<IEnumerable<Recarga>>> ParseoFichero(uint aquifer, string file)
227
+        public async Task<ActionResult<IEnumerable<Recarga>>> ParseoFichero(uint aquifer, string file, uint simId)
208 228
         {
209 229
             Parser parser = new Parser();
210 230
             //string file = @"C:\Users\Admin\Desktop\ASD\infoPozos.VMW";
211 231
             RechargeData[] recharges = parser.ParseRechargeData(file, out string recharge_geometry);
212
-            //await aquiferController.SetRechargeGeometry(aquifer, recharge_geometry);
213
-            return await PostMultipleRecharges(aquifer,recharges);
232
+            await SetRechargeGeometry(aquifer, recharge_geometry);
233
+
234
+            string fileName = Utilities.String2Png(recharge_geometry);
235
+
236
+            Byte[] bytes = System.IO.File.ReadAllBytes(fileName);
237
+            String base64Image = Convert.ToBase64String(bytes);
238
+
239
+            await SetRechargeMapColor(aquifer, base64Image);
240
+
241
+            return await PostMultipleRecharges(aquifer,recharges,simId);
242
+        }
243
+
244
+        [NonAction]
245
+        public async Task<Acuifero> SetRechargeGeometry(uint id, string recharge_geometry)
246
+        {
247
+            Acuifero aquifer = _context.Acuiferos.Find(id);
248
+
249
+            aquifer.RechargeGeometry = recharge_geometry;
250
+
251
+            _context.Entry(aquifer).State = EntityState.Modified;
252
+
253
+            try
254
+            {
255
+                await _context.SaveChangesAsync();
256
+            }
257
+            catch (DbUpdateConcurrencyException)
258
+            {
259
+                if (!AcuiferoExists(id))
260
+                {
261
+                    return null;
262
+                }
263
+                else
264
+                {
265
+                    throw;
266
+                }
267
+            }
268
+
269
+            return aquifer;
270
+        }
271
+
272
+        [NonAction]
273
+        public async Task<bool> SetRechargeMapColor(uint id, string base64)
274
+        {
275
+            Acuifero aquifer = _context.Acuiferos.Find(id);
276
+
277
+            aquifer.RechargeColorMap = base64;
278
+
279
+            _context.Entry(aquifer).State = EntityState.Modified;
280
+
281
+            try
282
+            {
283
+                await _context.SaveChangesAsync();
284
+            }
285
+            catch (DbUpdateConcurrencyException)
286
+            {
287
+                if (!AcuiferoExists(id))
288
+                {
289
+                    return false;
290
+                }
291
+                else
292
+                {
293
+                    throw;
294
+                }
295
+            }
296
+            return true;
297
+        }
298
+
299
+        private bool AcuiferoExists(uint id)
300
+        {
301
+            return _context.Acuiferos.Any(e => e.Id == id);
214 302
         }
215 303
 
216 304
         [NonAction]
217
-        public async Task<ActionResult<IEnumerable<Recarga>>> PostMultipleRecharges(uint aquifer, RechargeData[] recharges)
305
+        public async Task<ActionResult<IEnumerable<Recarga>>> PostMultipleRecharges(uint aquifer, RechargeData[] recharges, uint simId)
218 306
         {
219 307
             foreach (RechargeData r in recharges)
220 308
             {
221
-                Recarga recarga = r.ToRecarga(aquifer);
309
+                Recarga recarga = r.ToRecarga(aquifer,simId);
222 310
                 _context.Recargas.Add(recarga);
223 311
 
224 312
                 try
@@ -231,6 +319,7 @@ namespace WebApplication3.Controllers
231 319
                         TsRecarga tsRecarga = new(); 
232 320
                         tsRecarga.IdRecarga = recarga.Id;
233 321
                         tsRecarga.MarcaTiempo = ts.Hora;
322
+                        tsRecarga.MarcaTiempoEnd = ts.HoraEnd;
234 323
                         tsRecarga.Valor = ts.Valor;
235 324
 
236 325
                         await tsRecargaController.PostTsRecarga(tsRecarga);

+ 3 - 2
WorkerService1/WebApplication3/Controllers/ServiceQueueController.cs Wyświetl plik

@@ -10,8 +10,9 @@ using WebApplication3.Clases;
10 10
 
11 11
 namespace WebApplication3.Controllers
12 12
 {
13
-    [Route("api/queue")]
14
-    [ApiController]
13
+    //[Route("api/queue")]
14
+    //[ApiController]
15
+    [ApiExplorerSettings(IgnoreApi = true)]
15 16
     public class ServiceQueueController : ControllerBase
16 17
     {
17 18
         private readonly AquiferContext _context;

+ 63 - 44
WorkerService1/WebApplication3/Controllers/ServicioController.cs Wyświetl plik

@@ -11,8 +11,9 @@ using WebApplication3.Clases;
11 11
 
12 12
 namespace WebApplication3.Controllers
13 13
 {
14
-    [Route("api/servicio")]
15
-    [ApiController]
14
+    //[Route("api/servicio")]
15
+    //[ApiController]
16
+    [ApiExplorerSettings(IgnoreApi = true)]
16 17
     public class ServicioController : ControllerBase
17 18
     {
18 19
         private readonly AquiferContext _context;
@@ -117,36 +118,36 @@ namespace WebApplication3.Controllers
117 118
         }
118 119
 
119 120
         // GET: api/Servicio/simula
120
-        [HttpGet("simularest")]
121
-        public Task<ActionResult<Servicio>> SimulaRest()
122
-        {
123
-            string respuesta = "";
124
-
125
-            Proceso proceso = Proceso.GetInstance();
126
-            proceso.setParametersModflow(@"C:\Users\Admin\Desktop\TestExtract\simulaicionsimulacion_test", "AA.modflow.in");
127
-            try
128
-            {
129
-                if (!proceso.Started)
130
-                {
131
-                    proceso.Start();
132
-                    respuesta = "Id: " + proceso.GetPid();
133
-                    Servicio s = new Servicio();
134
-                    s.Id = GetLastId() + 1;
135
-                    s.Pid = (uint)proceso.GetPid();
136
-                    s.Terminado = 0;
137
-                    return PostServicio(s);
138
-                }
139
-            }
140
-            catch (Exception ex)
141
-            {
142
-                respuesta = ex.Message;
143
-                throw;
144
-            }
145
-
146
-
147
-            return null;
148
-
149
-        }
121
+        //[HttpGet("simularest")]
122
+        //public Task<ActionResult<Servicio>> SimulaRest()
123
+        //{
124
+        //    string respuesta = "";
125
+
126
+        //    Proceso proceso = Proceso.GetInstance();
127
+        //    proceso.setParametersModflow(@"C:\Users\Admin\Desktop\TestExtract\simulaicionsimulacion_test", "AA.modflow.in");
128
+        //    try
129
+        //    {
130
+        //        if (!proceso.Started)
131
+        //        {
132
+        //            proceso.Start();
133
+        //            respuesta = "Id: " + proceso.GetPid();
134
+        //            Servicio s = new Servicio();
135
+        //            s.Id = GetLastId() + 1;
136
+        //            s.Pid = (uint)proceso.GetPid();
137
+        //            s.Terminado = 0;
138
+        //            return PostServicio(s);
139
+        //        }
140
+        //    }
141
+        //    catch (Exception ex)
142
+        //    {
143
+        //        respuesta = ex.Message;
144
+        //        throw;
145
+        //    }
146
+
147
+
148
+        //    return null;
149
+
150
+        //}
150 151
 
151 152
         [NonAction]
152 153
         public async Task<ActionResult<Servicio>> SimulaModflow(string workingDirectory, string arguments)
@@ -154,7 +155,6 @@ namespace WebApplication3.Controllers
154 155
             string respuesta = "";
155 156
 
156 157
             Proceso proceso = Proceso.GetInstance();
157
-            Logger logger = Logger.GetInstance();
158 158
             proceso.ResetProcess();
159 159
             proceso.setParametersModflow(workingDirectory, arguments);
160 160
 
@@ -164,7 +164,7 @@ namespace WebApplication3.Controllers
164 164
                 {
165 165
                     proceso.Start();
166 166
                     respuesta = "Id: " + proceso.GetPid();
167
-                    Servicio s = new Servicio();
167
+                    Servicio s = new ();
168 168
                     s.Id = GetLastId() + 1;
169 169
                     s.Pid = (uint)proceso.GetPid();
170 170
                     s.Terminado = 0;
@@ -191,7 +191,7 @@ namespace WebApplication3.Controllers
191 191
         public async Task<ActionResult<Servicio>> SimulaZoneBudget(string workingDirectory, string budgetFile, string zoneFile)
192 192
         {
193 193
             string respuesta = "";
194
-            Logger logger = Logger.GetInstance();
194
+            
195 195
             Logger.WriteLog("working directory: " + workingDirectory + " | budgetFile: " + budgetFile + " | zoneFile: " + zoneFile);
196 196
             Proceso proceso = Proceso.GetInstance();
197 197
             proceso.ResetProcess();
@@ -203,7 +203,7 @@ namespace WebApplication3.Controllers
203 203
                 {
204 204
                     proceso.Start();
205 205
                     respuesta = "Id: " + proceso.GetPid();
206
-                    Servicio s = new Servicio();
206
+                    Servicio s = new ();
207 207
                     s.Id = GetLastId() + 1;
208 208
                     s.Pid = (uint)proceso.GetPid();
209 209
                     s.Terminado = 0;
@@ -231,13 +231,13 @@ namespace WebApplication3.Controllers
231 231
         [NonAction]
232 232
         public async Task<ActionResult<Servicio>> GetIsolinesWithPython(string workingDirectory,string headFile, int rows, int cols)
233 233
         {
234
-            Logger logger = Logger.GetInstance();
234
+            
235 235
             Proceso proceso = Proceso.GetInstance();
236 236
             int isolines = 30;
237 237
             proceso.ResetProcess();
238 238
             proceso.setParametersPython(workingDirectory,headFile,rows,cols,isolines);
239 239
             proceso.Start();
240
-            Servicio s = new Servicio();
240
+            Servicio s = new ();
241 241
             s.Id = GetLastId() + 1;
242 242
             s.Pid = (uint)proceso.GetPid();
243 243
             s.Terminado = 0;
@@ -248,6 +248,24 @@ namespace WebApplication3.Controllers
248 248
             return postServicio;
249 249
         }
250 250
 
251
+        [NonAction]
252
+        public async Task<ActionResult<Servicio>> GetGeoJsonFromSVG(string workingDirectory, string headFile)
253
+        {
254
+            Proceso proceso = Proceso.GetInstance();
255
+            proceso.ResetProcess();
256
+            proceso.SetParametersSVG2Json(workingDirectory, headFile);
257
+            proceso.Start();
258
+            Servicio s = new ();
259
+            s.Id = GetLastId() + 1;
260
+            s.Pid = (uint)proceso.GetPid();
261
+            s.Terminado = 0;
262
+            s.Inicio = DateTime.Now.ToString();
263
+            s.Tipo = "SVG2GEOJSON";
264
+            var postServicio = await PostServicio(s); ;
265
+            proceso.WaitForExit();
266
+            return postServicio;
267
+        }
268
+
251 269
         // GET: api/Servicio/stopped
252 270
         [HttpGet("stopped")]
253 271
         public bool HasStopped()
@@ -267,7 +285,7 @@ namespace WebApplication3.Controllers
267 285
         [HttpGet("lastid")]
268 286
         public uint GetLastId()
269 287
         {
270
-            if(_context.Servicios.Count() == 0)
288
+            if(!_context.Servicios.Any())
271 289
             {
272 290
                 return 0;
273 291
             }
@@ -285,10 +303,10 @@ namespace WebApplication3.Controllers
285 303
         }
286 304
 
287 305
         [NonAction]
288
-        public async Task<int> setTerminado(int pid)
306
+        public async Task<int> SetTerminado(int pid)
289 307
         {
290
-
291
-            Servicio servicio = _context.Servicios.FromSqlRaw("SELECT * FROM servicio WHERE pid = {0} ORDER BY id DESC", pid).First();
308
+            Servicio servicio = _context.Servicios.Where(x => x.Pid == pid).OrderByDescending(x => x.Id).First(); ;
309
+            //Servicio servicio = _context.Servicios.FromSqlRaw("SELECT * FROM servicio WHERE pid = {0} ORDER BY id DESC", pid).First();
292 310
 
293 311
             servicio.Terminado = 1;
294 312
             servicio.Fin = DateTime.Now.ToString();
@@ -298,9 +316,10 @@ namespace WebApplication3.Controllers
298 316
             {
299 317
                 result = await _context.SaveChangesAsync();
300 318
             }
301
-            catch (DbUpdateConcurrencyException)
319
+            catch (DbUpdateConcurrencyException ex)
302 320
             {
303
-                
321
+                Logger.WriteLog(ex.Message);
322
+                Logger.WriteLog(ex.InnerException.Message);
304 323
             }
305 324
 
306 325
             Logger.WriteLog("TERMINADO " + pid);

+ 138 - 81
WorkerService1/WebApplication3/Controllers/SimulacionController.cs Wyświetl plik

@@ -20,13 +20,13 @@ namespace WebApplication3.Controllers
20 20
     {
21 21
         
22 22
         private readonly AquiferContext _context;
23
-        private PozoController pozoController;
24
-        private RecargasController recargasController;
25
-        private AcuiferoController acuiferoController;
26
-        private ServicioController serviceController;
27
-        private BalanceHidricoController balanceHidricoController;
28
-        private PiezometriaController piezometriaController;
29
-        private ServiceQueueController serviceQueueController;
23
+        private readonly PozoController pozoController;
24
+        private readonly RecargasController recargasController;
25
+        private readonly AcuiferoController acuiferoController;
26
+        private readonly ServicioController serviceController;
27
+        private readonly BalanceHidricoController balanceHidricoController;
28
+        private readonly PiezometriaController piezometriaController;
29
+        private readonly ServiceQueueController serviceQueueController;
30 30
 
31 31
         public SimulacionController(AquiferContext context)
32 32
         {
@@ -49,6 +49,8 @@ namespace WebApplication3.Controllers
49 49
 
50 50
         // GET: api/Simulacion/5
51 51
         [HttpGet("{id}")]
52
+        [ProducesResponseType(200)]
53
+        [ProducesResponseType(404)]
52 54
         public async Task<ActionResult<Simulacion>> GetSimulacion(uint id)
53 55
         {
54 56
             var simulacion = await _context.Simulaciones.FindAsync(id);
@@ -64,6 +66,7 @@ namespace WebApplication3.Controllers
64 66
         // POST: api/Simulacion
65 67
         // To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
66 68
         [HttpPost]
69
+        [ProducesResponseType(201)]
67 70
         public async Task<ActionResult<Simulacion>> PostSimulacion(Simulacion simulacion)
68 71
         {
69 72
             _context.Simulaciones.Add(simulacion);
@@ -77,11 +80,13 @@ namespace WebApplication3.Controllers
77 80
         }
78 81
 
79 82
         [HttpPost("Simula/{simulacionId}")]
83
+        [ProducesResponseType(200)]
84
+
80 85
         public async Task<bool> QueueSim(uint simulacionId)
81 86
         {
82 87
             Simulacion simulacion = _context.Simulaciones.Find(simulacionId);
83 88
 
84
-            ServiceQueue serviceQueue = new ServiceQueue();
89
+            ServiceQueue serviceQueue = new ();
85 90
             serviceQueue.IdSimulacion = simulacionId;
86 91
             serviceQueue.IdAcuifero = simulacion.IdAcuifero;
87 92
 
@@ -90,7 +95,9 @@ namespace WebApplication3.Controllers
90 95
             return true;
91 96
         }
92 97
 
93
-        [HttpPut("UpdateSimWellData")]
98
+        [HttpPut("{simulationId}/UpdateSimWellData")]
99
+        [ProducesResponseType(200)]
100
+
94 101
         public async Task<ActionResult<bool>> UpdateSimWellsFromCsv(uint simulationId, [FromBody] DatosPostSimulacion data)
95 102
         {
96 103
             bool result = true;
@@ -114,12 +121,14 @@ namespace WebApplication3.Controllers
114 121
 
115 122
             WellData[] wellDatas = parser.parseWellCSV(file);
116 123
 
117
-            await pozoController.PostMultipleWells((uint)sim.IdAcuifero,wellDatas);
124
+            await pozoController.PostMultipleWells((uint)sim.IdAcuifero,wellDatas, simulationId);
118 125
 
119 126
             return result;
120 127
         }
121 128
 
122
-        [HttpPut]
129
+        [HttpPut("{simulationId}/UpdateRechargeWellData")]
130
+        [ProducesResponseType(200)]
131
+
123 132
         public async Task<ActionResult<bool>> UpdateSimRechargesFromCsv(uint simulationId, [FromBody] DatosPostSimulacion data)
124 133
         {
125 134
             bool result = true;
@@ -144,14 +153,17 @@ namespace WebApplication3.Controllers
144 153
             RechargeData[] rechargeDatas = parser.parseRechargeCSV(file);
145 154
 
146 155
             
147
-            await recargasController.PostMultipleRecharges((uint)sim.IdAcuifero, rechargeDatas);
156
+            await recargasController.PostMultipleRecharges((uint)sim.IdAcuifero, rechargeDatas,sim.Id);
148 157
 
149 158
             return result;
150 159
         }
151 160
 
152 161
         // PUT: api/Simulacion/5
153
-        // To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754s
154 162
         [HttpPut("{id}")]
163
+        [ProducesResponseType(201)]
164
+        [ProducesResponseType(400)]
165
+        [ProducesResponseType(404)]
166
+
155 167
         public async Task<IActionResult> PutSimulacion(uint id, [FromBody] DatosPostSimulacion datos)
156 168
         {
157 169
             Simulacion simulacion = _context.Simulaciones.Find(id);
@@ -187,6 +199,7 @@ namespace WebApplication3.Controllers
187 199
 
188 200
         // DELETE: api/Simulacion/5
189 201
         [HttpDelete("{id}")]
202
+        [ProducesResponseType(209)]
190 203
         public async Task<IActionResult> DeleteSimulacion(uint id)
191 204
         {
192 205
             var simulacion = await _context.Simulaciones.FindAsync(id);
@@ -204,7 +217,6 @@ namespace WebApplication3.Controllers
204 217
         [NonAction]
205 218
         public async Task<bool> SimulaAsync(ServiceQueue serviceQueue)
206 219
         {
207
-            Logger logger = Logger.GetInstance();
208 220
             await serviceQueueController.SetCorriendo(serviceQueue.Id);
209 221
 
210 222
             uint simulacionId = (uint)serviceQueue.IdSimulacion;
@@ -215,8 +227,8 @@ namespace WebApplication3.Controllers
215 227
             Logger.WriteLog("estoy simulando");
216 228
             if (zip != string.Empty)
217 229
             {
218
-                Parser parser = new Parser();
219
-                string zip_name = "simulaicion" + simulacion.Nombre;
230
+                Parser parser = new ();
231
+                string zip_name = "simulacion" + simulacion.Nombre;
220 232
                 string zip_copy = zip_name + ".zip";
221 233
                 System.IO.File.Copy(Constants.PathZip + zip, Constants.PathZip + zip_copy, true);
222 234
 
@@ -225,6 +237,7 @@ namespace WebApplication3.Controllers
225 237
                 Directory.CreateDirectory(workingDirectory);
226 238
                 ZipFile.ExtractToDirectory(Constants.PathZip + zip_copy, workingDirectory, true);
227 239
 
240
+                workingDirectory += zip.Replace(".zip", "\\");
228 241
                 //Obtenemos fichero de pozo y recargas
229 242
                 List<string> files = Directory.GetFiles(workingDirectory).ToList<string>();
230 243
 
@@ -233,51 +246,55 @@ namespace WebApplication3.Controllers
233 246
                 string inFile = files.Find(x => x.Contains(".MODFLOW.IN") || x.Contains(".modflow.in"));
234 247
                 string zoneFile = files.Find(x => x.Contains(".ZBI") || x.Contains(".zbi"));
235 248
 
249
+                Logger.WriteLog("ficheros clave buscados");
250
+
236 251
                 //3- Parseamos pozos
237 252
                 if (System.IO.File.Exists(pozoFile))
238 253
                 {
254
+                    Logger.WriteLog("vamos con los pozos");
239 255
                     List<WellData> infoPozosFichero = parser.ParseWellData(pozoFile).ToList<WellData>();
240 256
                     List<Pozo> pozos = pozoController.GetPozosSimulacion(simulacionId);
241
-                    List<string> lines = new List<string>();
257
+                    List<string> lines = new();
258
+
242 259
 
243 260
                     //Por ahora asumimos que el fichero tiene la misma cantidad de pozos que en bbdd para esta simulacion
244 261
                     string[] maxDefault = infoPozosFichero[0].ZMax.Split(" ");
245 262
 
246
-
247 263
                     lines.Add(pozos.Count.ToString());
248 264
                     foreach (Pozo p in pozos)
249 265
                     {
250 266
                         List<TsPozo> timeSeriesPozo = pozoController.GetTsPozoFromPozo(p.Id);
251 267
                         lines.Add("0"); //Activo o inactivo
252 268
                         lines.Add(p.Nombre);
253
-                        lines.Add(p.Latitud.ToString());
254
-                        lines.Add(p.Longitud.ToString());
269
+                        lines.Add(p.X.ToString());
270
+                        lines.Add(p.Y.ToString());
255 271
                         lines.Add(p.Minimo.ToString());
256 272
                         maxDefault[0] = p.Maximo.ToString();
257 273
                         string aux = String.Join(' ', maxDefault);
258 274
                         lines.Add(aux); //Maximo
259 275
                         lines.Add(infoPozosFichero[0].ScreenIntervals.ToString()); //screen intervals
260
-                        lines.Add(infoPozosFichero[0].Top);
261 276
                         lines.Add(infoPozosFichero[0].Bot);
277
+                        lines.Add(infoPozosFichero[0].Top);
262 278
                         lines.Add(timeSeriesPozo.Count.ToString());
263 279
 
264
-                        for (int i = 0; i < timeSeriesPozo.Count - 1; i++)
280
+                        for (int i = 0; i < timeSeriesPozo.Count; i++)
265 281
                         {
266 282
                             lines.Add(timeSeriesPozo[i].MarcaTiempo);
267
-                            lines.Add(timeSeriesPozo[i + 1].MarcaTiempo);
268
-                            lines.Add(timeSeriesPozo[i].Valor.ToString() + " " + timeSeriesPozo[i].InfoComplementaria);
283
+                            lines.Add(timeSeriesPozo[i].MarcaTiempoEnd);
284
+                            lines.Add(timeSeriesPozo[i].Valor + " " + timeSeriesPozo[i].InfoComplementaria);
269 285
                         }
270 286
                     }
271 287
 
272 288
                     //System.IO.File.WriteAllLines(@"C:\Users\Admin\Desktop\Test.VMW", lines);
273 289
                     System.IO.File.WriteAllLines(pozoFile, lines);
274
-
290
+                    Logger.WriteLog("pozos terminados");
275 291
                 }
276 292
 
277 293
 
278 294
                 //4- Parseamos recargas
279 295
                 if (System.IO.File.Exists(recargaFile))
280 296
                 {
297
+                    Logger.WriteLog("vamos con recargas");
281 298
                     List<Recarga> recargas = recargasController.GetRecargasSimulacion(simulacionId);
282 299
 
283 300
                     string text = System.IO.File.ReadAllText(recargaFile);
@@ -288,7 +305,7 @@ namespace WebApplication3.Controllers
288 305
                     int rechargeBlockInex = blankLinePerBlock * 2;
289 306
 
290 307
 
291
-                    List<string> lines = new List<string>();
308
+                    List<string> lines = new();
292 309
 
293 310
                     //Hasta el bloque de recargas vamos poniendo el texto que le precede
294 311
                     for (int i = 0; i < rechargeBlockInex; i++)
@@ -305,8 +322,11 @@ namespace WebApplication3.Controllers
305 322
                     {
306 323
                         List<TsRecarga> tsRecarga = recargasController.GetTsRecargaFromRecaga(r.Id);
307 324
                         lines.Add(index + " 1 Index 1");
308
-                        lines.Add("1 rchr entries");
309
-                        lines.Add(index + " " + tsRecarga[0].Valor + "               " + tsRecarga[0].MarcaTiempo + "               " + tsRecarga[1].MarcaTiempo + " " + tsRecarga[0].InfoComplementaria);
325
+                        lines.Add(tsRecarga.Count + " rchr entries");
326
+                        tsRecarga.ForEach(x =>
327
+                            lines.Add(index + " " + x.Valor + "               " + x.MarcaTiempo + "               " + x.MarcaTiempoEnd + " " + x.InfoComplementaria)
328
+                        );
329
+                        //lines.Add(index + " " + tsRecarga[0].Valor + "               " + tsRecarga[0].MarcaTiempo + "               " + tsRecarga[1].MarcaTiempo + " " + tsRecarga[0].InfoComplementaria);
310 330
 
311 331
                     }
312 332
                     lines.Add("");
@@ -332,6 +352,7 @@ namespace WebApplication3.Controllers
332 352
                 //Primeramente, para ejecutar el modelo, hay que modificar el contenido del fichero con extension .in para que no de error al ejecutarse el modelo
333 353
                 if (System.IO.File.Exists(inFile))
334 354
                 {
355
+                    Logger.WriteLog("tratamos el fichero .IN");
335 356
                     List<string> inFileLines = parser.ParseInFile(inFile);
336 357
                     System.IO.File.WriteAllLines(inFile, inFileLines);
337 358
                 }
@@ -383,7 +404,7 @@ namespace WebApplication3.Controllers
383 404
 
384 405
                         uint balanceDataInId = dataIn.Value;
385 406
 
386
-                        List<ConexionZonasIn> conexionZonasIns = new List<ConexionZonasIn>();
407
+                        List<ConexionZonasIn> conexionZonasIns = new();
387 408
 
388 409
                         zone.In.ZoneConnections.ForEach(x => conexionZonasIns.Add(x.ToConexionIn(balanceDataInId)));
389 410
 
@@ -392,7 +413,7 @@ namespace WebApplication3.Controllers
392 413
                         var dataOut = await balanceHidricoController.PostBalanceOut(zone.Out.ToDatosBalanceOut(balanceId));
393 414
                         uint balanceDataOutId = dataOut.Value;
394 415
 
395
-                        List<ConexionZonasOut> conexionZonasOuts = new List<ConexionZonasOut>();
416
+                        List<ConexionZonasOut> conexionZonasOuts = new();
396 417
 
397 418
                         zone.Out.ZoneConnections.ForEach(x => conexionZonasOuts.Add(x.ToConexionOut(balanceDataOutId)));
398 419
 
@@ -406,15 +427,24 @@ namespace WebApplication3.Controllers
406 427
                 {
407 428
                     Logger.WriteLog("inicio balance modelo entero");
408 429
                     ZoneBalance[] modelBalance = parser.ParseWholeModelBalance(modelResultsFile);
409
-
430
+                    Logger.WriteLog("este es el lenght del balance entero " + modelBalance.Length);
410 431
                     //insertamos en bbdd
411
-                    foreach (ZoneBalance zone in modelBalance)
432
+                    try
412 433
                     {
413
-                        var result = await balanceHidricoController.PostBalance(zone.ToBalanceHidrico(simulacionId));
414
-                        uint balanceId = result.Value;
434
+                        foreach (ZoneBalance zone in modelBalance)
435
+                        {
436
+                            var result = await balanceHidricoController.PostBalance(zone.ToBalanceHidrico(simulacionId));
437
+                            uint balanceId = result.Value;
415 438
 
416
-                        await balanceHidricoController.PostBalanceIn(zone.In.ToDatosBalanceIn(balanceId));
417
-                        await balanceHidricoController.PostBalanceOut(zone.Out.ToDatosBalanceOut(balanceId));
439
+                            await balanceHidricoController.PostBalanceIn(zone.In.ToDatosBalanceIn(balanceId));
440
+                            await balanceHidricoController.PostBalanceOut(zone.Out.ToDatosBalanceOut(balanceId));
441
+                        }
442
+                    }
443
+                    catch (Exception ex)
444
+                    {
445
+                        Logger.WriteLog(ex.Message);
446
+                        Logger.WriteLog(ex.InnerException.Message);
447
+                        throw;
418 448
                     }
419 449
                     Logger.WriteLog("fin balance modelo entero");
420 450
                 }
@@ -431,52 +461,75 @@ namespace WebApplication3.Controllers
431 461
                     }
432 462
                     Logger.WriteLog("fin piezometria");
433 463
                 }
434
-                piezometriaController.getDimensions(simulacionId, out int rows, out int cols);
464
+                piezometriaController.GetDimensions(simulacionId, out int rows, out int cols);
435 465
 
436 466
                 await serviceController.GetIsolinesWithPython(workingDirectory, piezometryFile, rows, cols);
437 467
                 Thread.Sleep(5000);
438
-
439
-                Byte[] bytes = System.IO.File.ReadAllBytes(workingDirectory + "test.png");
468
+                Logger.WriteLog("ya tengo la imagen de isolineas");
469
+                Logger.WriteLog(workingDirectory + Constants.SVGFileName);
470
+                Byte[] bytes = System.IO.File.ReadAllBytes(workingDirectory + Constants.SVGFileName);
440 471
                 String base64Image = Convert.ToBase64String(bytes);
441 472
 
442
-
473
+                Logger.WriteLog("guardo imagen de isolineas");
474
+                Logger.WriteLog(base64Image);
443 475
                 await SetIsolinesImage(simulacionId, base64Image);
444
-
445
-
476
+                Logger.WriteLog("ya esta guardada");
477
+                /*
478
+                 * se transforma la imagen vectorial obtenida anteriormente para transformarla en un geojson
479
+                 */
480
+                string svgFile = workingDirectory + Constants.SVGFileName;
481
+                await serviceController.GetGeoJsonFromSVG(workingDirectory, svgFile);
482
+
483
+                await SetGeoJson(simulacionId, workingDirectory+Constants.GeoJsonFileName);
484
+                
446 485
                 await serviceQueueController.SetTerminado(serviceQueue.Id);
447 486
                 Logger.WriteLog("terminado");
487
+                try
488
+                {
489
+                    System.IO.Directory.Delete(workingDirectory);
490
+                }catch(Exception ex)
491
+                {
492
+                    Logger.WriteLog(ex.Message);
493
+                    Logger.WriteLog(ex.InnerException.Message);
494
+                }
448 495
             }
449 496
             return true;
450 497
         }
451 498
 
499
+            
500
+        [HttpGet("Geojson/{id}")]
501
+        [ProducesResponseType(200)]
452 502
 
453
-        [HttpGet("Geojson")]
454
-        public GeoJson GetGeoJson()
503
+        public async Task<GeoJson> GetGeoJson(uint id)
455 504
         {
456
-            string allText = System.IO.File.ReadAllText(@"C:\Users\Admin\Desktop\AAAA\test_aa.geojson");
457
-            allText = allText.Replace("[[[","[[");
458
-            allText = allText.Replace("]]]", "]]");
459
-            GeoJson jsonObject = JsonConvert.DeserializeObject<GeoJson>(allText);
505
+            Simulacion s = await _context.Simulaciones.FindAsync(id);
506
+            GeoJson jsonObject = JsonConvert.DeserializeObject<GeoJson>(s.Geojson);
460 507
             return jsonObject;
461 508
         }
509
+
510
+
462 511
         private bool SimulacionExists(uint id)
463 512
         {
464 513
             return _context.Simulaciones.Any(e => e.Id == id);
465 514
         }
466 515
 
467
-        private async Task<IActionResult> SetIsolinesImage(uint simulacionId, string imageBase64)
516
+        private async Task<IActionResult> SetGeoJson(uint simulationId, string geojsonFile)
468 517
         {
469
-            var simulacion = _context.Simulaciones.Find(simulacionId);
518
+            string allText = System.IO.File.ReadAllText(geojsonFile);
519
+            allText = allText.Replace("[[[","[[");
520
+            allText = allText.Replace("]]]", "]]");
470 521
 
471
-            if (simulacionId != simulacion.Id)
522
+            var simulation = _context.Simulaciones.Find(simulationId);
523
+
524
+            if (simulationId!= simulation.Id)
472 525
             {
473 526
                 return BadRequest();
474 527
             }
475 528
 
476 529
 
477
-            simulacion.IsolineImage = imageBase64;
530
+            simulation.Geojson = allText;
478 531
 
479
-            _context.Entry(simulacion).State = EntityState.Modified;
532
+            _context.Entry(simulation).State = EntityState.Modified;
480 533
 
481 534
             try
482 535
             {
@@ -484,7 +537,7 @@ namespace WebApplication3.Controllers
484 537
             }
485 538
             catch (DbUpdateConcurrencyException)
486 539
             {
487
-                if (!SimulacionExists(simulacionId))
540
+                if (!SimulacionExists(simulationId))
488 541
                 {
489 542
                     return NotFound();
490 543
                 }
@@ -494,40 +547,44 @@ namespace WebApplication3.Controllers
494 547
                 }
495 548
             }
496 549
 
497
-            return CreatedAtAction("GetSimulacion", new { id = simulacion.Id }, simulacion);
550
+            return CreatedAtAction("GetSimulacion", new { id = simulation.Id }, simulation);
551
+
498 552
         }
499 553
 
500
-        /*
501
-         * TEST ENDPOINTS
502
-         */
503
-        [HttpPost("Simula/Python/{simulacionId}")]
504
-        public async Task<bool> SimIsolinesWithPython(uint simulacionId)
554
+        private async Task<IActionResult> SetIsolinesImage(uint simulacionId, string imageBase64)
505 555
         {
506
-            string workingDirectory = @"C:\Users\Admin\Desktop\TestExtract\simulaicionsimulacion_test\";
507
-            string headFile = @"C:\Users\Admin\Desktop\TestExtract\simulaicionsimulacion_test\EJEMPLO_SOTIEL.HDS";
556
+            Simulacion simulacion = _context.Simulaciones.Find(simulacionId);
557
+            Logger.WriteLog("sim "+simulacion.Id);
558
+            if (simulacionId != simulacion.Id)
559
+            {
560
+                return BadRequest();
561
+            }
508 562
 
509
-            int rows, cols;
510
-            piezometriaController.getDimensions(simulacionId, out rows, out cols);
511
-            await serviceController.GetIsolinesWithPython(workingDirectory, headFile, rows, cols);
512
-            Thread.Sleep(3000);
513
-            return true;
514
-        }
515 563
 
516
-        [HttpGet("Piezometria")]
517
-        public async Task<ActionResult<IEnumerable<Simulacion>>> SimPiezometria()
518
-        {
519
-            Logger.WriteLog("inicio piezometria");
520
-            Parser parser = new Parser();
521
-            string piezometryFile = @"C:\Users\Admin\Desktop\TestExtract\simulaicionsimulacion_test\EJEMPLO_SOTIEL.HDS";
522
-            List<Piezometria> piezometrias = parser.ParseBinaryFile(piezometryFile, 4);
523
-            Logger.WriteLog("Fin parseo fichero binario");
524
-            Logger.WriteLog("Hay " + piezometrias.Count + " elementos de piezometria");
525
-            foreach (Piezometria p in piezometrias)
564
+            simulacion.IsolineImage = imageBase64;
565
+            Logger.WriteLog(imageBase64);
566
+
567
+            _context.Entry(simulacion).State = EntityState.Modified;
568
+
569
+            try
570
+            {
571
+                await _context.SaveChangesAsync();
572
+            }
573
+            catch (Exception ex)
526 574
             {
527
-                await piezometriaController.PostPiezometria(p);
575
+                if (!SimulacionExists(simulacionId))
576
+                {
577
+                    return NotFound();
578
+                }
579
+                else
580
+                {
581
+                    Logger.WriteLog(ex.Message);
582
+                    Logger.WriteLog(ex.InnerException.Message);
583
+                    throw;
584
+                }
528 585
             }
529
-            Logger.WriteLog("fin piezometria");
530
-            return await GetSimulaciones();
586
+            Logger.WriteLog("OKIDOKI ISO SAVED");
587
+            return CreatedAtAction("GetSimulacion", new { id = simulacion.Id }, simulacion);
531 588
         }
532 589
     }
533 590
 }

+ 5 - 4
WorkerService1/WebApplication3/Controllers/TsPiezometerController.cs Wyświetl plik

@@ -10,8 +10,9 @@ using WebApplication3.Clases;
10 10
 
11 11
 namespace WebApplication3.Controllers
12 12
 {
13
-    [Route("api/[controller]")]
14
-    [ApiController]
13
+    //[Route("api/[controller]")]
14
+    //[ApiController]
15
+    [ApiExplorerSettings(IgnoreApi = true)]
15 16
     public class TsPiezometerController: ControllerBase
16 17
     {
17 18
         private readonly AquiferContext _context;
@@ -37,7 +38,7 @@ namespace WebApplication3.Controllers
37 38
             //var tsPozo = await _context.TsPozos.FindAsync(id);
38 39
             var tsPiezometers = _context.TsPiezometers.Where(x => x.PiezometerId == id);
39 40
 
40
-            List<TimeSerie> timeSeries = new List<TimeSerie>();
41
+            List<TimeSerie> timeSeries = new ();
41 42
             TimeSerie timeSerie = null;
42 43
 
43 44
             if (tsPiezometers == null)
@@ -47,7 +48,7 @@ namespace WebApplication3.Controllers
47 48
 
48 49
             foreach(TsPiezometer tsp in tsPiezometers)
49 50
             {
50
-                timeSerie = new TimeSerie();
51
+                timeSerie = new ();
51 52
                 timeSerie.Hora = tsp.Day;
52 53
                 timeSerie.Valor = tsp.Quote;
53 54
                 timeSeries.Add(timeSerie);

+ 3 - 2
WorkerService1/WebApplication3/Controllers/TsPozoController.cs Wyświetl plik

@@ -10,8 +10,9 @@ using WebApplication3.Clases;
10 10
 
11 11
 namespace WebApplication3.Controllers
12 12
 {
13
-    [Route("api/[controller]")]
14
-    [ApiController]
13
+    //[Route("api/[controller]")]
14
+    //[ApiController]
15
+    [ApiExplorerSettings(IgnoreApi = true)]
15 16
     public class TsPozoController : ControllerBase
16 17
     {
17 18
         private readonly AquiferContext _context;

+ 3 - 2
WorkerService1/WebApplication3/Controllers/TsRecargaController.cs Wyświetl plik

@@ -10,8 +10,9 @@ using WebApplication3.Models;
10 10
 
11 11
 namespace WebApplication3.Controllers
12 12
 {
13
-    [Route("api/[controller]")]
14
-    [ApiController]
13
+    //[Route("api/[controller]")]
14
+    //[ApiController]
15
+    [ApiExplorerSettings(IgnoreApi = true)]
15 16
     public class TsRecargaController : ControllerBase
16 17
     {
17 18
         private readonly AquiferContext _context;

+ 2 - 0
WorkerService1/WebApplication3/Models/Acuifero.cs Wyświetl plik

@@ -13,5 +13,7 @@ namespace WebApplication3.Models
13 13
         public string WorldOriginX { get; set; }
14 14
         public string WorldOriginY { get; set; }
15 15
         public string RechargeGeometry { get; set; }
16
+        public string RechargeColorMap { get; set; }
17
+
16 18
     }
17 19
 }

+ 14 - 0
WorkerService1/WebApplication3/Models/AquiferContext.cs Wyświetl plik

@@ -75,6 +75,8 @@ namespace WebApplication3.Models
75 75
                 entity.Property(e => e.WorldOriginX).HasColumnName("world_origin_x");
76 76
                 entity.Property(e => e.WorldOriginY).HasColumnName("world_origin_y");
77 77
                 entity.Property(e => e.RechargeGeometry).HasColumnName("recharge_geometry");
78
+                entity.Property(e => e.RechargeColorMap).HasColumnName("recharge_color_map");
79
+
78 80
 
79 81
 
80 82
 
@@ -250,6 +252,15 @@ namespace WebApplication3.Models
250 252
                     .HasMaxLength(255)
251 253
                     .HasColumnName("isoline_image");
252 254
 
255
+                entity.Property(e => e.Geojson)
256
+                    .HasMaxLength(255)
257
+                    .HasColumnName("geojson");
258
+
259
+                entity.Property(e => e.SimulacionAcuifero)
260
+                    .HasColumnType("int(10) unsigned")
261
+                    .HasColumnName("simulacion_acuifero")
262
+                    .HasDefaultValueSql("0");
263
+
253 264
                 entity.HasKey(e => e.Id)
254 265
                 .HasName("id");
255 266
             });
@@ -358,6 +369,8 @@ namespace WebApplication3.Models
358 369
                 entity.Property(e => e.Recharge).HasColumnName("recharge");
359 370
 
360 371
                 entity.Property(e => e.Drains).HasColumnName("drains");
372
+                entity.Property(e => e.Wells).HasColumnName("wells");
373
+
361 374
 
362 375
                 entity.Property(e => e.ConstantHead).HasColumnName("constant_head");
363 376
 
@@ -385,6 +398,7 @@ namespace WebApplication3.Models
385 398
                 entity.Property(e => e.Recharge).HasColumnName("recharge");
386 399
 
387 400
                 entity.Property(e => e.Drains).HasColumnName("drains");
401
+                entity.Property(e => e.Wells).HasColumnName("wells");
388 402
 
389 403
                 entity.Property(e => e.ConstantHead).HasColumnName("constant_head");
390 404
 

+ 1 - 0
WorkerService1/WebApplication3/Models/DatosBalanceIn.cs Wyświetl plik

@@ -13,6 +13,7 @@ namespace WebApplication3.Models
13 13
         public string Storage { get; set; }
14 14
         public string ConstantHead { get; set; }
15 15
         public string Drains { get; set; }
16
+        public string Wells { get; set; }
16 17
         public string Recharge { get; set; }
17 18
         public string Total { get; set; }
18 19
 

+ 1 - 0
WorkerService1/WebApplication3/Models/DatosBalanceOut.cs Wyświetl plik

@@ -13,6 +13,7 @@ namespace WebApplication3.Models
13 13
         public string Storage { get; set; }
14 14
         public string ConstantHead { get; set; }
15 15
         public string Drains { get; set; }
16
+        public string Wells { get; set; }
16 17
         public string Recharge { get; set; }
17 18
         public string Total { get; set; }
18 19
 

+ 20 - 0
WorkerService1/WebApplication3/Models/Piezometer.cs Wyświetl plik

@@ -0,0 +1,20 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using WebApplication3.Clases;
4
+
5
+#nullable disable
6
+
7
+namespace WebApplication3.Models
8
+{
9
+    public partial class Piezometer
10
+    {
11
+        public uint Id { get; set; }
12
+        public string Name { get; set; }
13
+        public string X { get; set; }
14
+        public string Y { get; set; }
15
+        public string Z { get; set; }
16
+        public string Prof { get; set; }
17
+        public string ScreenTop { get; set; }
18
+        public string ScreenBot { get; set; }
19
+    }
20
+}

+ 2 - 0
WorkerService1/WebApplication3/Models/Pozo.cs Wyświetl plik

@@ -22,6 +22,7 @@ namespace WebApplication3.Models
22 22
         public string Prof { get; set; }
23 23
         public string ScreenTop { get; set; }
24 24
         public string ScreenBot { get; set; }
25
+        public uint Active { get; set; }
25 26
 
26 27
         public Pozo Copy(uint? idSimulacion)
27 28
         {
@@ -33,6 +34,7 @@ namespace WebApplication3.Models
33 34
             pozo.Maximo = this.Maximo;
34 35
             pozo.Minimo = this.Minimo;
35 36
             pozo.Nombre = this.Nombre;
37
+            pozo.Active = this.Active;
36 38
             return pozo;
37 39
         }
38 40
     }

+ 2 - 0
WorkerService1/WebApplication3/Models/Simulacion.cs Wyświetl plik

@@ -11,5 +11,7 @@ namespace WebApplication3.Models
11 11
         public uint? IdAcuifero { get; set; }
12 12
         public string Nombre { get; set; }
13 13
         public string IsolineImage { get; set; }
14
+        public string Geojson { get; set; }
15
+        public uint SimulacionAcuifero { get; set; }
14 16
     }
15 17
 }

+ 1 - 0
WorkerService1/WebApplication3/Models/TSPozo.cs Wyświetl plik

@@ -22,6 +22,7 @@ namespace WebApplication3.Models
22 22
             tsPozo.IdPozo = pozoId;
23 23
             tsPozo.Valor = this.Valor;
24 24
             tsPozo.MarcaTiempo = this.MarcaTiempo;
25
+            tsPozo.MarcaTiempoEnd = this.MarcaTiempoEnd;
25 26
             tsPozo.InfoComplementaria = this.InfoComplementaria;
26 27
 
27 28
             return tsPozo;