//Process the lines to Print - OBSOLETE public String GetReplacedTemplate(IList<DocumentBalance> printList, LabelTemplate template, string printLot, UserByRol userByRol) { Factory.IsTransactional = true; string result = ""; Node node = WType.GetNode(new Node { NodeID = NodeType.PreLabeled }); Bin bin = WType.GetBin(new Bin { BinCode = DefaultBin.MAIN, Location = userByRol.Location }); try { foreach (DocumentBalance printLine in printList) { result += ProcessPrintingLine(printLine, template, printLot, node, bin, userByRol); if (template.PrintEmptyLabel == true) result += template.Empty; } Factory.Commit(); } catch (Exception ex) { Factory.Rollback(); ExceptionMngr.WriteEvent("GetReplacedTemplate:", ListValues.EventType.Fatal, ex, null, ListValues.ErrorCategory.ErpConnection); throw new Exception(WriteLog.GetTechMessage(ex)); } return result; }
public void DeleteUserByRol(UserByRol data) { Factory.DaoUserByRol().Delete(data); }
public void UpdateUserByRol(UserByRol data) { Factory.DaoUserByRol().Update(data); }
public UserByRol SaveUserByRol(UserByRol data) { return Factory.DaoUserByRol().Save(data); }
public IList<UserByRol> GetUserByRol(UserByRol data) { Factory.IsTransactional = true; return Factory.DaoUserByRol().Select(data); }
//10 Marzo /09 : Jairo Murillo public IList<Label> GenerateLabelsToPrint(IList<DocumentBalance> printList, String printLot, UserByRol userByRol) { return LabelMngr.GenerateLabelsToPrint(printList, printLot, userByRol); }
private void ProcessPrintingLine(DocumentBalance printLine, String printLot, Node node, Bin bin, UserByRol userByRol) { //Tipo De impresion //1. Normal Imprime standar, sin logistica //2. Logistic (Notes tiene data) - imprime normal mas la Logistica Unit logisticUnit = null; //bool printOnlyLogistic = false; if (printLine.Notes != null && printLine.Notes.Contains("Pack")) { string[] dataLogistic = printLine.Notes.Split(':'); //El elemento [1] contiene la unidad logistica, si es cero es custom. if (dataLogistic[2].Equals(WmsSetupValues.CustomUnit)) { try { //trata de encontrar una unidad con ese baseamount logisticUnit = Factory.DaoUnit().Select( new Unit { BaseAmount = printLine.QtyPending, Company = userByRol.Location.Company, ErpCodeGroup = printLine.Unit.ErpCodeGroup } ).First(); } catch { //Obtiene la custom logisticUnit = Factory.DaoUnit().SelectById(new Unit { UnitID = int.Parse(dataLogistic[1]) }); } } else // Si no es Custom { logisticUnit = Factory.DaoUnit().SelectById(new Unit { UnitID = int.Parse(dataLogistic[1]) }); } } //Se ingresa para poder sacar el dato de la company if (printLine.Document == null) printLine.Document = new Document { Company = userByRol.Location.Company }; //CReating Document Line to Send DocumentLine prnLine = new DocumentLine { Product = printLine.Product, Document = printLine.Document, Unit = printLine.Unit, Quantity = printLine.Quantity, CreatedBy = userByRol.User.UserName }; if (logisticUnit != null) logisticUnit.BaseAmount = printLine.QtyPending; //Obteniendo el factor logistico antes de enviar a crear los labels double logisticFactor = (logisticUnit != null) ? printLine.QtyPending : 1; //Manda a Crear los Labels IList<Label> resultList = CreateProductLabels(logisticUnit, prnLine, node, bin, logisticFactor, printLot,"", DateTime.Now) .Where(f => f.FatherLabel == null).ToList(); foreach (Label lbl in resultList) this.listOfLabels.Add(lbl); }
public IList<Label> GenerateLabelsToPrint(IList<DocumentBalance> printList, String printLot, UserByRol userByRol) { Factory.IsTransactional = true; this.listOfLabels = new List<Label>(); Node node = WType.GetNode(new Node { NodeID = NodeType.PreLabeled }); Bin bin = WType.GetBin(new Bin { BinCode = DefaultBin.MAIN, Location = userByRol.Location }); try { foreach (DocumentBalance printLine in printList) ProcessPrintingLine(printLine, printLot, node, bin, userByRol); Factory.Commit(); } catch (Exception ex) { Factory.Rollback(); ExceptionMngr.WriteEvent("GenerateLabelsToPrint:", ListValues.EventType.Fatal, ex, null, ListValues.ErrorCategory.Business); throw new Exception(WriteLog.GetTechMessage(ex)); } return (this.listOfLabels.Count > 0) ? this.listOfLabels : null; }
/// <summary> /// Get Print file string to print /// </summary> /// <param name="labels">List of labels to print</param> /// <param name="template">Template to use for the printing</param> /// <returns></returns> public String ProcessPrintingLine(DocumentBalance printLine, LabelTemplate template, String printLot, Node node, Bin bin, UserByRol userByRol) { string result = ""; Status status = WType.GetStatus(new Status { StatusID = EntityStatus.Active }); //Active //Obteniendo el listado de TAGS que se deben reemplazar en el template IList<LabelMapping> labelmappings = Factory.DaoLabelMapping().Select( new LabelMapping { LabelType = template.LabelType }); //Template base //int i; IList<Label> labelList = new List<Label>(); //Tipo De impresion //1. Normal Imprime standar, sin logistica //2. Logistic (Notes tiene data) - imprime normal mas la Logistica Unit logisticUnit = null; if (printLine.Notes != null && printLine.Notes.Contains("Logistic")) { string[] dataLogistic = printLine.Notes.Split(':'); //El primer elemento contiene la unidad logistica. logisticUnit = Factory.DaoUnit().SelectById(new Unit { UnitID = int.Parse(dataLogistic[1]) }); //3. Only print Logistic (notes tiene "ONLYPACK") - no imprime la normal (si las crea), solo imprime las logisticas //if (printLine.Notes.Contains("ONLYPACK")) //printOnlyLogistic = true; } //CReating Document Line to Send DocumentLine prnLine = new DocumentLine { Product = printLine.Product, Document = printLine.Document, Unit = printLine.Unit, Quantity = printLine.Quantity }; //Crea las etiquetas de la cantidad de producto a recibir Logisticas y sus Hijas double logisticFactor = (logisticUnit != null) ? (double)(logisticUnit.BaseAmount / printLine.Unit.BaseAmount) : 1; labelList = CreateProductLabels(logisticUnit, prnLine, node, bin, logisticFactor, printLot,"", DateTime.Now) .Where(f=>f.FatherLabel == null).ToList(); //Reemplazando el Header if (template.Header != null) result += ReplaceTemplate(labelmappings, template.Header, labelList[0]) + Environment.NewLine; //Reemplazando el Body if (template.Body != null) { foreach (Label label in labelList) result += ReplaceTemplate(labelmappings, template.Body, label) + Environment.NewLine; } return result; }