public int offset = 2; //# columnas que no se debe replicar porque son fijas.

        public GeneradorEstibasPresenter(IUnityContainer container, IGeneradorEstibasView view)
        {
            View = view;
            this.container = container;
            this.service = new WMSServiceClient();
            View.Model = this.container.Resolve<GeneradorEstibasModel>();

            #region Metodos

            View.AddLine += new EventHandler<EventArgs>(this.OnAddLine);
            view.CargaMasiva += new EventHandler<DataEventArgs<DataTable>>(this.OnCargaMasiva);
            View.ReplicateDetails += new EventHandler<EventArgs>(this.OnReplicateDetails);
            View.SaveDetails += new EventHandler<EventArgs>(this.OnSaveDetails);

            #endregion

            #region Datos

            //Cargo la variable para las consultas directas
            try { Local = service.GetConnection(new Connection { Name = "LOCAL" }).First(); }
            catch { }

            //Cargo los productos
            View.Model.ListadoProductos = service.GetProduct(new Product { Reference = "1" });

            //Cargo los datos del listado
            CargarDatosDetails();

            #endregion
        }
        public DespachosPresenter(IUnityContainer container, IDespachosView view)
        {
            View = view;
            this.container = container;
            this.service = new WMSServiceClient();
            View.Model = this.container.Resolve<DespachosModel>();

            #region Metodos

            #region Header

            View.CargarHeader += new EventHandler<DataEventArgs<Bin>>(this.OnCargarHeader);
            View.ConfirmBasicData += new EventHandler<EventArgs>(this.OnConfirmBasicData);
            View.CancelBasicData += new EventHandler<EventArgs>(this.OnCancelBasicData);
            View.NewBasicData += new EventHandler<EventArgs>(this.OnNewBasicData);

            #endregion

            #region Serial

            View.AddLine += new EventHandler<EventArgs>(this.OnAddLine);

            #endregion

            #region Details

            View.SaveDetails += new EventHandler<EventArgs>(this.OnSaveDetails);

            #endregion

            #endregion

            #region Datos

            View.Model.HeaderDocument = new Document();
            View.Model.RecordCliente = service.GetLocation(new Location { LocationID = App.curLocation.LocationID }).First();
            View.Model.ListBinDespachosAlmacen = service.GetBin(new Bin { LevelCode = "D", Location = View.Model.RecordCliente });
            //BinDespachos = service.GetBin(new Bin { BinCode = View.Model.RecordCliente.AddressLine2, Location = View.Model.RecordCliente }).First();
            ProductDefault = service.GetProduct(new Product { ProductCode = WmsSetupValues.DEFAULT }).First();
            LocationDespachos = service.GetLocation(new Location { ErpCode = "DESPACHOS" }).First();
            View.Model.ListLabelScann = new List<WpfFront.WMSBusinessService.Label>();
            View.Model.ListDataInformation = new List<DataInformation>();
            //CargarDatosHeader();

            #endregion
        }
        public EntradaAlmacenV2Presenter(IUnityContainer container, IEntradaAlmacenV2View view)
        {
            View = view;
            this.container = container;
            this.service = new WMSServiceClient();
            View.Model = this.container.Resolve<EntradaAlmacenV2Model>();

            #region Metodos

            View.AddLine += new EventHandler<EventArgs>(this.OnAddLine);
            view.CargaMasiva += new EventHandler<EventArgs>(this.OnCargaMasiva);
            view.CargaMasiva_Alerta += new EventHandler<EventArgs>(this.OnCargaMasiva_Alerta);
            View.ReplicateDetails += new EventHandler<EventArgs>(this.OnReplicateDetails);
            View.ReplicateDetailsBy_Column += new EventHandler<RoutedEventArgs>(this.OnReplicateDetailsBy_Column);
            View.SaveDetails += new EventHandler<EventArgs>(this.OnSaveDetails);
            View.SaveDetails_Prealert += new EventHandler<EventArgs>(this.OnSaveDetails_Prealert);
            View.SavePrealertAll += new EventHandler<EventArgs>(this.OnSavePrealert);
            View.DeleteDetails += new EventHandler<EventArgs>(this.OnDeleteDetails);
            View.ExportCargue += new EventHandler<EventArgs>(this.OnExportCargue);
            View.ExportCargueAlerta += new EventHandler<EventArgs>(this.OnExportCargueAlerta);
            view.KillProcess += new EventHandler<EventArgs>(this.OnKillProcess);

            #endregion

            #region Datos

            //Cargo la variable para las consultas directas
            try { Local = service.GetConnection(new Connection { Name = "LOCAL" }).First(); }
            catch { }

            //Cargo los productos en el tableview y se ordenan
            //View.Model.ListadoProductos = service.GetProduct(new Product { Reference = "425" });
            IList<Product> list = service.GetProduct(new Product { Reference = "425" });
            IEnumerable<Product> sortedEnum = list.OrderBy(f => f.Brand);
            IList<Product> sortedList = sortedEnum.ToList();

            View.Model.ListadoProductos = sortedList;

            //Cargo los listados de los detalles
            View.Model.ListadoOrigen = service.GetMMaster(new MMaster { MetaType = new MType { Code = "REMISIONRR" } });
            //View.Model.ListadoCiudades = service.GetMMaster(new MMaster { MetaType = new MType { Code = "CIUDAD" } });
            View.Model.ListadoAliado = service.GetMMaster(new MMaster { MetaType = new MType { Code = "ALIADO" } });
            //View.Model.ListadoCodigoSAP = service.GetMMaster(new MMaster { MetaType = new MType { Code = "TELMEXCOD" } });
            View.Model.ListadoEstadoRR = service.GetMMaster(new MMaster { MetaType = new MType { Code = "ESTADO RR" } });
            View.Model.ListadoTipoREC = service.GetMMaster(new MMaster { MetaType = new MType { Code = "REC" } });
            //View.Model.ListadoCentros = service.GetMMaster(new MMaster { MetaType = new MType { Code = "CENTRO" } });
            //View.Model.ListadoFamilias = service.GetMMaster(new MMaster { MetaType = new MType { Code = "FAMILIA" } });

            View.Model.ListadoPreaTipoRecoleccion = service.GetMMaster(new MMaster { MetaType = new MType { Code = "PREATREC" } });
            View.Model.ListadoPreaTipoOrigen = service.GetMMaster(new MMaster { MetaType = new MType { Code = "PREATORIGE" } });

            //Cargo los datos del listado
            CargarDatosDetails();

            #endregion
        }
        public AdministradorPresenter(IUnityContainer container, IAdministradorView view)
        {
            View = view;
            this.container = container;
            this.service = new WMSServiceClient();
            View.Model = this.container.Resolve<AdministradorModel>();


            #region Metodos

            //View.ConfirmBasicData += new EventHandler<EventArgs>(this.OnConfirmBasicData);
            //View.EvaluarTipoProducto += new EventHandler<DataEventArgs<Product>>(this.OnEvaluarTipoProducto);
            View.AddLine += new EventHandler<EventArgs>(this.OnAddLine);
            View.CargarDatosAdministrador += new EventHandler<EventArgs>(this.CargarDatosAdministrador);
            view.CargaMasiva += new EventHandler<DataEventArgs<DataTable>>(this.OnCargaMasiva);
            View.ReplicateDetails += new EventHandler<EventArgs>(this.OnReplicateDetails);
            View.SaveDetails += new EventHandler<EventArgs>(this.OnSaveDetails);
            View.ConfirmarMovimiento += new EventHandler<EventArgs>(this.OnConfirmarMovimiento);
            View.ReiniciarCapacitacion += new EventHandler<EventArgs>(this.OnReiniciarCapacitacion);
            View.ConsultarMovimientos += new EventHandler<EventArgs>(this.OnConsultarMovimientos);
            View.BuscarEquipoTracking += new EventHandler<EventArgs>(this.OnBuscarEquipoTracking);

            //Recibo
            View.BuscarRegistrosRecibo += this.OnBuscarRegistrosRecibo;
            View.BuscarNombreMaterial += this.OnBuscarNombreMaterial;
            View.ActualizarRegistrosRecibo += this.OnActualizarRegistrosRecibo;
            View.ConfirmarRecibo += this.OnConfirmarRecibo;

            //ConfirmarMovimiento
            #endregion

            #region Datos

            View.Model.HeaderDocument = new Document();
            View.Model.RecordCliente = service.GetLocation(new Location { LocationID = App.curLocation.LocationID }).First();
            View.Model.ListBinEntradaAlmacen = service.GetBin(new Bin { BinID = 4 });

            try { Local = service.GetConnection(new Connection { Name = "LOCAL" }).First(); }
            catch { }


            View.Model.ListadoEstatusLogPro = service.GetMMaster(new MMaster { MetaType = new MType { Code = "LOGPROSTAT" } });
            View.Model.ListadoPosiciones = service.GetMMaster(new MMaster { MetaType = new MType { Code = "POSICION1" } });
            //View.Model.ListadoModelos = service.GetMMaster(new MMaster { MetaType = new MType { Code = "DRIRECMODE" } });
            View.Model.ListadoOrigen = service.GetMMaster(new MMaster { MetaType = new MType { Code = "ALIADO" } });
            View.Model.ListadoTipoOrigen = service.GetMMaster(new MMaster { MetaType = new MType { Code = "REMISIONRR" } });
            View.Model.ListadoTipoREC = service.GetMMaster(new MMaster { MetaType = new MType { Code = "REC" } });
            View.Model.ListadoFallas = service.GetMMaster(new MMaster { MetaType = new MType { Code = "FALLADIA" } });
            View.Model.ListadoMotScrap = service.GetMMaster(new MMaster { MetaType = new MType { Code = "MOTSCRAP" } });
            View.Model.ListadoEstadoRR = service.GetMMaster(new MMaster { MetaType = new MType { Code = "ESTADO RR" } });
            View.Model.ListadoProductos = service.GetProduct(new Product());

            View.Model.ListadoEquipos = service.DirectSQLQuery("exec sp_GetProcesos2 'HISTORICOSERIAL'", "", "dbo.movimientoclaro", Local);

            #endregion
        }
        private void NewTask()
        {
            WMSServiceClient serv = new WMSServiceClient();

            DocumentType docType = new DocumentType { DocClass = new DocumentClass { DocClassID = SDocClass.Task } };
            docType.DocTypeID = SDocType.CountTask;

            // CAA [2010/05/05] Valida que se incluyan las columnas necesarias en el reporte
            // Indica si utiliza Product para la programacion del conteo.
            bool useProduct = true;
            if (cboToDo.SelectedIndex == 0) //Only BIN
            {
                useProduct = false;
                if (!products.Columns.Contains("BinCode"))
                {
                    Util.ShowError("BinCode column missing.");
                    return;
                }
            }
            else
                if (cboToDo.SelectedIndex == 1) // BIN & PRODUCT
                {
                    if (!products.Columns.Contains("BinCode") || !products.Columns.Contains("Product"))
                    {
                        Util.ShowError("BinCode and/or Product columns are missing.");
                        return;
                    }
                }

            Document document = new Document
            {
                DocType = docType,
                CrossDocking = false,
                IsFromErp = false,
                Location = App.curLocation,
                Company = App.curCompany,
                Date1 = DateTime.Today,
                CreationDate = DateTime.Now,
                CreatedBy = App.curUser.UserName,
                Notes = cboToDo.SelectedIndex.ToString()
            };
            document = serv.CreateNewDocument(document, true); // SaveDocument(document);


            // Details
            foreach (DataRow row in products.Rows)
            {
                //  ojo...  siempre deben enviar los alias "producto" "binCode" en el reporte !!!
                Product prod = null;
                try
                {
                    if (!string.IsNullOrEmpty(row["Product"].ToString()) && useProduct)
                        prod = serv.GetProduct(new Product { ProductCode = row["Product"].ToString() })[0];
                }
                catch { }

                Bin bin = null;
                try
                {
                    if (!string.IsNullOrEmpty(row["BinCode"].ToString()))
                        bin = serv.GetBin(new Bin { BinCode = row["BinCode"].ToString() })[0];
                }
                catch { }

                //Crea el BinTask en el server
                BinByTask binByTask = new BinByTask
                {
                    CreatedBy = App.curUser.UserName,
                    CreationDate = DateTime.Now,
                    Bin = bin,
                    Product = prod,
                    TaskDocument = document,
                    Status = new Status { StatusID = DocStatus.New }

                };

                try { serv.SaveBinByTask(binByTask); }
                catch  {  continue; }                

            }

            Util.ShowMessage("Counting Task " + document.DocNumber + " was created.");
            ClosePopup();
        }
