public UnitPresenter(IUnityContainer container, IUnitView view) { View = view; this.container = container; this.service = new WMSServiceClient(); View.Model = this.container.Resolve<UnitModel>(); //Event Delegate View.LoadSearch += new EventHandler<DataEventArgs<string>>(this.OnLoadSearch); View.New += new EventHandler<EventArgs>(this.OnNew); View.LoadData += new EventHandler<DataEventArgs<Unit>>(this.OnLoadData); View.Save += new EventHandler<EventArgs>(this.OnSave); View.Delete += new EventHandler<EventArgs>(this.OnDelete); View.ShowOnlyGroups += new EventHandler<EventArgs>(OnShowOnlyGroups); ProcessWindow pw = new ProcessWindow("Loading ..."); View.Model.EntityList = service.GetUnit(new Unit { Company = App.curCompany }); View.Model.Record = null; View.TxtUnitGroup.IsEnabled = false; //List Height View.ListRecords.MaxHeight = SystemParameters.FullPrimaryScreenHeight - 250; //loading Units View.Model.UnitGroupList = service.GetUnit(new Unit { Company = App.curCompany, BaseAmount = 1 }).Where(f=>f.BaseAmount==1).ToList(); pw.Close(); }
public LocationPresenter(IUnityContainer container, ILocationView view) { View = view; this.container = container; this.service = new WMSServiceClient(); View.Model = this.container.Resolve<LocationModel>(); //Event Delegate View.LoadSearch += new EventHandler<DataEventArgs<string>>(this.OnLoadSearch); View.New += new EventHandler<EventArgs>(this.OnNew); View.LoadData += new EventHandler<DataEventArgs<Location>>(this.OnLoadData); View.Save += new EventHandler<EventArgs>(this.OnSave); View.Delete += new EventHandler<EventArgs>(this.OnDelete); ProcessWindow pw = new ProcessWindow("Loading ..."); View.Model.EntityList = service.GetLocation(new Location()); View.Model.Record = new Location { Status = new Status() }; //List Height View.ListRecords.MaxHeight = SystemParameters.FullPrimaryScreenHeight - 250; pw.Close(); }
public ConfigOptionPresenter(IUnityContainer container, IConfigOptionView view) { View = view; this.container = container; this.service = new WMSServiceClient(); View.Model = this.container.Resolve<ConfigOptionModel>(); //Event Delegate View.LoadSearch += new EventHandler<DataEventArgs<string>>(this.OnLoadSearch); View.New += new EventHandler<EventArgs>(this.OnNew); View.LoadData += new EventHandler<DataEventArgs<ConfigOptionByCompany>>(this.OnLoadData); View.Save += new EventHandler<EventArgs>(this.OnSave); View.Delete += new EventHandler<EventArgs>(this.OnDelete); View.FilterBy += new EventHandler<DataEventArgs<ConfigType>>(View_FilterBy); ProcessWindow pw = new ProcessWindow("Loading ..."); if (App.curRol.Rol.RolID == BasicRol.Admin) View.Model.EntityList = service.GetConfigOptionByCompany(new ConfigOptionByCompany { Company = App.curCompany }); else View.Model.EntityList = service.GetConfigOptionByCompany(new ConfigOptionByCompany { Company = App.curCompany }) .Where(f => f.ConfigOption.IsAdmin == true).ToList(); View.Model.Record = null; View.Model.TypeList = service.GetConfigType(new ConfigType()); View.Model.TypeList.Add(new ConfigType()); //List Height View.ListRecords.MaxHeight = SystemParameters.FullPrimaryScreenHeight - 250; pw.Close(); }
public SysUserPresenter(IUnityContainer container, ISysUserView view) { View = view; this.container = container; this.service = new WMSServiceClient(); View.Model = this.container.Resolve<SysUserModel>(); //Event Delegate View.LoadSearch += new EventHandler<DataEventArgs<string>>(this.OnLoadSearch); View.New += new EventHandler<EventArgs>(this.OnNew); View.LoadData += new EventHandler<EventArgs>(this.OnLoadData); View.Save += new EventHandler<EventArgs>(this.OnSave); View.Delete += new EventHandler<EventArgs>(this.OnDelete); View.AddRol += new EventHandler<EventArgs>(this.OnAddRol); View.RemoveFromList += new EventHandler<EventArgs>(this.OnRemoveFromList); ProcessWindow pw = new ProcessWindow("Loading ..."); View.Model.EntityList = service.GetSysUser(new SysUser()); //View.Model.Record = null; View.Model.LocationList = service.GetLocation(new Location { Company = App.curCompany }).OrderBy(f => f.Name).ToList(); View.Model.ListRol = service.GetRol(new Rol()).OrderBy(f=>f.Name).ToList(); pw.Close(); }
public ProductPresenter(IUnityContainer container, IProductView view) { View = view; this.container = container; this.service = new WMSServiceClient(); View.Model = this.container.Resolve<ProductModel>(); //Event Delegate View.LoadSearch += new EventHandler<DataEventArgs<string>>(this.OnLoadSearch); View.New += new EventHandler<EventArgs>(this.OnNew); View.LoadData += new EventHandler<DataEventArgs<Product>>(this.OnLoadData); View.Save += new EventHandler<EventArgs>(this.OnSave); View.Delete += new EventHandler<EventArgs>(this.OnDelete); View.AssignBinToProduct += new EventHandler<DataEventArgs<Bin>>(OnAssignBinToProduct); View.RemoveFromList += new EventHandler<EventArgs>(this.OnRemoveFromList); View.AddProductTrackOption += new EventHandler<EventArgs>(OnAddProductTrackOption); View.AddProductUnit += new EventHandler<EventArgs>(OnAddProductUnit); View.LoadUnitsFromGroup += new EventHandler<EventArgs>(OnLoadUnitsFromGroup); //View.LoadBins += new EventHandler<DataEventArgs<string>>(OnLoadBins); View.SetRequired += new EventHandler<DataEventArgs<object>>(View_SetRequired); View.UnSetRequired += new EventHandler<DataEventArgs<object>>(View_UnSetRequired); View.UpdateBinToProduct += new EventHandler<DataEventArgs<ZoneBinRelation>>(View_UpdateBinToProduct); View.AddAlternateProduct += new EventHandler<EventArgs>(View_AddAlternateProduct); View.AddProductAccount += new EventHandler<DataEventArgs<ProductAccountRelation>>(View_AddProductAccount); View.UpdateProductAccount += new EventHandler<DataEventArgs<object>>(View_UpdateProductAccount); //View.SetIsMain += new EventHandler<DataEventArgs<object>>(View_SetIsMain); //View.UnSetIsMain += new EventHandler<DataEventArgs<object>>(View_UnSetIsMain); ProcessWindow pw = new ProcessWindow("Loading ..."); View.Model.EntityList = service.GetProductApp(new Product { Company = App.curCompany, Reference = App.curLocation.LocationID.ToString() }, 25); View.Model.Record = null; View.Model.StatusList = App.EntityStatusList; //Load Pick Methods View.Model.PickMethods = App.PickMethodList; view.Model.TemplateList = service.GetLabelTemplate(new LabelTemplate { LabelType = new DocumentType { DocTypeID = LabelType.ProductLabel } }); view.Model.TemplateList.Add(new LabelTemplate()); //List Height View.ListRecords.MaxHeight = SystemParameters.FullPrimaryScreenHeight - 250; View.Model.CurAltern = new ProductAlternate(); //USE CASN if (Util.GetConfigOption("USECASN").Equals("T")) View.TbItmCasN.Visibility = Visibility.Visible; pw.Close(); }
internal static void PrintShipmentPackLabels(Document shipment) { if (shipment == null || shipment.DocID == 0) { Util.ShowError("Shipment must be created before reprint all Labels."); return; } //Open View Packages LabelTemplate template = null; try { template = (new WMSServiceClient()).GetLabelTemplate(new LabelTemplate { Header = WmsSetupValues.DefaultPackLabelTemplate }).First(); } catch { Util.ShowError("No packing label defined."); return; } ProcessWindow pw = new ProcessWindow("Printing Labels ... "); int x = 0; try { x = (new WMSServiceClient()).PrintPackageLabels(shipment); } catch (Exception ex) { pw.Close(); Util.ShowError("Error: " + ex.Message); } pw.Close(); }
public IqToolPresenter(IUnityContainer container, IIqToolView view) { View = view; this.container = container; this.service = new WMSServiceClient(); View.Model = this.container.Resolve<IqToolModel>(); View.SelectionData += new EventHandler<DataEventArgs<IqReportTable>>(OnSelectionChanged); View.RemoveFromSelected += new EventHandler<DataEventArgs<IqColumn>>(View_RemoveFromSelected); View.AddToSelected += new EventHandler<DataEventArgs<IqColumn>>(View_AddToSelected); View.UpdateReport += new EventHandler<EventArgs>(View_UpdateReport); ProcessWindow pw = new ProcessWindow("Loading Tool ..."); View.Model.CheckRules(); Initialize(); pw.Close(); }
public ShipRoutePresenter(IUnityContainer container, IShipRouteView view) { View = view; this.container = container; this.service = new WMSServiceClient(); View.Model = this.container.Resolve<ShipRouteModel>(); //Load Documents View.LoadDocuments += new EventHandler<EventArgs>(View_LoadDocuments); View.ProcessLines += new EventHandler<EventArgs>(View_ProcessLines); View.LoadOpenProcess += new EventHandler<DataEventArgs<Document>>(View_LoadOpenProcess); View.ShowTicket += new EventHandler<DataEventArgs<Document>>(View_ShowTicket); View.UpdateDriver += new EventHandler<DataEventArgs<string>>(view_UpdateDriver); View.CreateShipment += new EventHandler<EventArgs>(View_CreateShipment); View.ShowShipTkt += new EventHandler<EventArgs>(View_ShowShipTkt); //Inicializo las variables ProcessWindow pw = new ProcessWindow("Cargando Vista ..."); docType = new DocumentType { DocClass = new DocumentClass { DocClassID = SDocClass.Shipping } }; //Load Dates LoadDates(); //Load Routes LoadRoutes(); //Load Drivers LoadDrivers(); LoadOpenDocuments(); try { View.CboLocation.SelectedItem = App.curLocation; } catch { } pw.Close(); }
public CompanyPresenter(IUnityContainer container, ICompanyView view, IShellPresenter region) { View = view; this.container = container; this.region = region; this.service = new WMSServiceClient(); View.Model = this.container.Resolve<CompanyModel>(); //Event Delegate View.New += new EventHandler<EventArgs>(this.OnNew); View.LoadData += new EventHandler<DataEventArgs<Company>>(this.OnLoadData); View.Save += new EventHandler<EventArgs>(this.OnSave); View.Delete += new EventHandler<EventArgs>(this.OnDelete); View.SetLogo += new EventHandler<DataEventArgs<Stream>>(this.OnSetLogo); View.ViewConnections += new EventHandler<EventArgs>(this.OnViewConnections); ProcessWindow pw = new ProcessWindow("Loading ..."); View.Model.EntityList = service.GetCompany(new Company()); //load status View.Model.Status = service.GetStatus(new Status { StatusType = new StatusType { StatusTypeID = SStatusType.Active } }); //los connections View.Model.ErpConn = service.GetConnection(new Connection()); if (View.Model.EntityList != null && View.Model.EntityList.Count > 0) { LoadData(View.Model.EntityList[0]); View.ListRecords.SelectedIndex = 0; } pw.Close(); }
public MenuOptionPresenter(IUnityContainer container, IMenuOptionView view) { View = view; this.container = container; this.service = new WMSServiceClient(); View.Model = this.container.Resolve<MenuOptionModel>(); //Event Delegate View.LoadSearch += new EventHandler<DataEventArgs<string>>(this.OnLoadSearch); View.New += new EventHandler<EventArgs>(this.OnNew); View.LoadData += new EventHandler<DataEventArgs<MenuOption>>(this.OnLoadData); View.Save += new EventHandler<EventArgs>(this.OnSave); View.Delete += new EventHandler<EventArgs>(this.OnDelete); ProcessWindow pw = new ProcessWindow("Loading ..."); View.Model.EntityList = service.GetMenuOption(new MenuOption()); View.Model.Record = null; View.Model.MenuOptionTypeList = service.GetMenuOptionType(new MenuOptionType()); View.Model.OptionType = service.GetOptionType(new OptionType()); pw.Close(); }
private void LoadAccountDocuments(int accountID, bool showAll, bool showError) { pw = new ProcessWindow("Loading Documents ..."); //Reset Qty In Use for this user. //service.ResetQtyInUse(new ProductInventory { Location = App.curLocation, CreatedBy = App.curUser.UserName }); View.Model.CurrentDetails = null; View.Model.OrdersData = null; docLines = service.GetDocumentLine( new DocumentLine { Document = new Document { Customer = new Account { AccountID = accountID }, DocStatus = new Status { StatusID = DocStatus.PENDING }, DocType = new DocumentType { DocTypeID = SDocType.SalesOrder }, Location = App.curLocation }, LineStatus = new Status { StatusID = DocStatus.PENDING } } ).Where(f => f.LineStatus.StatusID == DocStatus.New) // || f.QtyBackOrder > 0 || f.QtyCancel > 0 .Where(f=>f.Product.Status.StatusID == EntityStatus.Active) //.Where(f => f.QtyPendingShip > 0) .ToList(); if (docLines == null || docLines.Count() == 0) { if (showError) { Util.ShowError("No pending documents for the Customer selected."); View.TabStep.Visibility = Visibility.Hidden; } pw.Close(); return; } //Account & Address View.Model.Customer = docLines.Select(f => f.Document.Customer).First(); View.Model.CustomerAddress = service.GetAccountAddress(new AccountAddress { Account = new Account { AccountID = accountID} }); View.Model.CustomerAddress.Insert(0,new AccountAddress { ErpCode = "NEW", FullDesc = "Add New Address ... " }); //Seleccionando Documentos. if (showAll) View.Model.OrdersDetail = docLines.OrderBy(f => f.Document.DocNumber).ToList(); else View.Model.OrdersDetail = docLines; IEnumerable<Document> docList = docLines.Select(f => f.Document).Distinct(); View.Model.OrdersData = GenerateMasterData(docList); pw.Close(); if (showAll) LoadAllDetails(); else { //select first View.DgDocument.Items.Refresh(); View.DgDocument.SelectedIndex = 0; LoadDetails(View.Model.OrdersData.Rows[0]); } View.TabStep.SelectedIndex = 0; }
private void LoadAllDetails() { pw = new ProcessWindow("Loading lines for all documents "); View.Model.CurrentDetails = View.Model.OrdersDetail; //Ejecuta la disponibilidad para los current details //if (View.Model.CurrentDetails.Any(f => f.IsDebit != true)) //{ #region INVENTORY LINE BY LINE //1. Obtener el Stock de los productos de los documentos de se cliente. View.Model.DocumentProductStock = service.GetDocumentProductStock(new Document { Customer = new Account { AccountID = View.Model.Customer.AccountID }, Location = App.curLocation, DocType = new DocumentType { DocTypeID = SDocType.SalesOrder }//, //DocStatus = new Status { StatusID = DocStatus.PENDING } }, null); //Allocated, Available de los productos del documento. //Obtiene la lista de productos para obtener su stock en uso (Product Inventory). //Allocated in this moment List<int> productList = new List<int>(); foreach (Int32 p in View.Model.CurrentDetails.Select(f => f.Product.ProductID).Distinct()) productList.Add(p); //Inventario en Use de esos productos productInUseList = service.GetProductInUseForMerged(productList, App.curLocation); double qtyAvailable, qtyInUse; //ProductStock piInUse; for (int i = 0; i < View.Model.CurrentDetails.Count; i++) { qtyInUse = 0; qtyAvailable = 0; if (View.Model.CurrentDetails[i].IsDebit == true) continue; if (View.Model.CurrentDetails[i].IsDebit == null) View.Model.CurrentDetails[i].IsDebit = false; View.Model.CurrentDetails[i].Note = View.Model.CurrentDetails[i].Document.DocNumber; //QTY AVAILABLE DE INVENTARIO - Debe Restarsele lo allocated y lo que este en uso //que sale de la clase product Inventory. try { qtyAvailable = View.Model.DocumentProductStock .Where(f => f.Product.ProductID == View.Model.CurrentDetails[i].Product.ProductID) .First().FullStock; } catch { qtyAvailable = 0; } qtyAvailable = (double)((int)(qtyAvailable * availabilityMark)); View.Model.CurrentDetails[i].QtyOnHand = qtyAvailable; //ON HAND //Cantidad en Uso - PROGRAMA. Allocated y Reservada try { //Otros documentos qtyInUse = productInUseList .Where(f => f.Product.ProductID == View.Model.CurrentDetails[i].Product.ProductID) .Sum(f=>f.Stock); } catch{} //qtyInUse = piInUse.QtyAllocated + piInUse.QtyInUse; //try //{ // //Adicionar En uso del order detail de otras lineas y el mismo producto // qtyInUse += View.Model.OrdersDetail // .Where(f => f.Product.ProductID == View.Model.CurrentDetails[i].Product.ProductID) // //&& f.LineID != View.Model.CurrentDetails[i].LineID) // .Sum(f => f.QtyInvoiced); //} //catch { } qtyAvailable -= qtyInUse; //Finalmente la cantidad que se puede usar. //Cantidad final disponible if (firstTime) { View.Model.CurrentDetails[i].QtyInvoiced = qtyInUse; //Allocated View.Model.CurrentDetails[i].QtyAvailable = ((qtyAvailable > 0) ? qtyAvailable : 0) / View.Model.CurrentDetails[i].Unit.BaseAmount; } View.Model.CurrentDetails[i].QtyAllocated = 0; //qtyToAllocated; View.Model.CurrentDetails[i].Sequence = 0; //BALANCE //Jun 08 2010 //View.Model.CurrentDetails[i].Quantity = View.Model.CurrentDetails[i].Quantity; // - View.Model.CurrentDetails[i].QtyShipped); } #endregion //productInUseList = null; //View.Model.DocumentProductStock = null; //} pw.Close(); firstTime = false; View.DgDetails.Items.Refresh(); View.TabStep.Visibility = Visibility.Visible; }
private void Btn_Guardar_Click(object sender, RoutedEventArgs e) { //Mostrar ventana de Cargando... ProcessWindow pw = new ProcessWindow("Procesando registros...por favor espere..."); SaveDetails(sender, e); //Cierro ventana de Cargando... pw.Visibility = Visibility.Collapsed; pw.Close(); Btn_Copiar.IsEnabled = true; btn_confirmar.IsEnabled = false; }
void View_DocumentUnChecked(object sender, DataEventArgs<int> e) { pw = new ProcessWindow("Unchecking lines ..."); IList<DocumentLine> docLines; //Chequea todas las lineas del documento que no esten checked if (View.ChkFilter.IsChecked == true) docLines = View.Model.OrdersDetail.Where(f => f.Document.DocID == e.Value).ToList(); else docLines = View.Model.OrdersDetail; foreach (DocumentLine dl in docLines) { if (dl.IsDebit == false) continue; dl.IsDebit = false; } pw.Close(); }
private void OnShowCrossDockDocuments(object sender, EventArgs e) { //Load Documents if (View.Model.HistoryList == null || View.Model.HistoryList.Count == 0) { pw = new ProcessWindow("Loading documents"); View.Model.HistoryList = service.GetDocument(new Document { DocType = new DocumentType { DocTypeID = SDocType.CrossDock } }); View.DgHistList.Items.Refresh(); pw.Close(); } }
private void fUpload_OnFileUpload(object sender, EventArgs e) { //Mostrar ventana de Cargando... ProcessWindow pw = new ProcessWindow("Cargando registros...por favor espere..."); //Procesar el Archivo Cargado if (fUpload.StreamFile != null) { string dataFile = Util.GetPlainTextString(fUpload.StreamFile); ProcessFile(sender, e, dataFile); } //Cierro ventana de Cargando... pw.Visibility = Visibility.Collapsed; pw.Close(); }
void View_ShowDocument(object sender, DataEventArgs<LabelTemplate> e) { if (e.Value == null) return; if (View.Model.CurOpenDoc == null || View.Model.CurOpenDoc.DocID == 0) { Util.ShowError("No document to open. Please create the merged document first."); return; } try { pw = new ProcessWindow("Opening Document Form "); UtilWindow.ShowDocument(e.Value, View.Model.CurOpenDoc.DocID, "", true); //"PDF995" pw.Close(); } catch { } finally { pw.Close(); } }
//03 - Marzo 2009 - Ventana de proceso private void ProcessWindow(string msg, bool closeBefore){ if (closeBefore) pw.Close(); pw = new ProcessWindow(msg); }
public void LoadDetails(Document histDoc) { try { pw = new ProcessWindow("Loading Document " + histDoc.DocNumber + " ..."); View.StkDetail.Visibility = Visibility.Visible; View.Model.HistData = Util.ToShowData(histDoc); View.Model.HistLines = service.GetDocumentLine(new DocumentLine { Document = histDoc }); View.Model.HistDoc = histDoc; //Loadin Cross Docks View.Model.CrossDocs = service.GetTaskDocumentRelation(new TaskDocumentRelation { TaskDoc = View.Model.HistDoc }); pw.Close(); } catch (Exception ex) { pw.Close(); Util.ShowError("Document could not be loaded.\n" + ex.Message); } }
/// <summary> /// Eliminar seriales de la lista. /// Falta poner el metodo! /// OK! /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_Eliminar_Seriales_Click_1(object sender, RoutedEventArgs e) { //Confirmo si desea eliminar el equipo if (!UtilWindow.ConfirmOK("Esta seguro que desea eliminar estos seriales del sistema?") == true) return; //Mostrar ventana de Cargando... ProcessWindow pw = new ProcessWindow("Eliminando registros...por favor espere..."); //Metodo. EliminarSeriales(sender, e); pw.Visibility = Visibility.Collapsed; pw.Close(); //Btn_Eliminar_Seriales.IsEnabled = false; }
private void chkRep_Checked_1(object sender, RoutedEventArgs e) { //Mostrar ventana de Cargando... ProcessWindow pw = new ProcessWindow("Replicando registros...por favor espere..."); //Replica la informacion de la primera linea en las demas. ReplicateDetails(sender, e); //Cierro ventana de Cargando... pw.Visibility = Visibility.Collapsed; pw.Close(); chkRep.IsChecked = false; }
private void OnSaveDetails(object sender, EventArgs e) { //Validacion si no existen datos para guardar if (View.Model.ListRecords.Rows.Count == 0) return; //Variables Auxiliares String ConsultaGuardar = ""; String ConsultaGuardarTrack = ""; Int32 ContadorFilas = 0; Int32 ContadorEquiposOK=0,ContadorEquiposNOK = 0; try { if (!UtilWindow.ConfirmOK("¿Desea imprimir las etiquetas de los equipos ahora?") == false) { // Se solicita al usuario seleccionar una impresora System.Windows.Forms.PrintDialog pd = new System.Windows.Forms.PrintDialog(); pd.PrinterSettings = new PrinterSettings(); if (System.Windows.Forms.DialogResult.OK == pd.ShowDialog()) { ProcessWindow pw = new ProcessWindow("Procesando registros...por favor espere..."); foreach (DataRow DataRow in View.Model.ListRecords.Rows) { //Aumento el contador de filas ContadorFilas++; //Construyo la consulta para guardar los datos ConsultaGuardar += " UPDATE dbo.EquiposCLARO SET Ubicacion = 'VERIFICACION', Estado = 'P-VERIFICACION'"; ConsultaGuardar += ", REUSO = '" + DataRow["Reuso"].ToString() + "', OBSERVACIONES_ETIQUETADO = '" + DataRow["Observaciones_Etiquetado"].ToString() + "'"; ConsultaGuardar += " WHERE RowID = '" + DataRow["RowID"].ToString() + "';"; ConsultaGuardarTrack += "UPDATE dbo.TrackEquiposCLARO SET ESTADO_ETIQUETADO = 'VERIFICACION', FECHA_ETIQUETADO = GETDATE() WHERE ID_SERIAL = '" + DataRow["RowID"].ToString() + "'"; //Guardo en la tabla de movimientos el cambio de ubicacion del equipo ConsultaGuardar += "EXEC sp_InsertarNuevo_Movimiento 'ETIQUETADO DE EQUIPO','ETIQUETADO','VERIFICACION','Sin pallet','" + DataRow["RowID"].ToString() + "','ETIQUETADO','UBICACIONPRODUCCION','" + this.user + "','';"; Console.WriteLine("###### " + ConsultaGuardar); String archivo = DataRow["ProductoID"].ToString(); archivo = archivo.Replace("/", ""); try { PrinterControl.EtiquetadoEquipo(DataRow["Serial"].ToString(), DataRow["Mac"].ToString(), archivo, pd.PrinterSettings.PrinterName); ContadorEquiposOK++; } catch (Exception ex) { ContadorEquiposNOK++; } } pw.Visibility = Visibility.Collapsed; pw.Close(); } } else { foreach (DataRow DataRow in View.Model.ListRecords.Rows) { //Aumento el contador de filas ContadorFilas++; //Construyo la consulta para guardar los datos ConsultaGuardar += " UPDATE dbo.EquiposCLARO SET Ubicacion = 'VERIFICACION', Estado = 'P-VERIFICACION'"; ConsultaGuardar += ", REUSO = '" + DataRow["Reuso"].ToString() + "', OBSERVACIONES_ETIQUETADO = '" + DataRow["Observaciones_Etiquetado"].ToString() + "'"; ConsultaGuardar += " WHERE RowID = '" + DataRow["RowID"].ToString() + "';"; //Guardo en la tabla de movimientos el cambio de ubicacion del equipo ConsultaGuardar += "EXEC sp_InsertarNuevo_Movimiento 'ETIQUETADO DE EQUIPO','ETIQUETADO','VERIFICACION','Sin pallet','" + DataRow["RowID"].ToString() + "','ETIQUETADO','UBICACIONPRODUCCION','" + this.user + "','';"; Console.WriteLine("###### " + ConsultaGuardar); ConsultaGuardarTrack += "UPDATE dbo.TrackEquiposCLARO SET ESTADO_ETIQUETADO = 'ETIQUETADO', FECHA_ETIQUETADO = GETDATE() WHERE ID_SERIAL = '" + DataRow["RowID"].ToString() + "'"; } } //Evaluo si la consulta no envio los ultimos registros para forzar a enviarlos if (!String.IsNullOrEmpty(ConsultaGuardar)) { //Ejecuto la consulta service.DirectSQLNonQuery(ConsultaGuardar, Local); service.DirectSQLNonQuery(ConsultaGuardarTrack, Local); //Limpio la consulta para volver a generar la nueva ConsultaGuardar = ""; ConsultaGuardarTrack = ""; } if (ContadorEquiposOK > 0) { if (ContadorEquiposNOK > 0){ Util.ShowMessage("\t\t Se encontrarón etiquetas de " + ContadorEquiposOK + " equipos.\n Número de etiquetas no encontradas " + ContadorEquiposNOK + ", Registros guardados satisfactoriamente"); } else { Util.ShowMessage(" Número de etiquetas impresas " + ContadorEquiposOK + ",\nRegistros guardados satisfactoriamente"); } } else if (ContadorEquiposNOK > 0) { Util.ShowMessage("Etiquetas no encontradas, número de etiquetas no encontradas " + ContadorEquiposNOK + ",\n\t Registros guardados satisfactoriamente"); } else { //Muestro el mensaje de confirmacion Util.ShowMessage("Registros guardados satisfactoriamente."); } //Reinicio los campos LimpiarDatosIngresoSeriales(); } catch (Exception Ex) { Util.ShowError("Hubo un error al momento de guardar los registros. Error: " + Ex.Message); } }
public void LoadDocument(Document document, Document taskDoc) { ShowProcess = true; View.DgHistList.MaxHeight = SystemParameters.FullPrimaryScreenHeight - 330; try { View.Model.Document = document; if (taskDoc != null) { AlreadyProcessed = true; ShowProcess = false; ShowProcessPanel(); pw.Close(); LoadDetails(taskDoc); return; } pw = new ProcessWindow("Loading data for document " + document.DocNumber); //Revisar si ya se realizo una tarea de crossdock sobre ese documento TaskDocumentRelation taskRel = new TaskDocumentRelation { IncludedDoc = document, TaskDoc = new Document { DocType = new DocumentType { DocTypeID = SDocType.CrossDock } } }; IList<TaskDocumentRelation> listTask = service.GetTaskDocumentRelation(taskRel) .Where(f => f.TaskDoc.DocStatus.StatusID != DocStatus.Cancelled).ToList(); if (listTask != null && listTask.Count > 0) { //Este documento ya fue procesado AlreadyProcessed = true; ShowProcess = false; } ShowProcessPanel(); //Si ya lo proceso se manda a la historia. if (AlreadyProcessed) { pw.Close(); Util.ShowError("Document " + View.Model.Document + " was already processed."); //Load CrossDock History LoadDetails(listTask[0].TaskDoc); return; } //Load Sales Order Document List View.Model.AvailableDocs = service.GetCrossDockSalesOrders(document); if (View.Model.AvailableDocs == null || View.Model.AvailableDocs.Count == 0) { pw.Close(); Util.ShowError("Sales document products do not match with the received products to make Cross Dock."); //lo deja en los historicos de Cross Dock. //View.TbCross.IsEnabled = false; ShowProcess = false; ShowProcessPanel(); } else { //Si hay documentos con productos que coincidan LoadSalesDocument(); //Cargando el purchasing Document View.Model.DocumentData = Util.ToShowData(document); View.Model.DocumentLines = service.GetDocumentLine(new DocumentLine { Document = document }); RefreshBalance(document); pw.Close(); } } catch (Exception ex) { pw.Close(); Util.ShowError("Error loading document. \n" + ex.Message); } finally { pw.Close(); } }
private void chkRep_Checked_1(object sender, RoutedEventArgs e) { //Confirmo si desea confirmar el proceso if (!UtilWindow.ConfirmOK("Esta seguro de querer replicar estos registros?") == true) return; //Mostrar ventana de Cargando... ProcessWindow pw = new ProcessWindow("Replicando registros...por favor espere..."); //Replica la informacion de la primera linea en las demas. ReplicateDetails(sender, e); //Cierro ventana de Cargando... pw.Visibility = Visibility.Visible; pw.Close(); chkRep.IsChecked = false; }
private void LoadDetails(System.Data.DataRow dr) { if (dr == null) return; TotVolume = TotWeight = 0; View.Model.DocNumber = dr["DocNumber"].ToString(); View.Model.DocID = int.Parse(dr["DocID"].ToString()); pw = new ProcessWindow("Loading lines for document " + View.Model.DocNumber + " ..."); View.Model.CurrentDetails = View.Model.OrdersDetail.Where(f => f.Document.DocID == View.Model.DocID).ToList(); //Ejecuta la disponibilidad para los current details //if (View.Model.CurrentDetails.Any(f => f.IsDebit != true)) //{ #region INVENTORY LINE BY LINE //1. Obtener el Stock de los productos de los documentos de ese cliente. View.Model.DocumentProductStock = service.GetDocumentProductStock(new Document { Customer = new Account { AccountID = View.Model.Customer.AccountID }, Location = App.curLocation, DocType = new DocumentType { DocTypeID = SDocType.SalesOrder } //, //DocID = View.Model.DocID }, null); //Allocated, Available de los productos del documento. //Obtiene la lista de productos para obtener su stock en uso (Product Inventory). List<int> productList = new List<int>(); foreach (Int32 p in View.Model.CurrentDetails.Select(f => f.Product.ProductID).Distinct()) productList.Add(p); productInUseList = service.GetProductInUseForMerged(productList, App.curLocation); double qtyAvailable, qtyInUse; ProductStock piInUse; for (int i = 0; i < View.Model.CurrentDetails.Count; i++) { qtyInUse = 0; qtyAvailable = 0; if (View.Model.CurrentDetails[i].IsDebit == true) continue; if (View.Model.CurrentDetails[i].IsDebit == null) View.Model.CurrentDetails[i].IsDebit = false; View.Model.CurrentDetails[i].Note = View.Model.CurrentDetails[i].Document.DocNumber; //QTY AVAILABLE DE INVENTARIO - Debe Restarsele lo allocated y lo que este en uso //que sale de la clase product Inventory. try { qtyAvailable = View.Model.DocumentProductStock .Where(f => f.Product.ProductID == View.Model.CurrentDetails[i].Product.ProductID) .First().FullStock; } catch { qtyAvailable = 0; } //Cantidad en Uso - PROGRAMA. Allocated y Reservada qtyAvailable = (double)((int)(qtyAvailable * availabilityMark)); View.Model.CurrentDetails[i].QtyOnHand = qtyAvailable; //ON HAND try { piInUse = productInUseList .Where(f => f.Product.ProductID == View.Model.CurrentDetails[i].Product.ProductID) .First(); qtyInUse = piInUse.Stock; } catch{} //try { // //Adicionar En uso del order detail de otras lineas y el mismo producto // qtyInUse += View.Model.OrdersDetail // .Where(f => f.Product.ProductID == View.Model.CurrentDetails[i].Product.ProductID) // //&& f.LineID != View.Model.CurrentDetails[i].LineID) // .Sum(f => f.QtyInvoiced); //} //catch { } qtyAvailable -= qtyInUse; //Cantidad final disponible //View.Model.CurrentDetails[i].QtyInvoiced = qtyInUse; //Allocated //View.Model.CurrentDetails[i].QtyAvailable = ((qtyAvailable > 0) ? qtyAvailable : 0) / View.Model.CurrentDetails[i].Unit.BaseAmount; View.Model.CurrentDetails[i].QtyAllocated = 0; //qtyAllocated; View.Model.CurrentDetails[i].Sequence = 0; //BALANCE View.Model.CurrentDetails[i].LineWeight = View.Model.CurrentDetails[i].Quantity * View.Model.CurrentDetails[i].Product.Weight * View.Model.CurrentDetails[i].Unit.BaseAmount; View.Model.CurrentDetails[i].LineVolume = View.Model.CurrentDetails[i].Quantity * View.Model.CurrentDetails[i].Product.Volume * View.Model.CurrentDetails[i].Unit.BaseAmount; //TOTALES TotWeight += View.Model.CurrentDetails[i].LineWeight; TotVolume += View.Model.CurrentDetails[i].LineVolume; } #endregion View.Model.Totals = new List<DocumentLine>() { new DocumentLine { LineWeight = TotWeight, LineVolume = TotVolume, QtyInvoiced = 75.03 } }; pw.Close(); View.DgDetails.Items.Refresh(); View.TabStep.Visibility = Visibility.Visible; }
private void Btn_GuardarPrealer_Click_1(object sender, RoutedEventArgs e) { if (GetPreaConsecutivo.Text.Equals("") || GetPreaNro_Pedido.Text.Equals("") || GetPreaOrigen.Text.Equals("") || GetPreaTipo_Origen.Text.Equals("") || GetPreaTipo_Recoleccion.Text.Equals("") || GetPreFecha_Emision.Text.Equals("")) { Util.ShowMessage("Debe completar los campos obligatorios del formulario"); return; } //Confirmo si desea confirmar el proceso if (!UtilWindow.ConfirmOK("Esta seguro de crear una nueva prealerta") == true) return; //Mostrar ventana de Cargando... ProcessWindow pw = new ProcessWindow("Procesando registros...por favor espere..."); SavePrealertAll(sender, e); pw.Visibility = Visibility.Collapsed; fUpload_Prealerta.IsEnabled = true; pw.Close(); }
private void OnConfirmCrossDock(object sender, EventArgs e) { ProcessWindow pw = null; Document crossDockDocument = null; Document pReceipt = null; View.Model.Document.Location = App.curLocation; View.Model.Document.Company = App.curCompany; View.Model.Document.ModifiedBy = App.curUser.UserName; int step = 0; View.BtnStep2.IsEnabled = false; try { //1. Create Cross Dock document pw = new ProcessWindow("Creating Cross Dock document ..."); //Poniendo el Location al documento for (int i = 0; i < View.Model.CrossDockBalance.Count; i++) View.Model.CrossDockBalance[i].Location = App.curLocation; //Crea un documento con las transacciones finales a mover en despacho. crossDockDocument = service.ConfirmCrossDockProcess(View.Model.CrossDockBalance.ToList(), App.curUser.UserName); step = 1; //Update the purchase documento to Cross = true //View.Model.Document.CrossDocking = true; //service.UpdateDocument(View.Model.Document); pw.Close(); } catch (Exception ex) { if (step == 1) CancelDocument(crossDockDocument); pw.Close(); Util.ShowError("Problem creating Cross Dock document.\n" + ex.Message); return; } //if (App.IsConnectedToErpReceving) //{ //Este procesos ejecutar. //2. Create Purchase Receipt Solo si esta pegado al ERP. try { pw = new ProcessWindow("Creating Purchase Receipt for document " + View.Model.Document.DocNumber + " ..."); pReceipt = service.CreatePurchaseReceipt(View.Model.Document); step = 2; //Adicionando un ocmentario de Cross Dock al recibo. pReceipt.Comment = "Receipt under Cross Dock process. Document " + crossDockDocument.DocNumber; pReceipt.CrossDocking = true; service.UpdateDocument(pReceipt); step = 3; //Adiciona el PR ala relacion del CrossDock. TaskDocumentRelation tkDoc = new TaskDocumentRelation { CreationDate = DateTime.Now, CreatedBy = App.curUser.UserName, IncludedDoc = pReceipt, TaskDoc = crossDockDocument }; service.SaveTaskDocumentRelation(tkDoc); step = 4; pw.Close(); } catch (Exception ex) { CancelDocument(crossDockDocument); if (step >= 2) service.ReversePurchaseReceipt(pReceipt); //reversar el recibo pw.Close(); Util.ShowError("Problem creating Purchase Receipt.\n" + ex.Message); return; } //} try { //3. Picking Product Based on CrossDock Preview. - Lo Saca de MAIN or putawayZone pw = new ProcessWindow("Allocating sales document quantities ..."); //IList<DocumentLine> crossLines = service.GetDocumentLine(new DocumentLine { Document = crossDockDocument }); //Del documento de cross co obtiene solo las lineas de Sales Orders para ser piqueadeas //foreach (DocumentLine line in crossLines) service.PickCrossDockProduct(View.Model.Document, View.Model.CrossDockBalance.ToList(), App.curUser); pw.Close(); } catch (Exception ex) { pReceipt.Comment = "Cross Dock transaction problem."; service.ReversePurchaseReceipt(pReceipt); //reversar el recibo CancelDocument(crossDockDocument); //Reversar el Cross Dock pw.Close(); Util.ShowError("Problem allocating sales document quantities.\n" + ex.Message); return; } Util.ShowMessage("Cross Dock Process Complete."); }
/// <summary> /// Mostrar el otro campo y eliminar los seriales. /// Falta programar el metodo en el PRESENTER! /// Los parametros son Cliente y numero del documento. /// OK!. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_BuscarSeriales_Click_1(object sender, RoutedEventArgs e) { //Mostrar ventana de Cargando... ProcessWindow pw = new ProcessWindow("Buscando registros...por favor espere..."); //Metodo. BuscarSeriales(sender, e); pw.Visibility = Visibility.Collapsed; pw.Close(); //Mostrar el Border details. Border_2.Visibility = Visibility.Visible; }
private void OnShowTicket(object sender, EventArgs e) { try { pw = new ProcessWindow("Generating Document ... "); UtilWindow.ShowDocument(View.Model.Document.DocType.Template, View.Model.HistDoc.DocID, "", false); //"PDF995" pw.Close(); } catch { pw.Close(); } }
private void Btn_Guardar_Click_1(object sender, RoutedEventArgs e) { //Confirmo si desea confirmar el proceso if (!UtilWindow.ConfirmOK("Esta seguro de querer procesar estos registros?") == true) return; //Mostrar ventana de Cargando... ProcessWindow pw = new ProcessWindow("Procesando registros...por favor espere..."); SaveDetails(sender, e); //Cierro ventana de Cargando... pw.Visibility = Visibility.Collapsed; pw.Close(); }
/// <summary> /// Seleccionar / Deseleccionar los registros. /// por lo que hice, no veo necesaria mas logica. /// OK. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void chkRep_Checked(object sender, RoutedEventArgs e) { //Mostrar ventana de Cargando... ProcessWindow pw = new ProcessWindow("Seleccionando registros...por favor espere..."); //Valida la seleccion / deseleccion de los registros. if (lvDocumentMaster.SelectedItems.Count >= 1) { lvDocumentMaster.UnselectAll(); //Cierro ventana de Cargando... pw.Visibility = Visibility.Collapsed; pw.Close(); chkRep.IsChecked = false; } else { lvDocumentMaster.SelectAll(); //Cierro ventana de Cargando... pw.Visibility = Visibility.Collapsed; pw.Close(); chkRep.IsChecked = false; } }