/// <summary> /// Crea un numero de labels definido para el numero de paquetes recibidos de un PO /// Envia el mail de notificacion. /// </summary> /// <param name="document"></param> /// <param name="numLabels"></param> /// <param name="sysUser"></param> public void ReceiptAcknowledge(Document document, double numLabels, SysUser sysUser, string appPath) { //Crear el documento de Mail para enviar el Mensaje. SendProcessNotification(sysUser, document, BasicProcess.ReceiptAcknowledge); //Cambiar las fechas de arrive del PO que llego document.Date5 = DateTime.Now; Factory.DaoDocument().Update(document); //Manadar a Imprimir los N Labels de Acknolegement. if (string.IsNullOrEmpty(appPath)) { appPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), WmsSetupValues.WebServer); } LabelTemplate template = Factory.DaoLabelTemplate().Select(new LabelTemplate { Header = WmsSetupValues.DefTpl_DocumentLabel }).First(); IList <Label> labelsToPrintX = new List <Label>(); for (int z = 1; z <= (int)numLabels; z += 1) { labelsToPrintX.Add( new Label { LabelCode = document.DocNumber, LabelType = new DocumentType { DocTypeID = LabelType.CustomerLabel }, CurrQty = z, StartQty = numLabels, CreatedBy = sysUser.UserName }); } ReportMngr.PrintLabelsFromFacade(new Printer { PrinterName = WmsSetupValues.DEFAULT }, template, labelsToPrintX, appPath); }
public int PrintPackageLabels(Document shipment, string printer, string appPath, string labelcode) { IList <Label> labelsToPrint = null; LabelTemplate defTemplate = null; if (shipment != null && shipment.DocID != 0) { labelsToPrint = Factory.DaoDocumentPackage().Select( new DocumentPackage { PostingDocument = shipment } ).Select(f => f.PackLabel).ToList(); try { defTemplate = Factory.DaoLabelTemplate().Select( new LabelTemplate { Header = WmsSetupValues.DefaultPackLabelTemplate }).First(); } catch { } } else if (!string.IsNullOrEmpty(labelcode)) { labelsToPrint = Factory.DaoDocumentPackage().Select( new DocumentPackage { PackLabel = new Label { LabelCode = labelcode } } ).Select(f => f.PackLabel).ToList(); try { if (labelsToPrint[0].Package.PackageType == "P" || labelsToPrint[0].Package.Level == 0) // || labelsToPrint[0].Package.ParentPackage == null { defTemplate = Factory.DaoLabelTemplate().Select( new LabelTemplate { Header = WmsSetupValues.DefaultPalletTemplate }).First(); } else if (labelsToPrint[0].Package.PackageType == "B") { defTemplate = Factory.DaoLabelTemplate().Select( new LabelTemplate { Header = WmsSetupValues.DefaultPackLabelTemplate }).First(); } } catch { } } if (labelsToPrint == null || labelsToPrint.Count == 0) { return(0); } Printer objPrinter = null; //Printer - Default for the Template objPrinter = new Printer { PrinterName = WmsSetupValues.DEFAULT }; ReportMngr.PrintLabelsFromFacade(objPrinter, defTemplate, labelsToPrint, appPath); return(labelsToPrint.Count); }