public void Tenir(Tenido teñido, string codigoTela) { teñido.Codigo = teñido.Tela.Codigo + "_" + teñido.Tinte.Codigo + "_TÑD"; teñido.Tinte.Cantidad -= teñido.CantidadTinteUtilizada; teñido.Tela.Cantidad -= teñido.CantidadTelaUtilizada; Random r = new Random(); teñido.Tiempo = r.Next(3600, 5400); //Puede durar entre 1 hora y 1 hora y media sin importar la cantidad de tela (limitado por el límite de la máquina). // El promedio de teñido suele durar entre 1 hora a 1 hora y media y puede extenderse un poco más dependiendo a que //otros procesos de control de teñido se exponga. En este caso suponemos que puede durar entre 1 a 1 hora y media únicamente. // Aunque estos datos son generalizados y con máquinas promedio, ya que el tiempo puede ser más o menos según bastantes factores // relacionados a la máquina, a la tela y otros factores que exeden el nivel de complejidad del proyecto. int telasObtenidas = teñido.CantidadTelaUtilizada; TinteGestor tinteGestor = new TinteGestor(); tinteGestor.Modificar(teñido.Tinte); TelaGestor telaGestor = new TelaGestor(); telaGestor.Modificar(teñido.Tela); List <Tela> telasExistentes = telaGestor.GetListTela(); if (telasExistentes.Exists(t => t.Codigo == codigoTela) && telasExistentes.Exists(t => t.Color == teñido.Tinte.Color)) { Tela existente = telaGestor.GetTela(telasExistentes.Find(t => t.Codigo == codigoTela)); existente.Cantidad += telasObtenidas; existente.Color = teñido.Tinte.Color; existente.Teñido = true; telaGestor.Modificar(existente); } else { telaGestor.Alta(new Tela(codigoTela, teñido.Tela.Descripcion, telasObtenidas, teñido.Tinte.Color, true)); } bd.Alta(teñido); }
private void btn_AltaTela_Click(object sender, EventArgs e) { controller.AltaTela(txt_Codigo.Text, txt_Descripcion.Text, int.Parse(txt_Cantidad.Text), txt_Color.Text, false); TelaGestor telaGestor = new TelaGestor(); dgv_Telas.DataSource = null; dgv_Telas.DataSource = telaGestor.GetListTela(); }
private void btn_BajaTela_Click(object sender, EventArgs e) { TelaGestor telaGestor = new TelaGestor(); Tela tela = dgv_Telas.SelectedRows[0].DataBoundItem as Tela; controller.BajaTela(tela); dgv_Telas.DataSource = null; dgv_Telas.DataSource = telaGestor.GetListTelaSinTeñir(); }
private void AreaCortado_Load(object sender, EventArgs e) { IniciarControles(); TelaGestor telaGestor = new TelaGestor(); PrendaGestor prendaGestor = new PrendaGestor(); dgv_Telas.DataSource = null; dgv_Telas.DataSource = telaGestor.GetListTela(); dgv_Prendas.DataSource = null; dgv_Prendas.DataSource = prendaGestor.GetListPrenda(); }
private void btn_ModificarTela_Click(object sender, EventArgs e) { TelaGestor telaGestor = new TelaGestor(); Tela tela = dgv_Telas.SelectedRows[0].DataBoundItem as Tela; tela.Descripcion = txt_Descripcion.Text; tela.Cantidad = int.Parse(txt_Cantidad.Text); controller.ModificarTela(tela); dgv_Telas.DataSource = null; dgv_Telas.DataSource = telaGestor.GetListTelaSinTeñir(); }
private void AreaTeñidoMenu_Load(object sender, EventArgs e) { IniciarControles(); TelaGestor telaGestor = new TelaGestor(); TinteGestor tinteGestor = new TinteGestor(); dgv_Telas.DataSource = null; dgv_Telas.DataSource = telaGestor.GetListTelaSinTeñir(); dgv_TelasTeñidas.DataSource = null; dgv_TelasTeñidas.DataSource = telaGestor.GetListTelaTeñida(); dgv_Tintes.DataSource = null; dgv_Tintes.DataSource = tinteGestor.GetListTinte(); }
private void btn_Cortar_Click(object sender, EventArgs e) { Tela tela = dgv_Telas.SelectedRows[0].DataBoundItem as Tela; int cantTela = int.Parse(Interaction.InputBox("¿Cuánta cantidad de la tela seleccionada desea utilizar?")); int dimensiones = int.Parse(Interaction.InputBox("Ingrese el área de la tela en m2")); string talle = Interaction.InputBox("Ingrese si el talle deseado es S, M o L"); string codigoPrenda = Interaction.InputBox("Ingrese el código de las prendas resultantes"); controller.Cortar(tela, cantTela, dimensiones, talle, codigoPrenda); TelaGestor telaGestor = new TelaGestor(); PrendaGestor prendaGestor = new PrendaGestor(); dgv_Telas.DataSource = null; dgv_Telas.DataSource = telaGestor.GetListTela(); dgv_Prendas.DataSource = null; dgv_Prendas.DataSource = prendaGestor.GetListPrenda(); }
public void TestTenido() { Controller controller = new Controller(); TenidoGestor tenidoGestor = new TenidoGestor(); bool condicion1 = false; bool condicion2 = false; bool condicion3 = false; TelaGestor telaGestor = new TelaGestor(); telaGestor.Alta(new Tela("TELA PRUEBA", "TELA DE PRUEBA", 5000, "", false)); Tela tela = controller.GetListTela().Find(t => t.Codigo == "TELA PRUEBA"); int cantUtilizada = 2000; controller.AltaTinte("TINTE PRUEBA", "TINTE DE PRUEBA", 3000, "CELESTE"); Tinte tinte = controller.GetListTinte().Find(t => t.Codigo == "TINTE PRUEBA"); int cantTinteUtilizado = 1000; string codigoTelaTenida = "TELA TEÑIDA PRUEBA"; controller.Teñir(tela, cantUtilizada, tinte, cantTinteUtilizado, codigoTelaTenida); if (tela.Cantidad == 5000 - cantUtilizada && tinte.Cantidad == 3000 - cantTinteUtilizado) { condicion1 = true; } List <Tenido> tenidos = tenidoGestor.GetList(); Tenido tenidoResultante = tenidos.Find(t => t.CantidadTelaUtilizada == cantUtilizada && t.CantidadTinteUtilizada == cantTinteUtilizado && t.Tela.Codigo == tela.Codigo && t.Tinte.Codigo == tinte.Codigo); if (tenidoResultante != null) { condicion2 = true; } Tela telaResultante = controller.GetListTela().Find(t => t.Codigo == codigoTelaTenida && t.Teñido == true && t.Color == tinte.Color); if (telaResultante != null) { condicion3 = true; } Cleaner cleaner = new Cleaner(); cleaner.Clean("Teñido", "Id = " + tenidoResultante.Id); cleaner.Clean("Tela", "Id = " + tela.Id); cleaner.Clean("Tinte", "Id = " + tinte.Id); cleaner.Clean("Tela", "Id = " + telaResultante.Id); Assert.IsTrue(condicion1 && condicion2 && condicion3); }
private void btn_Tenir_Click(object sender, EventArgs e) { Tela tela = dgv_Telas.SelectedRows[0].DataBoundItem as Tela; Tinte tinte = dgv_Tintes.SelectedRows[0].DataBoundItem as Tinte; int cantTelaUtilizada = int.Parse(Interaction.InputBox("¿Cuánta cantidad de la tela seleccionada desea utilizar?")); int cantTinteUtilizado = int.Parse(Interaction.InputBox("¿Cuánta cantidad del tinte selecionado desea utilizar?")); string codigoTela = Interaction.InputBox("Ingrese el nombre de la tela tintada resultante"); controller.Teñir(tela, cantTelaUtilizada, tinte, cantTinteUtilizado, codigoTela); TelaGestor telaGestor = new TelaGestor(); TinteGestor tinteGestor = new TinteGestor(); dgv_Telas.DataSource = null; dgv_Telas.DataSource = telaGestor.GetListTelaSinTeñir(); dgv_TelasTeñidas.DataSource = null; dgv_TelasTeñidas.DataSource = telaGestor.GetListTelaTeñida(); dgv_Tintes.DataSource = null; dgv_Tintes.DataSource = tinteGestor.GetListTinte(); }
public void Cortar(Corte corte, string codigoPrenda) { corte.Codigo = corte.Tela.Codigo + "CRT"; corte.Tela.Cantidad -= corte.CantidadTela; // velocidad de 2000 cm/s máxima aprox. corte.Tiempo = (corte.CantidadTela * corte.Dimensiones * 1000) / 2000; // CantidadTelas * Dimensiones * 1000 (para transformar de m2 a cm2) / velocidad máquina. // TO DO: Agregar tipo de prenda (remera, pantalón) y según el tipo de prenda apareceran los talles (S, M, L) correspondientes. int prendasObtenidas = corte.CantidadTela; if (corte.Talle == "S") { prendasObtenidas = prendasObtenidas * 8; } else if (corte.Talle == "M") { prendasObtenidas = prendasObtenidas * 6; } else { prendasObtenidas = prendasObtenidas * 4; } // por ahora S = 8, M = 6, L = 4; // Podría usar un Interpreter para que el talle pueda ser ingresado de distintas maneras pero ser traducido a S, M o L. TelaGestor telaGestor = new TelaGestor(); telaGestor.Modificar(corte.Tela); PrendaGestor prendaGestor = new PrendaGestor(); List <Prenda> prendasExistentes = prendaGestor.GetListPrenda(); if (prendasExistentes.Exists(p => p.Codigo == codigoPrenda)) { Prenda existente = prendaGestor.GetPrenda(prendasExistentes.Find(p => p.Codigo == codigoPrenda)); existente.Cantidad += prendasObtenidas; prendaGestor.Modificar(existente); } else { prendaGestor.Alta(new Prenda(codigoPrenda, "Corte de " + corte.Tela.Descripcion, prendasObtenidas, corte.Talle, false)); } bd.Alta(corte); }
public void Tejer(Tejido tejido, string codigoTela) { tejido.Codigo = tejido.Hilado.Codigo + "_TJD"; tejido.Hilado.Cantidad -= tejido.CantidadUtilizada; tejido.Tiempo = tejido.CantidadUtilizada * decimal.ToInt32(decimal.Floor(tejido.Hilado.Peso)) / 160; // Uso 160 porque es la velocidad promedio de los telares que encontré. La fórmula sería Tiempo = (tamaño + peso) / velocidad de tejido. int telasObtenidas = tejido.CantidadUtilizada / tejido.AreaTela; HiladoGestor hiladoGestor = new HiladoGestor(); hiladoGestor.Modificar(tejido.Hilado); TelaGestor telaGestor = new TelaGestor(); List <Tela> telasExistentes = telaGestor.GetListTela(); if (telasExistentes.Exists(t => t.Codigo == codigoTela)) { Tela existente = telaGestor.GetTela(telasExistentes.Find(t => t.Codigo == codigoTela)); existente.Cantidad += telasObtenidas; telaGestor.Modificar(existente); } else { telaGestor.Alta(new Tela(codigoTela, "Proviene de " + tejido.Hilado.Descripcion + ".", telasObtenidas, "", false)); // cada 20 metros de tela utilizadas se crea 1 tela. } bd.Alta(tejido); }