/// <summary>
 /// 初始化数据
 /// </summary>
 public void InitializeData(DataTable dataTable)
 {
     if (dataTable != null && dataTable.Rows.Count > 0)
     {
         _dataTable = dataTable;
         List <tlsTtResultSecond> ItemList = new List <tlsTtResultSecond>();
         try
         {
             ItemList = (List <tlsTtResultSecond>)IListDataSet.DataTableToIList <tlsTtResultSecond>(_dataTable, 1);
             if (ItemList.Count > 0)
             {
                 for (int i = 0; i < ItemList.Count; i++)
                 {
                     if (ItemList[i].Result != null)
                     {
                         if (ItemList[i].Result.Trim().Equals("合格"))
                         {
                             _qualifiedCount += 1;
                         }
                         else if (ItemList[i].Result.Trim().Equals("不合格"))
                         {
                             _unqualifiedCount += 1;
                         }
                         else
                         {
                             _otherCount += 1;
                         }
                     }
                     else
                     {
                         _otherCount += 1;
                     }
                 }
             }
             _totalCount = dataTable.Rows.Count;
             double percent = Convert.ToDouble(_qualifiedCount) / Convert.ToDouble(_totalCount);
             string result  = string.Format("{0:0.00%}", percent);
             this.labeltotalCount.Content       = "本次数据统计共 " + _totalCount + " 条数据";
             this.labelqualifiedCount.Content   = "合格数: " + _qualifiedCount;
             this.labelunqualifiedCount.Content = "不合格数: " + _unqualifiedCount;
             this.labelotherCount.Content       = "其他: " + _otherCount;
             this.labelCount.Content            = "合格率: " + result;
             DataGridRecord.DataContext         = ItemList;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     else
     {
         DataGridRecord.DataContext = null;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 查看数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_selectData_Click(object sender, RoutedEventArgs e)
        {
            _isRead  = false;
            _atpLsit = new List <clsATP>();
            DataTable data = _atpBll.GetAllAsDataTable();

            if (data != null)
            {
                _atpLsit = (List <clsATP>)IListDataSet.DataTableToIList <clsATP>(data, 1);
                this.DataGridRecord.DataContext = _atpLsit;
            }
        }
        /// <summary>
        /// 查询被检单位
        /// </summary>
        private void SearchCompany()
        {
            this.DataGridRecord.DataContext = null;
            DataTable dataTable = _clsCompanyOprbll.GetAsDataTable("FULLNAME Like '%" + textBoxCompanyName.Text.Trim().ToString() + "%'");

            if (dataTable != null && dataTable.Rows.Count > 0)
            {
                List <clsCompany> ItemNames = (List <clsCompany>)IListDataSet.DataTableToIList <clsCompany>(dataTable, 1);
                if (ItemNames.Count > 0)
                {
                    this.DataGridRecord.DataContext = ItemNames;
                }
            }
        }
        /// <summary>
        /// 查询样品
        /// </summary>
        private void SearchSampleByName()
        {
            DataTable dataTable = _clsTaskOpr.GetSampleByNameOrCode(textBoxName.Text.Trim(), _projectName, false, _IsFirst, 1);

            if (dataTable != null && dataTable.Rows.Count > 0)
            {
                _Items = (List <clsttStandardDecide>)IListDataSet.DataTableToIList <clsttStandardDecide>(dataTable, 1);
                this.DataGridRecord.ItemsSource = dataTable.DefaultView;
                _IsFirst = false;
            }
            else
            {
                this.DataGridRecord.ItemsSource = null;
            }
        }
        private void SearchTask()
        {
            this.DataGridRecord.ItemsSource = null;
            DataTable dt = _Tskbll.GetAsDataTable(string.Empty, string.Empty, 1);

            if (dt != null && dt.Rows.Count > 0)
            {
                List <tlsTrTask> Items = (List <tlsTrTask>)IListDataSet.DataTableToIList <tlsTrTask>(dt, 1);
                this.DataGridRecord.ItemsSource = (Items != null && Items.Count > 0) ? Items : null;
            }
            else
            {
                this.DataGridRecord.ItemsSource = null;
            }
        }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     if (_dataTable != null && _dataTable.Rows.Count > 0)
     {
         List <tlsTtResultSecond> ItemList = new List <tlsTtResultSecond>();
         try
         {
             ItemList = (List <tlsTtResultSecond>)IListDataSet.DataTableToIList <tlsTtResultSecond>(_dataTable, 1);
             if (ItemList.Count > 0)
             {
                 for (int i = 0; i < ItemList.Count; i++)
                 {
                     if (ItemList[i].Result != null)
                     {
                         if (ItemList[i].Result.Trim().Equals("合格"))
                         {
                             _qualifiedList.Add(ItemList[i]);
                             _qualified++;
                         }
                         else if (ItemList[i].Result.Trim().Equals("不合格"))
                         {
                             _unqualified++;
                             _unqualifiedList.Add(ItemList[i]);
                         }
                         else
                         {
                             _other++;
                             _otherList.Add(ItemList[i]);
                         }
                     }
                     else
                     {
                         _other++;
                         _otherList.Add(ItemList[i]);
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     Assembly();
 }
        /// <summary>
        /// 查询样品
        /// </summary>
        private void SearchSample()
        {
            this.DataGridRecord.DataContext = null;
            DataTable dataTable = _clsTaskOpr.GetSampleByNameOrCode(textBoxSampleName.Text.Trim(), textBoxName.Text.Trim(), false, _IsFirst, 1);

            if (dataTable != null)
            {
                List <clsttStandardDecide> ItemNames = (List <clsttStandardDecide>)IListDataSet.DataTableToIList <clsttStandardDecide>(dataTable, 1);
                if (ItemNames != null && ItemNames.Count > 0)
                {
                    this.DataGridRecord.DataContext = ItemNames;
                    _IsFirst = false;
                    if (_ItemNames.Count <= 0)
                    {
                        _ItemNames = ItemNames;
                    }
                }
            }
        }
        /// <summary>
        /// 编辑原始报表
        /// </summary>
        private void Edit()
        {
            clsReport report;

            try
            {
                if (DataGridRecord.SelectedItems.Count > 0)
                {
                    report = (clsReport)DataGridRecord.SelectedItems[0];
                    //根据主表ID查询子表样品信息集合
                    DataTable dt = _resultTable.GetReportDetail(report.ID);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        List <clsReportDetail> ItemNames = (List <clsReportDetail>)IListDataSet.DataTableToIList <clsReportDetail>(dt, 1);
                        for (int i = 0; i < ItemNames.Count; i++)
                        {
                            DYSeriesDataSet.DataModel.clsReport.ReportDetail reportDetail = new DYSeriesDataSet.DataModel.clsReport.ReportDetail();
                            reportDetail.FoodName    = ItemNames[i].FoodName;
                            reportDetail.ProjectName = ItemNames[i].ProjectName;
                            reportDetail.Unit        = ItemNames[i].Unit;
                            reportDetail.CheckData   = ItemNames[i].CheckData;
                            report.reportDetailList.Add(reportDetail);
                        }
                    }
                    UpdateReportWindow window = new UpdateReportWindow();
                    window.ShowInTaskbar = false;
                    window.Owner         = this;
                    window.GetValues(report);
                    window.ShowDialog();
                    SearchReport();
                }
                else
                {
                    MessageBox.Show("请选择编辑条目!", "操作提示");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常(Edit):\n" + ex.Message);
            }
        }
 /// <summary>
 /// 查询原始报表
 /// </summary>
 private void SearchReport()
 {
     this.DataGridRecord.DataContext = null;
     try
     {
         SqlWhere();
         string    error = string.Empty;
         DataTable dt    = _resultTable.GetReport(_SqlWhere, 1, out error);
         if (dt != null && dt.Rows.Count > 0)
         {
             List <clsReport> Items = (List <clsReport>)IListDataSet.DataTableToIList <clsReport>(dt, 1);
             this.DataGridRecord.DataContext = Items;
         }
         else if (!error.Equals(string.Empty))
         {
             MessageBox.Show(error);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("异常(SearchReport):\n" + ex.Message);
     }
 }
 private void btnCleanRepeatSample_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DataTable dataTable = _clsTaskOpr.GetSampleByNameOrCode(string.Empty, string.Empty, false, false, 1);
         if (dataTable != null && dataTable.Rows.Count > 0)
         {
             List <clsttStandardDecide> ItemNames = (List <clsttStandardDecide>)IListDataSet.DataTableToIList <clsttStandardDecide>(dataTable, 1);
             if (ItemNames != null && ItemNames.Count > 0)
             {
                 int delNum = 0;
                 IDictionary <string, clsttStandardDecide> dicItems = new Dictionary <string, clsttStandardDecide>();
                 string err = String.Empty;
                 for (int i = 0; i < ItemNames.Count; i++)
                 {
                     //key=样品名称+项目名称+标准名称     //+标准值+判定符号+单位
                     string key = ItemNames[i].FtypeNmae + "_" + ItemNames[i].Name + "_" + ItemNames[i].ItemDes;
                     //+ "_" + ItemNames[i].StandardValue + "_" + ItemNames[i].Demarcate + "_" + ItemNames[i].Unit;
                     if (!dicItems.ContainsKey(key))
                     {
                         dicItems.Add(key, ItemNames[i]);
                     }
                     else
                     {
                         if (_clsttStandardDecideOpr.DeleteByID(ItemNames[i].ID, out err) == 1)
                         {
                             delNum += 1;
                         }
                     }
                 }
                 if (delNum > 0)
                 {
                     MessageBox.Show("成功清理 " + delNum + " 条重复国家检测标准!");
                 }
                 else
                 {
                     MessageBox.Show("暂无重复国家检测标准!");
                 }
                 SearchSample();
             }
         }
         else
         {
             MessageBox.Show("暂无国家检测标准需要清理!", "操作提示");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("异常:\n" + ex.Message);
     }
 }
        /// <summary>
        /// 打印甘肃报表
        /// </summary>
        private void PrintGS()
        {
            Global.GSType = string.Empty;
            clsReportGS record;

            try
            {
                if (dataGridGS.SelectedItems.Count > 0)
                {
                    record = (clsReportGS)dataGridGS.SelectedItems[0];
                    clsReportGS report = null;
                    if (record != null)
                    {
                        report                       = new clsReportGS();
                        report.Title                 = record.Title;
                        report.FoodName              = record.FoodName;
                        report.FoodType              = record.FoodType;
                        report.ProductionDate        = record.ProductionDate;
                        report.CheckedCompanyName    = record.CheckedCompanyName;
                        report.CheckedCompanyAddress = record.CheckedCompanyAddress;
                        report.CheckedCompanyPhone   = record.CheckedCompanyPhone;
                        report.LabelProducerName     = record.LabelProducerName;
                        report.LabelProducerAddress  = record.LabelProducerAddress;
                        report.LabelProducerPhone    = record.LabelProducerPhone;
                        report.SamplingData          = record.SamplingData;
                        report.SamplingPerson        = record.SamplingPerson;
                        report.SampleNum             = record.SampleNum;
                        report.SamplingBase          = record.SamplingBase;
                        report.SamplingAddress       = record.SamplingAddress;
                        report.SamplingOrderCode     = record.SamplingOrderCode;
                        report.Standard              = record.Standard;
                        report.InspectionConclusion  = record.InspectionConclusion;
                        report.Notes                 = record.Notes;
                        report.Surveyor              = record.Surveyor;

                        //根据主表ID查询子表样品信息集合
                        DataTable dt = _resultTable.GetReportDetailGS(record.ID);
                        if (dt != null && dt.Rows.Count > 0)
                        {
                            List <clsReportGSDetail> ItemNames = (List <clsReportGSDetail>)IListDataSet.DataTableToIList <clsReportGSDetail>(dt, 1);
                            for (int i = 0; i < ItemNames.Count; i++)
                            {
                                clsReportGS.ReportDetail reportDetail = new clsReportGS.ReportDetail();
                                reportDetail.ProjectName        = ItemNames[i].ProjectName;
                                reportDetail.Unit               = ItemNames[i].Unit;
                                reportDetail.InspectionStandard = ItemNames[i].InspectionStandard;
                                reportDetail.IndividualResults  = ItemNames[i].IndividualResults;
                                reportDetail.IndividualDecision = ItemNames[i].IndividualDecision;
                                report.reportDetailList.Add(reportDetail);
                            }
                        }
                    }
                    //甘肃打印模板
                    PrintPreviewWindow print = new PrintPreviewWindow("xaml\\Print\\PrintModel\\GSDocument.xaml", report, new OrderDocumentRenderer());
                    print._resultGS     = record;
                    print.Owner         = this;
                    print.ShowInTaskbar = false;
                    print.ShowDialog();
                }
                else
                {
                    MessageBox.Show("请选择打印条目!", "操作提示");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常(Print):\n" + ex.Message);
            }
        }
        /// <summary>
        /// 打印甘肃回执
        /// </summary>
        private void PrintGSHZ()
        {
            Global.GSType = "HZ";
            clsReportGS record;

            try
            {
                if (dataGridGS.SelectedItems.Count > 0)
                {
                    IDictionary <string, string> dicItems  = new Dictionary <string, string>();
                    IDictionary <string, string> dicSample = new Dictionary <string, string>();
                    record = (clsReportGS)dataGridGS.SelectedItems[0];
                    clsReportGS report = null;
                    if (record != null)
                    {
                        report                       = new clsReportGS();
                        report.Title                 = record.Title;
                        report.FoodName              = record.FoodName;
                        report.FoodType              = record.FoodType;
                        report.ProductionDate        = record.ProductionDate;
                        report.CheckedCompanyName    = record.CheckedCompanyName == null ? "______" : record.CheckedCompanyName;
                        report.CheckedCompanyAddress = record.CheckedCompanyAddress == null ? "______" : record.CheckedCompanyAddress;
                        report.CheckedCompanyPhone   = record.CheckedCompanyPhone;
                        report.LabelProducerName     = record.LabelProducerName;
                        report.LabelProducerAddress  = record.LabelProducerAddress == null ? "______" : record.LabelProducerAddress;
                        report.LabelProducerPhone    = record.LabelProducerPhone;
                        if (record.SamplingData != null)
                        {
                            report.SamplingData = record.SamplingData == null ? "____年__月__日" : record.SamplingData;
                            string   str = record.SamplingData;
                            string[] s   = str.Split(new char[] { '-' });
                            report.SamplingData = s[0] + "年" + s[1] + "月" + s[2] + "日";
                        }
                        else
                        {
                            report.SamplingData = "____年__月__日";
                        }
                        report.SamplingPerson       = record.SamplingPerson;
                        report.SampleNum            = record.SampleNum;
                        report.SamplingBase         = record.SamplingBase;
                        report.SamplingAddress      = record.SamplingAddress;
                        report.SamplingOrderCode    = record.SamplingOrderCode;
                        report.Standard             = record.Standard;
                        report.InspectionConclusion = record.InspectionConclusion;
                        report.Notes     = record.Notes;
                        report.Surveyor  = record.Surveyor;
                        report.ItemsList = report.UnqualifiedItemsList = report.SampleList = string.Empty;
                        //根据主表ID查询子表样品信息集合
                        DataTable dt = _resultTable.GetReportDetailGS(record.ID);
                        if (dt != null && dt.Rows.Count > 0)
                        {
                            List <clsReportGSDetail> ItemNames = (List <clsReportGSDetail>)IListDataSet.DataTableToIList <clsReportGSDetail>(dt, 1);
                            for (int i = 0; i < ItemNames.Count; i++)
                            {
                                clsReportGS.ReportDetail reportDetail = new clsReportGS.ReportDetail();
                                reportDetail.ProjectName        = ItemNames[i].ProjectName;
                                reportDetail.Unit               = ItemNames[i].Unit;
                                reportDetail.InspectionStandard = ItemNames[i].InspectionStandard;
                                reportDetail.IndividualResults  = ItemNames[i].IndividualResults;
                                reportDetail.IndividualDecision = ItemNames[i].IndividualDecision;
                                report.reportDetailList.Add(reportDetail);
                                if (!dicItems.ContainsKey(ItemNames[i].ProjectName))
                                {
                                    if (i + 1 < ItemNames.Count)
                                    {
                                        report.ItemsList += ItemNames[i].ProjectName + ",";
                                    }
                                    else
                                    {
                                        report.ItemsList += ItemNames[i].ProjectName;
                                    }
                                    dicItems.Add(ItemNames[i].ProjectName, ItemNames[i].ProjectName);
                                }
                                if (!dicSample.ContainsKey(ItemNames[i].ProjectName))
                                {
                                    if (ItemNames[i].IndividualDecision.Equals("不合格"))
                                    {
                                        if (i + 1 < ItemNames.Count)
                                        {
                                            report.UnqualifiedItemsList += ItemNames[i].ProjectName + ",";
                                        }
                                        else
                                        {
                                            report.UnqualifiedItemsList += ItemNames[i].ProjectName;
                                        }
                                        dicSample.Add(ItemNames[i].ProjectName, ItemNames[i].ProjectName);
                                    }
                                }
                            }
                            if (report.UnqualifiedItemsList.Equals(string.Empty))
                            {
                                report.UnqualifiedItemsList = "____________________";
                            }
                            if (report.ItemsList.Equals(string.Empty))
                            {
                                report.ItemsList = "____________________";
                            }
                        }
                    }
                    //甘肃打印回执
                    PrintPreviewWindow print = new PrintPreviewWindow("xaml\\Print\\PrintModel\\GSHZDocument.xaml", report, new OrderDocumentRenderer());
                    print._resultGS     = record;
                    print.Owner         = this;
                    print.ShowInTaskbar = false;
                    print.ShowDialog();
                }
                else
                {
                    MessageBox.Show("请选择打印条目!", "操作提示");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常(Print):\n" + ex.Message);
            }
        }
        /// <summary>
        /// 给控件赋值
        /// </summary>
        private void SetCheckBox()
        {
            //标准名称
            IList <string> ItemDesList = new List <string>();
            IDictionary <string, string> dicItemDes = new Dictionary <string, string>();
            //样品名称
            IList <string> SampleNameList = new List <string>();
            IDictionary <string, string> dicSampleName = new Dictionary <string, string>();
            //项目名称
            IList <string> ItemsList = new List <string>();
            IDictionary <string, string> dicItems = new Dictionary <string, string>();
            //判定符号
            IList <string> DemarcateList = new List <string>();
            IDictionary <string, string> dicDemarcate = new Dictionary <string, string>();
            //单位
            IList <string> UnitList = new List <string>();
            IDictionary <string, string> dicUnit = new Dictionary <string, string>();

            try
            {
                //样品、单位、判定符号需单独从数据库中获取
                DataTable dataTable = _clsTaskOpr.GetSampleByNameOrCode(string.Empty, string.Empty, false, false, 1);
                if (dataTable != null && dataTable.Rows.Count > 0)
                {
                    List <clsttStandardDecide> ItemNames = (List <clsttStandardDecide>)IListDataSet.DataTableToIList <clsttStandardDecide>(dataTable, 1);
                    if (ItemNames != null && ItemNames.Count > 0)
                    {
                        for (int i = 0; i < ItemNames.Count; i++)
                        {
                            string str = ItemNames[i].FtypeNmae;
                            if (!dicSampleName.ContainsKey(str) && !str.Equals(string.Empty))
                            {
                                dicSampleName.Add(str, str);
                                SampleNameList.Add(str);
                            }
                            str = ItemNames[i].Unit;
                            if (!str.Equals(string.Empty) && !dicUnit.ContainsKey(str))
                            {
                                dicUnit.Add(str, str);
                                UnitList.Add(str);
                            }
                            str = ItemNames[i].Demarcate;
                            if (!str.Equals(string.Empty) && !dicDemarcate.ContainsKey(str))
                            {
                                dicDemarcate.Add(str, str);
                                DemarcateList.Add(str);
                            }
                        }
                    }
                }

                for (int i = 0; i < _ItemNames.Count; i++)
                {
                    string str = _ItemNames[i].ItemDes;
                    if (!dicItemDes.ContainsKey(str) && !str.Equals(string.Empty))
                    {
                        dicItemDes.Add(str, str);
                        ItemDesList.Add(str);
                    }
                    str = _ItemNames[i].Name;
                    if (!dicItems.ContainsKey(str) && !str.Equals(string.Empty))
                    {
                        dicItems.Add(str, str);
                        ItemsList.Add(str);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常:" + ex.Message);
            }
            finally
            {
                this.textBoxFtypeNmae.ItemsSource = SampleNameList;
                this.textBoxName.ItemsSource      = ItemsList;
                this.textBoxItemDes.ItemsSource   = ItemDesList;
                this.textBoxItemDes.Text          = _ItemNames[0].ItemDes;
                this.textBoxDemarcate.ItemsSource = DemarcateList;
                this.textBoxDemarcate.Text        = _ItemNames[0].Demarcate;
                this.textBoxUnit.ItemsSource      = UnitList;
                this.textBoxUnit.Text             = _ItemNames[0].Unit;
            }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                if (_decide != null && _decide.ID > 0)
                {
                    textBoxFtypeNmae.Text     = _decide.FtypeNmae;
                    textBoxSampleNum.Text     = _decide.SampleNum;
                    textBoxName.Text          = _decide.Name;
                    textBoxItemDes.Text       = _decide.ItemDes;
                    textBoxStandardValue.Text = _decide.StandardValue;
                    textBoxDemarcate.Text     = _decide.Demarcate;
                    textBoxUnit.Text          = _decide.Unit;
                }
                else
                {
                    this.Title = "新增国家检测标准";
                }

                if (_sampleName.Length > 0)
                {
                    this.textBoxFtypeNmae.Text       = _sampleName;
                    this.textBoxFtypeNmae.IsReadOnly = false;
                }

                if (_projectName.Length > 0 && _ItemNames != null && _ItemNames.Count == 0)
                {
                    DataTable dataTable = _clsTaskOpr.GetSampleByNameOrCode(string.Empty, _projectName, true, true, 1);
                    if (dataTable != null && dataTable.Rows.Count > 0)
                    {
                        _ItemNames = (List <clsttStandardDecide>)IListDataSet.DataTableToIList <clsttStandardDecide>(dataTable, 1);
                    }
                }

                if (_ItemNames != null && _ItemNames.Count > 0)
                {
                    SetCheckBox();
                }
                else
                {
                    DataTable dataTable = _clsTaskOpr.GetSampleByNameOrCode(string.Empty, string.Empty, false, false, 1);
                    if (dataTable != null && dataTable.Rows.Count > 0)
                    {
                        _ItemNames = (List <clsttStandardDecide>)IListDataSet.DataTableToIList <clsttStandardDecide>(dataTable, 1);
                        SetCheckBox();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常:" + ex.Message);
            }
            finally
            {
                values.Add(textBoxFtypeNmae.Text.Trim());
                values.Add(textBoxSampleNum.Text.Trim());
                values.Add(textBoxName.Text.Trim());
                values.Add(textBoxItemDes.Text.Trim());
                values.Add(textBoxStandardValue.Text);
                values.Add(textBoxDemarcate.Text);
                values.Add(textBoxUnit.Text);
                _isUpdate = false;
            }
        }
        /// <summary>
        /// 打印原始报表
        /// </summary>
        private void Print()
        {
            clsReport record;

            try
            {
                if (DataGridRecord.SelectedItems.Count > 0)
                {
                    record = (clsReport)DataGridRecord.SelectedItems[0];
                    ReportClass report = null;
                    if (record != null)
                    {
                        report                        = new ReportClass();
                        report.r_Title                = record.Title;
                        report.r_CheckUnitName        = record.CheckUnitName;
                        report.r_Trademark            = record.Trademark;
                        report.r_Specifications       = record.Specifications;
                        report.r_ProductionDate       = record.ProductionDate;
                        report.r_QualityGrade         = record.QualityGrade;
                        report.r_CheckedCompanyName   = record.CheckedCompanyName;
                        report.r_CheckedCompanyPhone  = record.CheckedCompanyPhone;
                        report.r_ProductionUnitsName  = record.ProductionUnitsName;
                        report.r_ProductionUnitsPhone = record.ProductionUnitsPhone;
                        report.r_TaskSource           = record.TaskSource;
                        report.r_Standard             = record.Standard;
                        report.r_SamplingData         = record.SamplingData;
                        report.r_SampleNum            = record.SampleNum;
                        report.r_SamplingCode         = record.SamplingCode;
                        report.r_SampleArrivalData    = record.SampleArrivalData;
                        report.r_Note                 = record.Notes;

                        //根据主表ID查询子表样品信息集合
                        DataTable dt = _resultTable.GetReportDetail(record.ID);
                        if (dt != null && dt.Rows.Count > 0)
                        {
                            List <clsReportDetail> ItemNames = (List <clsReportDetail>)IListDataSet.DataTableToIList <clsReportDetail>(dt, 1);
                            for (int i = 0; i < ItemNames.Count; i++)
                            {
                                ReportClass.ReportDetail reportDetail = new ReportClass.ReportDetail();
                                reportDetail.FoodName    = ItemNames[i].FoodName;
                                reportDetail.ProjectName = ItemNames[i].ProjectName;
                                reportDetail.Unit        = ItemNames[i].Unit;
                                reportDetail.CheckData   = ItemNames[i].CheckData;
                                report.r_reportList.Add(reportDetail);
                            }
                        }
                    }
                    //原始打印模板
                    PrintPreviewWindow print = new PrintPreviewWindow("xaml\\Print\\PrintModel\\OrderDocument.xaml", report, new OrderDocumentRenderer());
                    print._result       = record;
                    print.Owner         = this;
                    print.ShowInTaskbar = false;
                    print.ShowDialog();
                }
                else
                {
                    MessageBox.Show("请选择打印条目!", "操作提示");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常(Print):\n" + ex.Message);
            }
        }
        /// <summary>
        /// 编辑甘肃报表
        /// </summary>
        private void EditGS()
        {
            clsReportGS report;

            try
            {
                if (dataGridGS.SelectedItems.Count > 0)
                {
                    report = (clsReportGS)dataGridGS.SelectedItems[0];
                    //根据主表ID查询子表样品信息集合
                    DataTable dt = _resultTable.GetReportDetailGS(report.ID);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        List <clsReportGSDetail> ItemNames = (List <clsReportGSDetail>)IListDataSet.DataTableToIList <clsReportGSDetail>(dt, 1);
                        for (int i = 0; i < ItemNames.Count; i++)
                        {
                            DYSeriesDataSet.DataModel.clsReportGS.ReportDetail reportDetail = new DYSeriesDataSet.DataModel.clsReportGS.ReportDetail();
                            reportDetail.ID                 = ItemNames[i].ID;
                            reportDetail.ReportGSID         = ItemNames[i].ReportGSID;
                            reportDetail.ProjectName        = ItemNames[i].ProjectName;
                            reportDetail.InspectionStandard = ItemNames[i].InspectionStandard;
                            reportDetail.IndividualResults  = ItemNames[i].IndividualResults;
                            reportDetail.Unit               = ItemNames[i].Unit;
                            reportDetail.IndividualDecision = ItemNames[i].IndividualDecision;
                            report.reportDetailList.Add(reportDetail);
                        }
                    }
                    UpdateReportGSWindow window = new UpdateReportGSWindow();
                    window.ShowInTaskbar = false;
                    window.Owner         = this;
                    window.GetValues(report);
                    window.ShowDialog();
                    SearchReportGS();
                }
                else
                {
                    MessageBox.Show("请选择编辑条目!", "操作提示");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常(Edit):\n" + ex.Message);
            }
        }
 /// <summary>
 /// 双击编辑报表 甘肃
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dataGridGS_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     if (!Global.EachDistrict.Equals("GS"))
     {
         clsReportGS report;
         try
         {
             if (dataGridGS.SelectedItems.Count > 0)
             {
                 report = (clsReportGS)dataGridGS.SelectedItems[0];
                 //根据主表ID查询子表样品信息集合
                 DataTable dt = _resultTable.GetReportDetailGS(report.ID);
                 if (dt != null && dt.Rows.Count > 0)
                 {
                     List <clsReportGSDetail> ItemNames = (List <clsReportGSDetail>)IListDataSet.DataTableToIList <clsReportGSDetail>(dt, 1);
                     for (int i = 0; i < ItemNames.Count; i++)
                     {
                         DYSeriesDataSet.DataModel.clsReportGS.ReportDetail reportDetail = new DYSeriesDataSet.DataModel.clsReportGS.ReportDetail();
                         reportDetail.ID                 = ItemNames[i].ID;
                         reportDetail.ReportGSID         = ItemNames[i].ReportGSID;
                         reportDetail.ProjectName        = ItemNames[i].ProjectName;
                         reportDetail.InspectionStandard = ItemNames[i].InspectionStandard;
                         reportDetail.IndividualResults  = ItemNames[i].IndividualResults;
                         reportDetail.Unit               = ItemNames[i].Unit;
                         reportDetail.IndividualDecision = ItemNames[i].IndividualDecision;
                         report.reportDetailList.Add(reportDetail);
                     }
                 }
                 UpdateReportGSWindow window = new UpdateReportGSWindow();
                 window.ShowInTaskbar = false;
                 window.Owner         = this;
                 window.GetValues(report);
                 window.ShowDialog();
                 SearchReportGS();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("异常(Edit):\n" + ex.Message);
         }
     }
 }