Ejemplo n.º 1
0
        //Process Labels
        public static DataSet ProcessLabels(IList <Label> labelList)
        {
            if (labelList == null || labelList.Count == 0)
            {
                throw new Exception("No labels found.");
            }

            //Pricessing Labels
            return(ReportMngr.GetReportDataset(labelList, 10));
        }
Ejemplo n.º 2
0
 //Constructor
 public Control()
 {
     Factory = new DaoFactory();
     DocMngr = new DocumentMngr();
     LabelMngr = new LabelMngr();
     TranMngr = new TransactionMngr();
     ErpMngr = new ErpDataMngr();
     RptMngr = new ReportMngr();
     BasicMngr = new BasicMngr();
     MsgMngr = new MessageMngr();
     WType = new WmsTypes();
 }
        /// <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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        private string[] Attachements(MessagePool message)
        {
            string[] results = new string[0];
            try
            {
                LocalReport localReport;
                // "E:\\GagPrjs\\wms30_\\WpfFrontOLD\\bin\\Debug"; //
                string appPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), WmsSetupValues.WebServer);

                string[] files = message.Rule.Files.Split(',');
                results = new string[files.Count()];
                int cont = 0;

                // ciclo de attachements asociados al correo programado
                foreach (string templateId in files)
                {
                    localReport = new LocalReport();
                    LabelTemplate template = Factory.DaoLabelTemplate().Select(new LabelTemplate {
                        RowID = int.Parse(templateId)
                    }).First();
                    string reportPath = Path.Combine(appPath, WmsSetupValues.RdlTemplateDir + "\\" + template.Header);
                    localReport.ReportPath = reportPath;

                    //Obteniendo la informacion del Reporte (DataSet)
                    ReportMngr repMng = new ReportMngr();
                    Document   doc    = Factory.DaoDocument().Select(new Document {
                        DocID = message.RecordID
                    }).First();

                    ReportHeaderFormat rptHdr = repMng.GetReportInformation(doc, template.Header);
                    if (rptHdr.ReportDetails == null || rptHdr.ReportDetails.Count == 0)
                    {
                        rptHdr.ReportDetails.Add(new ReportDetailFormat {
                        });
                    }

                    DataSet ds = GetReportDataset(rptHdr);
                    localReport.DataSources.Add(new ReportDataSource("Header", ds.Tables["ReportHeaderFormat"]));
                    localReport.DataSources.Add(new ReportDataSource("Details", ds.Tables["ReportDetailFormat"]));

                    string mimeType;
                    string encoding;
                    string fileNameExtension;
                    string reportType = "PDF";

                    //The DeviceInfo settings should be changed based on the reportType
                    //http://msdn2.microsoft.com/en-us/library/ms155397.aspx
                    string deviceInfo =
                        "<DeviceInfo>" +
                        "  <OutputFormat>" + reportType + "</OutputFormat>" +
                        "  <PageWidth>10in</PageWidth>" +
                        "  <PageHeight>11in</PageHeight>" +
                        "  <MarginTop>0.2in</MarginTop>" +
                        "  <MarginLeft>1.0in</MarginLeft>" +
                        "  <MarginRight>0.5in</MarginRight>" +
                        "  <MarginBottom>0.2in</MarginBottom>" +
                        "</DeviceInfo>";

                    Warning[] warnings;
                    string[]  streams;
                    byte[]    renderedBytes;

                    //Render the report
                    renderedBytes = localReport.Render(
                        reportType,
                        deviceInfo,
                        // null,
                        out mimeType,
                        out encoding,
                        out fileNameExtension,
                        out streams,
                        out warnings);

                    string       path = Path.Combine(appPath, WmsSetupValues.PrintReportDir + "\\" + doc.DocNumber + "_" + template.Name + "." + reportType);
                    BinaryWriter bn   = new BinaryWriter(File.Open(path, FileMode.Create));
                    bn.Write(renderedBytes);
                    bn.Flush();
                    bn.Close();

                    results[cont++] = path;
                }
            }
            catch { }
            return(results);
        }