private void AddTrackOption(TrackOption trackOption) { if (trackOption == null) { return; } try { ProductTrackRelation relation = new ProductTrackRelation { Product = View.Model.Record, TrackOption = trackOption, IsRequired = false, IsUnique = (trackOption.IsUnique == null) ? false : trackOption.IsUnique, CreatedBy = App.curUser.UserName, CreationDate = DateTime.Today }; relation = service.SaveProductTrackRelation(relation); if (View.Model.AllowTrack == null) { View.Model.AllowTrack = new List <ProductTrackRelation>(); } View.Model.AllowTrack.Insert(0, relation); View.Model.AvailableTrack.Remove(trackOption); } catch (Exception ex) { throw ex; } }
public override IQuery GetHsql(Object data) { StringBuilder sql = new StringBuilder("select a from TrackOption a where "); TrackOption track = (TrackOption)data; if (track != null) { Parms = new List <Object[]>(); if (track.RowID != 0) { sql.Append(" a.RowID = :id1 and "); Parms.Add(new Object[] { "id1", track.RowID }); } if (!String.IsNullOrEmpty(track.Name)) { sql.Append(" a.Name = :nom1 and "); Parms.Add(new Object[] { "nom1", track.Name }); } if (!String.IsNullOrEmpty(track.DisplayName)) { sql.Append(" a.Displayname = :nom2 and "); Parms.Add(new Object[] { "nom2", track.DisplayName }); } if (track.IsUnique != null) { sql.Append(" a.IsUnique = :nom7 and "); Parms.Add(new Object[] { "nom7", track.IsUnique }); } if (track.IsSystem != null) { sql.Append(" a.IsSystem = :nom10 and "); Parms.Add(new Object[] { "nom10", track.IsSystem }); } if (track.DataType != null && track.DataType.DataTypeID != 0) { sql.Append(" a.DataType.DataTypeID = :nom8 and "); Parms.Add(new Object[] { "nom8", track.DataType.DataTypeID }); } } sql = new StringBuilder(sql.ToString()); sql.Append(" 1=1 order by a.RowID asc "); IQuery query = Factory.Session.CreateQuery(sql.ToString()); SetParameters(query); return(query); }
public IList <TrackOption> Select(TrackOption data) { IList <TrackOption> datos = new List <TrackOption>(); datos = GetHsql(data).List <TrackOption>(); if (!Factory.IsTransactional) { Factory.Commit(); } return(datos); }
public Label UpdateLabelTracking(Label label, TrackOption trackOpt, string trackValue, string user) { IList <LabelTrackOption> trackList = (label.TrackOptions == null || label.TrackOptions.Count == 0) ? new List <LabelTrackOption>() : label.TrackOptions;; if (label.TrackOptions == null || label.TrackOptions.Where(f => f.TrackOption.RowID == trackOpt.RowID).Count() == 0) { LabelTrackOption curTrack = new LabelTrackOption { Label = label, CreatedBy = user, CreationDate = DateTime.Now, TrackOption = trackOpt, TrackValue = trackValue }; trackList.Add(curTrack); } else //Si ya existe un registro con la informacion para ese trackoption { trackList.Where(f => f.TrackOption.RowID == trackOpt.RowID).First().Label = label; trackList.Where(f => f.TrackOption.RowID == trackOpt.RowID).First().CreatedBy = user; trackList.Where(f => f.TrackOption.RowID == trackOpt.RowID).First().CreationDate = DateTime.Now; trackList.Where(f => f.TrackOption.RowID == trackOpt.RowID).First().TrackOption = trackOpt; trackList.Where(f => f.TrackOption.RowID == trackOpt.RowID).First().TrackValue = trackValue; } //Adicionando las track options label.TrackOptions = trackList.ToList(); //Update Label label.ModDate = DateTime.Now; label.ModifiedBy = user; Factory.DaoLabel().Update(label); return(label); }
internal Label UpdateLabelTracking(Label curLabel, TrackOption trackOption, string trackValue, string user) { try { SetService(); return SerClient.UpdateLabelTracking(curLabel, trackOption, trackValue, user); } finally { SerClient.Close(); if (SerClient.State == CommunicationState.Faulted) SerClient.Abort(); } }
public void UpdateTrackOption(TrackOption data) { try { SetService(); SerClient.UpdateTrackOption(data); } finally { SerClient.Close(); if (SerClient.State == CommunicationState.Faulted) SerClient.Abort(); } }
public TrackOption SaveTrackOption(TrackOption data) { try { SetService(); return SerClient.SaveTrackOption(data); } finally { SerClient.Close(); if (SerClient.State == CommunicationState.Faulted) SerClient.Abort(); } }
private void AddTrackOption(TrackOption trackOption) { if (trackOption == null) return; try { ProductTrackRelation relation = new ProductTrackRelation { Product = View.Model.Record, TrackOption = trackOption, IsRequired = false, IsUnique = (trackOption.IsUnique == null) ? false : trackOption.IsUnique, CreatedBy = App.curUser.UserName, CreationDate = DateTime.Today }; relation = service.SaveProductTrackRelation(relation); if (View.Model.AllowTrack == null) View.Model.AllowTrack = new List<ProductTrackRelation>(); View.Model.AllowTrack.Insert(0, relation); View.Model.AvailableTrack.Remove(trackOption); } catch (Exception ex) { throw ex; } }
public Boolean Delete(TrackOption data) { return(base.Delete(data)); }
public TrackOption SelectById(TrackOption data) { return((TrackOption)base.SelectById(data)); }
public Boolean Update(TrackOption data) { return(base.Update(data)); }
public TrackOption Save(TrackOption data) { return((TrackOption)base.Save(data)); }
//23 Marzo 09. Actualiza las trackoption de producto ya recibido. private void UpdateReceivingManualTrackList(int qty) { int h = 1; //Obtiene los labels a modificar. IList <Label> labelToUpdate = new List <Label>(); //View.Model.ManualTrackList; TrackOption trackName = null; string curTrackVal; for (int i = 0; i < View.Model.TrackData.Count; i++) { trackName = View.Model.TrackData[i].TrackOption; foreach (Label trLabel in View.Model.ManualTrackList) { try { curTrackVal = trLabel.TrackOptions.Where(f => f.TrackOption.RowID == trackName.RowID).First().TrackValue; } catch { curTrackVal = ""; } if (string.IsNullOrEmpty(curTrackVal) && labelToUpdate.Where(f => f.LabelID == trLabel.LabelID).Count() == 0) { labelToUpdate.Add(trLabel); } } //Obtiene los trackoption missing. //labelToUpdate = labelToUpdate // .Where(f => f.GetType().GetProperty(trackName).GetValue(f, null) == null // || f.GetType().GetProperty(trackName).GetValue(f, null).ToString().Trim() == "") // .ToList(); } //LabelTrackOption curTrack; //IList<LabelTrackOption> curLabelTrack; //Obtiene la lista de los pendientes por ingresar el track option. Label trackedLabel = null; foreach (Label curLabel in labelToUpdate) { foreach (ProductTrackRelation trackRel in View.Model.TrackData) { trackedLabel = service.UpdateLabelTracking(curLabel, trackRel.TrackOption, trackRel.TempValue.Trim(), App.curUser.UserName); } /* * //Si el label ya tiene track options los trae. * curLabelTrack = curLabel.TrackOptions == null ? new List<LabelTrackOption>() : curLabel.TrackOptions; * * //Asigna los valores ingresados de las TrackOption al correspodiente campo del label * foreach (ProductTrackRelation trackRel in View.Model.TrackData) * { * //curLabel.GetType().GetProperty(trackRel.TrackOption.Name).SetValue(curLabel, trackRel.TempValue, null); * * if (curLabelTrack.Where(f => f.TrackOption.RowID == trackRel.TrackOption.RowID).Count() == 0) * { * curTrack = new LabelTrackOption * { * Label = curLabel, * CreatedBy = App.curUser.UserName, * CreationDate = DateTime.Now, * TrackOption = trackRel.TrackOption, * TrackValue = trackRel.TempValue.Trim() * }; * * curLabelTrack.Add(curTrack); * * } * else //Si ya existe un registro con la informacion para ese trackoption * { * curLabelTrack.Where(f => f.TrackOption.RowID == trackRel.TrackOption.RowID).First().Label = curLabel; * curLabelTrack.Where(f => f.TrackOption.RowID == trackRel.TrackOption.RowID).First().CreatedBy = ""; * curLabelTrack.Where(f => f.TrackOption.RowID == trackRel.TrackOption.RowID).First().CreationDate = DateTime.Now; * curLabelTrack.Where(f => f.TrackOption.RowID == trackRel.TrackOption.RowID).First().TrackOption = trackRel.TrackOption; * curLabelTrack.Where(f => f.TrackOption.RowID == trackRel.TrackOption.RowID).First().TrackValue = trackRel.TempValue.Trim(); * } * } * * //Adicionando las track options * curLabel.TrackOptions = curLabelTrack.ToList(); * * //Update Label * curLabel.ModDate = DateTime.Now; * curLabel.ModifiedBy = App.curUser.UserName; * curLabel.Printed = View.Model.MaxTrackQty == 1 ? true : false; * service.UpdateLabel(curLabel); * */ //Remueve el viejo de la lista e ingresa el nuevo View.Model.ManualTrackList .Remove(View.Model.ManualTrackList.Where(f => f.LabelID == curLabel.LabelID) .First()); View.Model.ManualTrackList.Add(trackedLabel); //h += (int)curLabel.CurrQty; //MODIFICADO SEP 14. h++; if (h > qty) { break; } } View.Model.ManualTrackList = View.Model.ManualTrackList .OrderByDescending(f => f.ModDate).ToList(); View.ManualTrackList.Items.Refresh(); }
private void OnAddManualTrackToList(object sender, EventArgs e) { //Check If Qty is Valid int qty; if (!int.TryParse(View.TxtQtyTrack.Text, out qty) || int.Parse(View.TxtQtyTrack.Text) <= 0) { Util.ShowError("Please enter a valid quantity."); return; } //Check remaining Qty if (View.Model.RemainingQty == 0) { Util.ShowError("Package is full, qty remaining is zero."); return; } //Check remaining Qty if (qty > View.Model.RemainingQty) { Util.ShowError("Qty Remaining is " + View.Model.RemainingQty.ToString() + " please fix."); return; } ProcessWindow("Updating Tracking Options ...", false); TrackOption trackName = null; string curTrackVal = ""; //Revisa que hayan datos de track ingresados y sean validos foreach (ProductTrackRelation trackRel in View.Model.TrackData) { if (string.IsNullOrEmpty(trackRel.TempValue) && trackRel.IsUnique != true) { pw.Close(); Util.ShowError("Please enter valid track information for " + trackRel.TrackOption.DisplayName); return; } else if (string.IsNullOrEmpty(trackRel.TempValue)) { pw.Close(); if (!UtilWindow.ConfirmOK("Wish to enter a blank " + trackRel.TrackOption.DisplayName) == true) { return; } trackRel.TempValue = WmsSetupValues.AutoSerialNumber; } //VALIDACION DEL TRACK LABEL CUANDO ES UNICO //Si en un unique data like a serial debe validar que no sea un dato existente en la DB //ni en los ingresado en la lista actual. if (trackRel.IsUnique == true) { if (trackRel.TempValue != WmsSetupValues.AutoSerialNumber) { //Chequea hay labels con esa relacion int existsInTrack = service.GetLabelTrackOption(new LabelTrackOption { TrackValue = trackRel.TempValue.Trim(), TrackOption = trackRel.TrackOption, Label = new Label { Product = new Product { ProductID = View.Model.Product.ProductID }, Status = App.EntityStatusList.Where(f => f.StatusID == EntityStatus.Active).First() } }).Count; //Chequea hay labels con ese barcode para el mismo producto int existsInLabel = service.GetLabel(new Label { LabelCode = trackRel.TempValue.Trim(), Product = new Product { ProductID = View.Model.Product.ProductID }, Status = App.EntityStatusList.Where(f => f.StatusID == EntityStatus.Active).First() }).Count; //Mensaje para receiving - valida que no exista ya el label en el sistema if ((existsInTrack > 0 || existsInLabel > 0) && View.Model.TrackType == 0) { pw.Close(); Util.ShowError("Product with the " + trackRel.TrackOption.DisplayName + " " + trackRel.TempValue + " already exists."); return; } trackName = trackRel.TrackOption; //version 14 abril 2009, trackOption del label en otra tabla foreach (Label trLabel in View.Model.ManualTrackList) { try { curTrackVal = trLabel.TrackOptions.Where(f => f.TrackOption.RowID == trackName.RowID).First().TrackValue; if (curTrackVal.Trim().Equals(trackRel.TempValue.Trim())) { pw.Close(); Util.ShowError("Product with the " + trackRel.TrackOption.DisplayName + " " + trackRel.TempValue + " was already added."); return; } } catch { } } } //Crea el Label Unico if (!CreateUniqueTrackLabel(trackRel.TempValue)) { //Limpiando los Values for (int i = 0; i < View.Model.TrackData.Count; i++) { View.Model.TrackData[i].TempValue = ""; } return; } trackRel.TempValue = ""; } } //Proceso de Creacion o actualizacion de label segun sea el caso. //Para receiving bool processOk = true; if (View.Model.MaxTrackQty != 1) //(View.Model.TrackType == 0) { UpdateReceivingManualTrackList(qty); } //Proceso final if (processOk) { View.ManualTrackList.Items.Refresh(); View.Model.RemainingQty -= qty; //Ajustando las cantidades if (View.Model.MaxTrackQty == 1) { View.TxtQtyTrack.Text = View.Model.MaxTrackQty.ToString(); } else { View.TxtQtyTrack.Text = View.Model.RemainingQty.ToString(); } if (View.Model.RemainingQty <= 0) { View.BtnAddTrack.IsEnabled = false; } } //Limpiando los Values for (int i = 0; i < View.Model.TrackData.Count; i++) { View.Model.TrackData[i].TempValue = ""; } //Pone el Focus en el elemento del Grid para entrar el siguiente dato pw.Close(); //View.LvTrackProduct.Focus(); }
//23 Marzo 09 - Update of tracking data private void UpdateTrackData() { try { //Carga en la lista de labels, los labels que pertenecen a este documento para incluir su track option NodeTrace patterTrace = new NodeTrace { Document = View.Model.Document, Node = View.Model.Node, Status = new Status { StatusID = EntityStatus.Active }, Label = new Label { Product = View.Model.Product, Status = new Status { StatusID = EntityStatus.Active } } }; //Lista de labels recibidos View.Model.ManualTrackList = service.GetNodeTrace(patterTrace) .Select(f => f.Label).ToList(); View.ManualTrackList.Items.Refresh(); if (View.Model.ManualTrackList.Count == 1) { View.ManualTrackList.SelectedIndex = 0; } //Seleccionar los limites de ingreso de datos, cuenta los labels que tengan //el dato en blanco indicando que estan pendientes. TrackOption trackName = null; string curTrackVal = ""; //guarda el cur value delegate track data int tmpCount = 0; //Calculando el remaining depende si es unico el track o no. if (View.Model.MaxTrackQty == 1) //Si es Unico { try { View.Model.RemainingQty = (int)View.Model.ManualTrackList.Where(f => f.LabelType.DocTypeID == LabelType.ProductLabel).Sum(f => f.CurrQty); } catch { } View.TxtQtyTrack.Text = View.Model.MaxTrackQty.ToString(); View.Model.TrackUnit = View.Model.Product.BaseUnit; View.TxtQtyTrack.IsEnabled = false; } else //Si no. { for (int i = 0; i < View.Model.TrackData.Count; i++) { tmpCount = 0; trackName = View.Model.TrackData[i].TrackOption; //Verison Anterior //Obtiene los trackoption missing. //tmpCount = View.Model.ManualTrackList // .Where(f => f.GetType().GetProperty(trackName).GetValue(f, null) == null // || f.GetType().GetProperty(trackName).GetValue(f, null).ToString().Trim() == "") // .Count(); //version 14 abril 2009, trackOption del label en otra tabla foreach (Label trLabel in View.Model.ManualTrackList) { try { curTrackVal = trLabel.TrackOptions.Where(f => f.TrackOption.RowID == trackName.RowID).First().TrackValue; } catch { curTrackVal = ""; } if (string.IsNullOrEmpty(curTrackVal)) { tmpCount++; } } //Vuelve la cantidad pendiente como la mayor de las dos, Aplica para no UNIQUE track View.Model.RemainingQty = tmpCount > View.Model.RemainingQty ? tmpCount : View.Model.RemainingQty; } View.TxtQtyTrack.Text = View.Model.RemainingQty.ToString(); View.TxtQtyTrack.IsEnabled = true; } //Cantidad pendiente por poner el tracking //if (View.Model.MaxTrackQty == 1) //{ //Si es unique debe pedir 1 a 1 hasta todas las unidades basicas // View.TxtQtyTrack.Text = View.Model.MaxTrackQty.ToString(); // View.Model.TrackUnit = View.Model.Product.BaseUnit; // View.TxtQtyTrack.IsEnabled = false; //} //else //{ // View.TxtQtyTrack.Text = View.Model.RemainingQty.ToString(); // View.TxtQtyTrack.IsEnabled = true; //} } catch (Exception ex) { Util.ShowError("Problem loading received list.\n" + ex.Message); return; } }