public IList<Label> Select(Label data) { IList<Label> datos = new List<Label>(); try { datos = GetHsql(data).List<Label>(); if (!Factory.IsTransactional) Factory.Commit(); } catch (Exception e) { NHibernateHelper.WriteEventLog(WriteLog.GetTechMessage(e)); } return datos; }
public void UnPickUniqueLabel(Document document, Label label, SysUser picker) { TranMngr.UnPickUniqueLabel(document, label, picker); }
internal Boolean ValidateIsUniqueLabel(Label labelSource, bool autoThrow) { if (labelSource.LabelType.DocTypeID == LabelType.UniqueTrackLabel) return true; if (autoThrow) { Factory.Rollback(); throw new Exception("Product is not serialized."); } else return false; }
internal Boolean ValidateLabelQuantity(Label label, bool autoThrow) { if (label.StockQty > 0) return true; if (autoThrow) { Factory.Rollback(); throw new Exception("Label has zero quantiy."); } else return false; }
public Boolean ValidateNodeRoute(Label label, Node node, Boolean autoThrow) { NodeRoute nodeRoute = new NodeRoute { NextNode = node, CurNode = label.Node }; if (Factory.DaoNodeRoute().Select(nodeRoute).Count == 0) { if (autoThrow) { Factory.Rollback(); throw new Exception("Transaction from " + label.Node.Name + " to " + node.Name + " not allowed."); } else return false; } return true; }
public Boolean ValidateNodeInLabel(Label label, Node node, Boolean autoThrow) { if (label.Node.NodeID != node.NodeID) { if (autoThrow) { Factory.Rollback(); throw new Exception("Label " + label.LabelCode + " is not in a valid Node."); } else return false; } return true; }
public Boolean ValidateIsProductLabel(Label data, Boolean autoThrow) { if (data.LabelType.DocTypeID != LabelType.ProductLabel && data.LabelType.DocTypeID != LabelType.UniqueTrackLabel) { if (autoThrow) { Factory.Rollback(); throw new Exception("Label " + data.LabelCode + " is not a Product Label."); } else return false; } return true; }
//Dec 04 2009 para recibir seriales de una vez en proceos One By One public IList<Label> CreateProductUniqueTrackLabels(DocumentLine data, Node node, Bin destLocation, string printingLot, string comment, DateTime receivingDate) { //Label Type DocumentType labelType = Factory.DaoDocumentType().Select(new DocumentType { DocTypeID = LabelType.UniqueTrackLabel }).First(); //Status Status status = Factory.DaoStatus().Select(new Status { StatusID = EntityStatus.Active }).First(); IList<Label> labelResult = new List<Label>(); string notes = (data.Document != null && data.Document.DocID > 0) ? "Doc# " + data.Document.DocNumber : ""; notes = notes + " " + data.Unit.Name; //double labelBalance = data.Quantity; int numLabels = (int)data.Quantity; if (numLabels <= 0) throw new Exception("No valid amount of labels to print."); Label fatherLabel = null; for (int i = 0; i < numLabels; i++) { fatherLabel = new Label(); fatherLabel.Node = node; fatherLabel.Bin = destLocation; fatherLabel.Product = data.Product; fatherLabel.CreatedBy = data.CreatedBy; fatherLabel.Status = status; fatherLabel.LabelType = labelType; fatherLabel.CreationDate = DateTime.Now; fatherLabel.Printed = true; fatherLabel.Unit = data.Unit; //La unidad que tiene ese Label //logisticUnit; L fatherLabel.IsLogistic = false; fatherLabel.FatherLabel = null; fatherLabel.LabelCode = Guid.NewGuid().ToString(); fatherLabel.CurrQty = 1; //*data.Unit.BaseAmount; fatherLabel.StartQty = 1; //*data.Unit.BaseAmount; fatherLabel.Notes = notes; fatherLabel.PrintingLot = printingLot; //data.Note; fatherLabel.ReceivingDate = receivingDate == null ? DateTime.Now : receivingDate; fatherLabel.ReceivingDocument = data.Document.DocID > 0 ? data.Document : null; //Guarda y Actualiza para poder obtener su serial fatherLabel = Factory.DaoLabel().Save(fatherLabel); fatherLabel.LabelCode = '1' + fatherLabel.LabelID.ToString().PadLeft(WmsSetupValues.LabelLength-1, '0'); Factory.DaoLabel().Update(fatherLabel); labelResult.Add(fatherLabel); //Registra el movimiento del nodo SaveNodeTrace( new NodeTrace { Node = node, Document = data.Document.DocID > 0 ? data.Document : null, Label = fatherLabel, Quantity = fatherLabel.CurrQty, IsDebit = false, CreatedBy = data.CreatedBy, Comment = comment } ); } return labelResult; }
public IList<ProductStock> GetLabelStock(Label fatherLabel) { return Factory.DaoLabel().GetStock(fatherLabel); }
public Label SaveLabel(Label data) { return Factory.DaoLabel().Save(data); }
public IList<Label> GetLabel(Label data) { //Factory.IsTransactional = true; return Factory.DaoLabel().Select(data); }
public void DeleteLabel(Label data) { Factory.DaoLabel().Delete(data); }
//public IList<DocumentLineHistory> GetDocumentLineHistory(DocumentLineHistory data) { return Factory.DaoDocumentLineHistory().Select(data); } //public DocumentLineHistory SaveDocumentLineHistory(DocumentLineHistory data) { return Factory.DaoDocumentLineHistory().Save(data); } //public void UpdateDocumentLineHistory(DocumentLineHistory data) { Factory.DaoDocumentLineHistory().Update(data); } //public void DeleteDocumentLineHistory(DocumentLineHistory data) { Factory.DaoDocumentLineHistory().Delete(data); } public void UpdateLabel(Label data) { Factory.DaoLabel().Update(data); }
public void ResetInspectionLine(Document document, Label label, string username, bool cancelDocument) { TranMngr.ResetInspectionLine(document, label, username, cancelDocument); }
public Document EnterInspectionResultByLabel(Document document, Label label, string resultCode, string username) { return TranMngr.EnterInspectionResultByLabel(document, label, resultCode, username); }
public DocumentLine ChangeProductUbication(Label labelSource, DocumentLine changeLine, Label labelDest, string appPath) { return TranMngr.ChangeProductUbication(labelSource, changeLine, labelDest, appPath); }
/// <summary> /// Cra nuevos labels en el sistema para determinados productos, al imprimir o al recibir pro app o device. /// </summary> /// <param name="logisticUnit"></param> /// <param name="data">Document Line con los datos de los labels a crear</param> /// <param name="node"></param> /// <param name="destLocation"></param> /// <param name="logisticFactor"></param> /// <param name="printingLot"></param> /// <returns></returns> public IList<Label> CreateProductLabels(Unit logisticUnit, DocumentLine data, Node node, Bin destLocation, double logisticFactor, string printingLot, string comment, DateTime receivingDate) { //Label Type DocumentType labelType = Factory.DaoDocumentType().Select(new DocumentType { DocTypeID = LabelType.ProductLabel }).First(); //Status Status status = Factory.DaoStatus().Select(new Status { StatusID = EntityStatus.Active }).First(); bool isTransactional = Factory.IsTransactional; if (!isTransactional) Factory.IsTransactional = true; //Funcion para obtener siguiente Label //DocumentTypeSequence initSequence = GetNextDocSequence(data.Document.Company, labelType); //long numSeqLabel = initSequence.NumSequence - 1; IList<Label> labelResult = new List<Label>(); Label fatherLabel = null; string notes = (data.Document != null && data.Document.DocID > 0) ? "Doc# " + data.Document.DocNumber : ""; notes = notes + " " + data.Unit.Name; //double labelBalance = data.Quantity; int numLabels =(int)(data.Quantity/logisticFactor); if (numLabels <= 0) throw new Exception("No valid amount of labels to print."); for (int i = 0; i < numLabels; i++) { fatherLabel = new Label(); fatherLabel.Node = node; fatherLabel.Bin = destLocation; fatherLabel.Product = data.Product; fatherLabel.CreatedBy = data.CreatedBy; fatherLabel.Status = status; fatherLabel.LabelType = labelType; fatherLabel.CreationDate = DateTime.Now; fatherLabel.Printed = false; //string.IsNullOrEmpty(printingLot) ? false : true; if (data.Product.IsUniqueTrack) { fatherLabel.Unit = data.Product.BaseUnit; //La unidad que tiene ese Label //logisticUnit; fatherLabel.StartQty = logisticFactor * data.Unit.BaseAmount; //*data.Unit.BaseAmount; fatherLabel.CurrQty = logisticFactor * data.Unit.BaseAmount; //*data.Unit.BaseAmount; } else { fatherLabel.Unit = data.Unit; //La unidad que tiene ese Label //logisticUnit; fatherLabel.StartQty = logisticFactor; //*data.Unit.BaseAmount; fatherLabel.CurrQty = logisticFactor; //*data.Unit.BaseAmount; } //fatherLabel.UnitBaseFactor = logisticUnit.BaseAmount; //Siempres es 1 fatherLabel.IsLogistic = false; fatherLabel.FatherLabel = null; fatherLabel.LabelCode = ""; // (numSeqLabel + i).ToString() + GetRandomHex(data.CreatedBy, numSeqLabel + i); // (initSequence.NumSequence + i).ToString(); fatherLabel.Notes = notes; fatherLabel.PrintingLot = printingLot; //data.Note; fatherLabel.ReceivingDate = receivingDate == null ? DateTime.Now : receivingDate; fatherLabel.ReceivingDocument = data.Document.DocID > 0 ? data.Document : null; fatherLabel = Factory.DaoLabel().Save(fatherLabel); fatherLabel.LabelCode = fatherLabel.LabelID.ToString(); //Added for indentityUSE labelResult.Add(fatherLabel); //Registra el movimiento del nodo SaveNodeTrace( new NodeTrace { Node = node, Document = data.Document.DocID > 0 ? data.Document : null, Label = fatherLabel, Quantity = fatherLabel.CurrQty, IsDebit = false, CreatedBy = data.CreatedBy, Comment = comment } ); } //Ajustando la sequencia //initSequence.NumSequence += numLabels; //Factory.DaoDocumentTypeSequence().Update(initSequence); if (!isTransactional) Factory.Commit(); return labelResult; }
public IList<Label> GetDocumentLabelAvailable(Document data, Label searchLabel) { if (data.DocType != null && data.DocType.DocTypeID == SDocType.WarehouseTransferReceipt) { //Get the posting shipment Document shipment; try { shipment = Factory.DaoDocument().Select( new Document { DocNumber = data.CustPONumber, Company = data.Company }).First(); } catch { return null; } return Factory.DaoLabel().GetDocumentLabelAvailableFromTransfer(data, shipment, null); } else return Factory.DaoLabel().GetDocumentLabelAvailable(data, searchLabel); }
public Boolean ValidateLabelIsActive(Label data, Boolean autoThrow) { if (data.Status.StatusID != EntityStatus.Active) { if (autoThrow) { Factory.Rollback(); throw new Exception("Label " + data.Name +" appears as "+data.Status.Name+"."); } else return false; } return true; }
public Double SelectCurrentQty(Label label, Product product, bool includeLabeled) { return Factory.DaoLabel().SelectCurrentQty(label, product, includeLabeled); }
/// <summary> /// Retorna execpcion Si no es una etiqueta logistica y tampoco es un Bin /// </summary> /// <param name="data"></param> /// <param name="autoThrow"></param> /// <returns></returns> public Boolean ValidateIsUbicationLabel(Label data, Boolean autoThrow) { if (data.LabelType.DocTypeID != LabelType.BinLocation && data.LabelType.DocTypeID != LabelType.ProductLabel) { if (autoThrow) { Factory.Rollback(); throw new Exception("Label " + data.LabelCode + " is not a Bin or Product Label."); } else return false; } return true; }
public IList<Label> GetUniqueTrackLabels(Label label) { return Factory.DaoLabel().GetUniqueTrackLabels(label); }
public Boolean ValidateSameLocation(Label source, Label destination, short locationType, Boolean autoThrow) { if (locationType == LabelType.BinLocation && source.Bin.BinID == destination.Bin.BinID) { if (autoThrow) { Factory.Rollback(); throw new Exception("Bin Locations are the same."); } else return false; } if (locationType == LabelType.BinLocation && source.LabelID == destination.LabelID) { if (autoThrow) { Factory.Rollback(); throw new Exception("Label Locations are the same."); } else return false; } return true; }
public DocumentLine SaveAdjustmentTransaction(DocumentLine data, Label label, bool commitTransaction) { return TranMngr.SaveAdjustmentTransaction(data, label, commitTransaction); }
public Boolean ValidateIsProcessBin(Label data, Boolean autoThrow) { if (data.LabelType.DocTypeID == LabelType.BinLocation && data.Bin.Process != null && data.Bin.Process.Status.StatusID == EntityStatus.Active) return true; if (autoThrow) { Factory.Rollback(); throw new Exception("Bin " + data.Bin.BinCode + " is not a process bin or the process is inactive."); } else return false; }
public Boolean CheckAdjustmentLine(DocumentLine data, Label label) { return TranMngr.CheckAdjustmentLine(data, label); }
internal Boolean ValidateIsSameProduct(Label labelSource, Label labelDest, bool autoThrow) { if (labelDest.LabelType.DocTypeID == LabelType.BinLocation) return true; if (labelDest.Product.ProductID == labelSource.Product.ProductID) return true; if (autoThrow) { Factory.Rollback(); throw new Exception("Destination has different product.\n"+labelDest.Product.FullDesc); } else return false; }
public Label ChangeLabelUbication(Label labelSource, Label labelDest, string appPath, SysUser user) { return TranMngr.ChangeLabelUbication(labelSource, labelDest, appPath, user); }
internal Boolean ValidateSameLocation(Label labelSource, Label labelDest, bool autoThrow) { if (labelDest.Bin.Location.LocationID == labelSource.Bin.Location.LocationID) return true; if (autoThrow) { Factory.Rollback(); throw new Exception("Location/Site between source/destination are different."); } else return false; }
public Label ChangeLabelLocationV2(Label labelSource, Label labelDest, Document document) { return TranMngr.ChangeLabelLocationV2(labelSource, labelDest, document); }