public void SetData(string palletCode, bool autoPrint) { this.m_AutoPrint = autoPrint; this.InitTable(); PackageFacade packageFacade = new PackageFacade(this.DataProvider); ItemFacade itemFacade = new ItemFacade(this.DataProvider); //Get head data DBDateTime dbDateTime; dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider); string printDate = FormatHelper.ToDateString(dbDateTime.DBDate, "/"); Pallet pallet = (Pallet)packageFacade.GetPallet(palletCode); if (pallet == null) { return; } //string moCode = pallet.MOCode; string ssCode = pallet.SSCode; string itemCode = pallet.ItemCode; string itemDesc = ""; string itemMachineType = ""; string itemModelGroup = ""; Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterial(itemCode, pallet.OrganizationID); if (material != null) { itemDesc = material.MaterialDescription == null ? "" : material.MaterialDescription; itemMachineType = material.MaterialMachineType == null ? "" : material.MaterialMachineType; itemModelGroup = material.MaterialModelGroup == null ? "" : material.MaterialModelGroup; } //Get grid data object[] palletDetail = packageFacade.GetPalletDetailInfo(palletCode); int seq = 0; if (palletDetail != null) { foreach (SimulationReport detail in palletDetail) { seq++; DataRow row = tblData.NewRow(); row["Seq"] = seq; row["LotNo"] = detail.LOTNO; row["RCard"] = detail.RunningCard; row["CartonCode"] = detail.CartonCode; row["MOCode"] = detail.MOCode; tblData.Rows.Add(row); } } string appPath = Application.StartupPath + "\\PackPalletPrint.rdlc"; this.ReportViewerPallet.LocalReport.DataSources.Clear(); this.ReportViewerPallet.Reset(); this.ReportViewerPallet.LocalReport.ReportPath = appPath; this.ReportViewerPallet.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSetPalletPrint_PalletDetail", tblData)); ReportParameter param1 = new ReportParameter("PalletCode", new string[] { palletCode }); ReportParameter param2 = new ReportParameter("PrintDate", new string[] { printDate }); ReportParameter param3 = new ReportParameter("ItemCode", new string[] { itemCode }); ReportParameter param4 = new ReportParameter("ItemDesc", new string[] { itemDesc }); //ReportParameter param5 = new ReportParameter("MOCode", new string[] { moCode }); ReportParameter param6 = new ReportParameter("SSCode", new string[] { ssCode }); ReportParameter param7 = new ReportParameter("MachineCode", new string[] { itemMachineType }); ReportParameter param8 = new ReportParameter("ScreenCode", new string[] { itemModelGroup }); this.ReportViewerPallet.LocalReport.SetParameters(new ReportParameter[] { param1, param2, param3, param4, param6, param7, param8 }); this.ReportViewerPallet.LocalReport.Refresh(); }