コード例 #1
0
        OpenReportViewer()
        {
            try
            {
                if (dataGridView1.CurrentRow != null)
                {
                    RESULT_VEHICLE_INFO vehicleInfo =
                        dataGridView1.CurrentRow.DataBoundItem as RESULT_VEHICLE_INFO;

                    if (m_canEdit)
                    {
                        DialogResult dialogResult = MessageBox.Show("需要增补车辆基本信息吗?", "Attetion",
                                                                    MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                        if (dialogResult == DialogResult.Yes)
                        {
                            WndEdit wndEdit = new WndEdit(vehicleInfo.JCLSH)
                            {
                                ControlBox = false, FormBorderStyle = FormBorderStyle.FixedSingle
                            };
                            wndEdit.ShowDialog();
                        }
                    }


                    WndReport reportViewer = new WndReport(vehicleInfo);
                    reportViewer.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
        /// <summary>
        /// 导出报告单
        /// </summary>
        /// <param name="jclsh"></param>
        public void SearchAndOutPut(string jclsh)
        {
            try
            {
                string query = "   ( CHARINDEX('X',JYXM)<>'0' or  CHARINDEX('O',JYXM)<>'0') and  jclsh='" + jclsh + "'";

                RESULT_VEHICLE_INFO_BLL bllVehicleInfo = new RESULT_VEHICLE_INFO_BLL();
                RESULT_VEHICLE_INFO[]   lstVehs        = bllVehicleInfo.GetModelList(query, 0, 2);

                if (lstVehs == null || lstVehs.Length == 0)
                {
                    PUBControl.SYS_LOG.write_log("PrintReport.log", "未找到" + jclsh);
                    return;
                }

                foreach (RESULT_VEHICLE_INFO veh in lstVehs)
                {
                    string hb = Get_HB_JYXM(veh.JYXM);
                    switch (hb)
                    {
                    case "X1":
                        veh.JYXM = ISPMSD.X1;
                        break;

                    //ASM
                    case "X2":
                        veh.JYXM = ISPMSD.X2;

                        break;

                    //VMAS
                    case "X3":
                        veh.JYXM = ISPMSD.X3;

                        break;

                    case "X4":
                        veh.JYXM = ISPMSD.X4;
                        break;

                    case "X5":
                        veh.JYXM = ISPMSD.X5;
                        break;

                    case "X6":
                        veh.JYXM = ISPMSD.X6;
                        break;
                    }


                    if (veh.Z_PD == "1")
                    {
                        veh.Z_PD = "合格";
                    }
                    else if (veh.Z_PD == "2")
                    {
                        veh.Z_PD = "不合格";
                    }
                }
                WndReport reportViewer = new WndReport(lstVehs[0]);
                // reportViewer.Show();
                // System.Threading.Thread.Sleep(1000);
                reportViewer.OutPutPdf(System.IO.Directory.GetParent(Application.StartupPath).FullName + "\\data\\" +
                                       jclsh + ".pdf");

                reportViewer.Close();
            }
            catch (Exception ex)
            {
                PUBControl.SYS_LOG.write_log("PrintReport.log", "自动打印:" + ex.Message);
            }
        }