Beispiel #6
0
        public ReciboPresenter(IUnityContainer container, IReciboView view)
        {
            View = view;
            this.container = container;
            this.service = new WMSServiceClient();
            View.Model = this.container.Resolve<ReciboModel>();

            #region Metodos

            View.AddLine += new EventHandler<EventArgs>(this.OnAddLine);
            view.CargaMasiva += new EventHandler<EventArgs>(this.OnCargaMasiva);
            View.ReplicateDetails += new EventHandler<EventArgs>(this.OnReplicateDetails);
            View.ReplicateDetailsBy_Column += new EventHandler<RoutedEventArgs>(this.OnReplicateDetailsBy_Column);
            View.SaveDetails += new EventHandler<EventArgs>(this.OnSaveDetails);
            View.DeleteDetails += new EventHandler<EventArgs>(this.OnDeleteDetails);
            view.KillProcess += new EventHandler<EventArgs>(this.OnKillProcess);
            View.ExportCargue += new EventHandler<EventArgs>(this.OnExportCargue);

            //PREALERTA
            view.CargaPrealerta += new EventHandler<EventArgs>(this.OnCargaPrealerta);
            View.SaveDetailsPrealerta += new EventHandler<EventArgs>(this.OnSaveDetailsPrealerta);
            View.ExportCarguePrea += new EventHandler<EventArgs>(this.OnExportCarguePrea);

            #endregion

            #region Datos

            //Cargo la variable para las consultas directas
            try { Local = service.GetConnection(new Connection { Name = "LOCAL" }).First(); }
            catch { }

            //Cargo los productos
            View.Model.ListadoProductos = service.GetProduct(new Product { Reference = "1" });

            //Cargo los lsitados de los combobx
            View.Model.ListadoModelosDescripcion = service.GetMMaster(new MMaster { MetaType = new MType { Code = "DRIRECMODE" } });

            //Cargo los datos del listado
            CargarDatosDetails();

            #endregion
        }
        public EntradaAlmacenPresenter(IUnityContainer container, IEntradaAlmacenView view)
        {
            View = view;
            this.container = container;
            this.service = new WMSServiceClient();
            View.Model = this.container.Resolve<EntradaAlmacenModel>();

            #region Metodos

            #region Header

            View.CargarHeader += new EventHandler<DataEventArgs<Bin>>(this.OnCargarHeader);
            View.ConfirmBasicData += new EventHandler<EventArgs>(this.OnConfirmBasicData);
            View.CancelBasicData += new EventHandler<EventArgs>(this.OnCancelBasicData);
            View.NewBasicData += new EventHandler<EventArgs>(this.OnNewBasicData);
            View.MostrarInformacion += new EventHandler<EventArgs>(this.OnMostrarInformacion); //MostrarInformacion.

            #endregion

            #region Serial

            View.EvaluarTipoProducto += new EventHandler<DataEventArgs<Product>>(this.OnEvaluarTipoProducto);
            View.AddLine += new EventHandler<EventArgs>(this.OnAddLine);

            #endregion

            #region Details

            View.SaveDetails += new EventHandler<EventArgs>(this.OnSaveDetails);
            View.ReplicateDetails += new EventHandler<EventArgs>(this.OnReplicateDetails);
            View.Imprimir += new EventHandler<EventArgs>(this.OnImprimir);

            #endregion

            #endregion

            #region Datos

            View.Model.HeaderDocument = new Document();
            View.Model.RecordCliente = service.GetLocation(new Location { LocationID = App.curLocation.LocationID }).First();
            View.Model.ListBinEntradaAlmacen = service.GetBin(new Bin { LevelCode = "R", Location = View.Model.RecordCliente });
            ProductDefault = service.GetProduct(new Product { ProductCode = WmsSetupValues.DEFAULT }).First();
            //string fullyqualifiedname = new DateTime().GetType().AssemblyQualifiedName;
            try { Local = service.GetConnection(new Connection { Name = "LOCAL" }).First(); }
            catch { }

            #endregion
        }
        public MoverMercanciaPresenter(IUnityContainer container, IMoverMercanciaView view)
        {
            View = view;
            this.container = container;
            this.service = new WMSServiceClient();
            View.Model = this.container.Resolve<MoverMercanciaModel>();

            #region Metodos

            #region Cambio Ubicaciones

            View.BuscarRegistrosCambioUbicaciones += this.OnBuscarRegistrosCambioUbicaciones;
            View.ActualizarRegistrosCambioUbicaciones += this.OnActualizarRegistrosCambioUbicaciones;
            View.HabilitarCambioUbicacion += this.OnHabilitarCambioUbicacion;
            View.GuardarNuevaUbicacion += this.OnGuardarNuevaUbicacion;
            View.FilaSeleccionada += this.OnFilaSeleccionada;

            #endregion

            #region Cambio Clasificacion

            View.BuscarRegistrosCambioClasificacion += this.OnBuscarRegistrosCambioClasificacion;
            View.ActualizarRegistrosCambioClasificacion += this.OnActualizarRegistrosCambioClasificacion;
            View.HabilitarCambioClasificacion += this.OnHabilitarCambioClasificacion;
            View.GuardarNuevaClasificacion += this.OnGuardarNuevaClasificacion;
            View.ImprimirRegistros += this.OnImprimirRegistros;
            View.ExportPalletSeleccion += this.OnExportPalletSeleccion;
            View.ExportSerialesSeleccion += this.OnExportSerialesSeleccion;
            #endregion

            #region Recibo

            View.ActualizarRegistrosRecibo += this.OnActualizarRegistrosRecibo;
            View.ConfirmarMovimiento += new EventHandler<EventArgs>(this.OnConfirmarMovimiento);
            View.BuscarRegistrosRecibo += this.OnBuscarRegistrosRecibo;
            View.Imprimir_Hablador += new EventHandler<EventArgs>(this.OnImprimir_Hablador);
            View.FilaSeleccionadaRecibo += this.OnFilaSeleccionadaRecibo;

            //Cargo las ubicaciones
            //View.Model.ListadoPosiciones = service.GetMMaster(new MMaster { MetaType = new MType { Code = "POSICION1" } });
            //View.Model.ListadoPosicionesRecibo = service.GetMMaster(new MMaster { MetaType = new MType { Code = "POSICION1" } });
            //this.Actualizar_UbicacionDisponible();

            #endregion

            #endregion

            #region Datos

            //Cargo la conexion local
            try { Local = service.GetConnection(new Connection { Name = "LOCAL" }).First(); }
            catch { }

            this.Actualizar_UbicacionDisponible();

            View.Model.ListadoProductos = service.GetProduct(new Product { Reference = "1" });

            //Cargo el nombre de los productos en almacenamiento a los comobobox de filtrado 
            View.Model.ListadoProductosActivos = service.DirectSQLQuery("select productoid from dbo.EquiposCLARO where estado = 'ALMACENAMIENTO' group by productoid ", "", "dbo.EquiposCLARO", Local);

            //Cargo los datos del listado de ubicaciones destino
            View.Model.ListUbicacionesDestino = service.DirectSQLQuery("EXEC sp_GetProcesos 'UBICACIONESDESTINO', 'ALMACENAMIENTO', 'CLARO'", "", "dbo.Ubicaciones", Local);

            View.Model.ListUbicacionesDestino_Recibo = service.DirectSQLQuery("EXEC sp_GetProcesos 'UBICACIONESDESTINO', 'RECIBOALMACEN', 'CLARO'", "", "dbo.Ubicaciones", Local);

            #endregion
        }