예제 #1
0
        public void SetConnectionAndShowReport(ReportClass rpt)
        {
            var cnBuilder = new EntityConnectionStringBuilder(ConfigurationManager.ConnectionStrings["SaleEntities"].ConnectionString);
            SqlConnectionStringBuilder sqlConnectionStringBuilder = new SqlConnectionStringBuilder(cnBuilder.ProviderConnectionString);
            string genusSqlServerName = sqlConnectionStringBuilder.DataSource;
            string genusDatabaseName  = sqlConnectionStringBuilder.InitialCatalog;
            string genusUserName      = sqlConnectionStringBuilder.UserID;
            string genusPassword      = sqlConnectionStringBuilder.Password;

            rpt.DataSourceConnections[0].IntegratedSecurity = false;
            rpt.DataSourceConnections[0].SetConnection(genusSqlServerName, genusDatabaseName, genusUserName, genusPassword);
            rpt.Refresh();
        }
예제 #2
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            HeaderContent = _repo.GetPackOrderByID(HeaderContent.WorkOrderId);

            ReportClass rptH = new ReportClass();
            dsPlanning ds = new dsPlanning();
            string outPath = Application.StartupPath + string.Format(@"\\Out\\{0}.pdf", HeaderContent.WorkOrderNum);
            rptH.FileName = Application.StartupPath + "\\Reports\\Planning\\PackingOrder.rpt";
            ds.PackingOrderHead.AddPackingOrderHeadRow(HeaderContent.Id, HeaderContent.WorkOrderId, HeaderContent.WorkOrderNum
                                          , HeaderContent.DueDate, HeaderContent.IssueDate, HeaderContent.PackOrderNum
                                          , HeaderContent.CompleteFlag, HeaderContent.Remark);
            foreach (var p in HeaderContent.PackStyles)
            {
                ds.PackStyleLines.AddPackStyleLinesRow(p.HeadLineID, p.Id, p.CustId, p.CustomerName, p.ThickMin, p.ThickMax
                                                     , p.WidthMin, p.WidthMax, p.StyleCode, p.Remarks);

                foreach (var k in HeaderContent.SkidPacks.Where(i => i.PackStyleId == p.Id))
                {
                    ds.SkidPackingDesign.AddSkidPackingDesignRow(k.PackStyleId, k.Seq, k.SkidNumber, k.Description, k.Id);
                    foreach (var s in HeaderContent.SerialLines.Where(i => i.PackStyleId == p.Id && i.PackingDesignId == k.Id))
                    {
                        ds.SerialsByPackingStyle.AddSerialsByPackingStyleRow(s.PackStyleId, s.SerialNo, s.Thick, s.Width, s.Length, s.PackingDesignId);
                    }
                }
            }
            rptH.Load();
            ds.AcceptChanges();
            rptH.SetDataSource(ds);
            rptH.Refresh();
            rptH.ExportToDisk(ExportFormatType.PortableDocFormat, outPath);
            OpenPdfFile(outPath);
        }
예제 #3
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            var result = HeaderContent.SerialLines.Where(i => i.CutSeq == HeaderContent.CutSeq).Min(i => i.LengthActual);
            if (!timer1.Enabled)
            {
                MessageBox.Show("Pleas start work before calculate weight.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (result == 0)
            {
                MessageBox.Show("Please complete all data in the Grid.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (_repo.SaveSerialCutting(epiSession, HeaderContent))
            {
                CuttedLineUpModel cutline = new CuttedLineUpModel();
                var matlineid = (from item in HeaderContent.SerialLines
                                 where item.CutSeq == HeaderContent.CutSeq
                                 select item.MaterialTransLineID).First();

                cutline.ProductionID = HeaderContent.ProductionID;
                cutline.WorkOrderID = HeaderContent.WorkOrderID;
                cutline.CutSeq = HeaderContent.CutSeq;
                cutline.StartTime = DateTime.Now;
                cutline.FinishTime = DateTime.Now;
                cutline.MaterialTransLineID = matlineid;
                HeaderContent.Cutteds = _repo.SaveCuttedLineUp(epiSession, cutline).ToList();
                SetTimeControl("Print");

                ReportClass rptH = new ReportClass();
                dsProduction ds = new dsProduction();
                string outPath = Application.StartupPath + "\\Out\\test.pdf";
                rptH.FileName = Application.StartupPath + "\\Reports\\Production\\ProductionLabel1.rpt";
                foreach (var item in HeaderContent.SerialLines.Where(i => i.CutSeq == HeaderContent.CutSeq))
                {
                    ds.Label.AddLabelRow(item.SerialNo, item.NGFlag.ToString());
                }
                rptH.Load();
                ds.AcceptChanges();
                rptH.SetDataSource(ds);
                rptH.Refresh();
                rptH.ExportToDisk(ExportFormatType.PortableDocFormat, outPath);
                OpenPdfFile(outPath);
            }
        }