Ejemplo n.º 1
0
        private DataTable ListToDataTable()
        {
            string[]          PropertyName = new string[43];
            int               PropertyNum  = 0;
            tlsTtResultSecond Rs           = new tlsTtResultSecond();
            Type              t            = Rs.GetType();

            foreach (PropertyInfo pi in t.GetProperties())
            {
                PropertyName[PropertyNum] = pi.Name;
                PropertyNum++;
            }
            DataSet dto = IListDataSet.ToDataSet <tlsTtResultSecond>(_selectedRecords, PropertyName);

            return(dto.Tables[0]);
        }
Ejemplo n.º 2
0
 internal void GetValue(tlsTtResultSecond model)
 {
     tb_CheckNo.Text            = model.CheckNo;            //检测编号
     tb_TaskNumber.Text         = model.CheckPlanCode;      //任务编号
     tb_CheckTotalItem.Text     = model.CheckTotalItem;     //检测项目
     tb_Standard.Text           = model.Standard;           //检测依据
     tb_ResultInfo.Text         = model.ResultInfo;         //检测值单位
     tb_FoodName.Text           = model.FoodName;           //被检样品名称
     tb_SampleCode.Text         = model.SampleCode;         //样品编号
     tb_CheckValueInfo.Text     = model.CheckValueInfo;     //检测值
     tb_StandValue.Text         = model.StandValue;         //检测值标准
     tb_Result.Text             = model.Result;             //检测结论
     tb_DateManufacture.Text    = model.DateManufacture;    //生产日期
     tb_TakeDate.Text           = model.TakeDate;           //抽检日期
     tb_Organizer.Text          = model.Organizer;          //抽样人
     tb_CheckUnitName.Text      = model.CheckUnitName;
     tb_SamplingPlace.Text      = model.SamplingPlace;      //抽样地点
     cb_CheckType.Text          = model.CheckType;          //检测类别
     tb_CheckedCompany.Text     = model.CheckedCompany;     //被检对象名称
     tb_CheckedCompanyCode.Text = model.CheckedCompanyCode; //被检对象编码
     tCheckedComDis.Text        = model.CheckedComDis;      //档口/门牌/车牌
     tb_UpLoader.Text           = model.UpLoader;           //基层上传人
     tb_UploadDate.Text         = string.Empty;             //基层上传时间
     tb_CheckStartDate.Text     = model.CheckStartDate;     //检测时间
     tCheckPlace.Text           = model.CheckPlace;         //行政机构名称
     tCheckPlaceCode.Text       = model.CheckPlaceCode;     //行政机构编码
     tCheckMachine.Text         = model.CheckMachine;       //检测设备
     tCheckMachineModel.Text    = model.CheckMachineModel;  //检测设备型号
     tMachineCompany.Text       = model.MachineCompany;     //设备生产厂家
     tProceResults.Text         = model.ProceResults;       //处理结果
     tb_APRACategory.Text       = model.APRACategory;       //检测单位类别
     tReportDeliTime.Text       = model.ReportDeliTime;     //检测报告送达时间
     tIsReconsider.IsChecked    = model.IsReconsider;       //是否提出复议(是、否)
     tReconsiderTime.Text       = model.ReconsiderTime;     //提出复议时间
     tb_ProduceCompany.Text     = model.ProduceCompany;     //生产单位
     _IsUpload = model.IsUpload;
     _ID       = model.ID;
 }
Ejemplo n.º 3
0
 private void DataGridRecord_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     _selectedRecords = new List <tlsTtResultSecond>();
     for (int i = 0; i < DataGridRecord.SelectedItems.Count; i++)
     {
         clsATP            model  = (clsATP)DataGridRecord.SelectedItems[i];
         tlsTtResultSecond record = new tlsTtResultSecond();
         record.CheckUnitInfo  = record.Organizer = model.Atp_CheckName;
         record.CheckValueInfo = model.Atp_RLU;
         String str = model.Atp_Result;
         if (str.Equals("通过"))
         {
             str = "合格";
         }
         else if (str.Equals("超标"))
         {
             str = "不合格";
         }
         else
         {
             str = "合格";//不上传
         }
         CheckPointInfo CPoint = Global.samplenameadapter[0];
         record.CheckPlace     = CPoint.pointName;
         record.CheckPlaceCode = CPoint.orgNum;
         record.Result         = str;
         record.ResultType     = record.CheckMethod = "ATP";
         record.CheckStartDate = model.Atp_CheckData;
         record.CheckMachine   = "手持式 ATP 荧光检测仪";
         record.CheckNo        = DateTime.Now.ToString("yyyyMMddHHmmss");
         if (!str.Equals("警告"))
         {
             _selectedRecords.Add(record);
         }
     }
 }
Ejemplo n.º 4
0
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            string            ourEgg = string.Empty;
            tlsTtResultSecond model  = new tlsTtResultSecond();

            try
            {
                model.CheckNo         = tb_CheckNo.Text.Trim();               //检测编号
                model.CheckStartDate  = this.tb_CheckStartDate.Text.Trim();
                model.ReportDeliTime  = tReportDeliTime.Text.Trim();          //检测报告送达时间
                model.ProceResults    = tProceResults.Text.Trim();            //处理结果
                model.CheckPlaceCode  = tCheckPlaceCode.Text.Trim();          //行政机构编号
                model.CheckPlace      = tCheckPlace.Text.Trim();              //行政机构名称
                model.TakeDate        = tb_TakeDate.Text.Trim();              //抽检日期
                model.DateManufacture = tb_DateManufacture.Text.Trim();       //生产日期
                model.SamplingPlace   = tb_SamplingPlace.Text.Trim();         //抽样地点
                model.CheckUnitName   = tb_CheckUnitName.Text.Trim();         //检测单位
                model.CheckType       = cb_CheckType.Text.Trim();             //检测类别
                model.CheckedComDis   = tCheckedComDis.Text.Trim();           //档口/车牌号/门牌号
                model.APRACategory    = tb_APRACategory.Text.Trim();          //检测单位类别
                model.IsUpload        = _IsUpload;                            //是否上传
                model.ID                 = _ID;
                model.CheckValueInfo     = tb_CheckValueInfo.Text.Trim();     //检测值
                model.Result             = tb_Result.Text.Trim();             //结论
                model.CheckNo            = tb_CheckNo.Text.Trim();            //检测编号
                model.CheckPlanCode      = tb_TaskNumber.Text.Trim();         //任务编号
                model.CheckTotalItem     = tb_CheckTotalItem.Text.Trim();     //检测项目
                model.Standard           = tb_Standard.Text.Trim();           //检测依据
                model.CheckUnitName      = tb_CheckUnitName.Text.Trim();      //检测单位
                model.APRACategory       = tb_APRACategory.Text.Trim();       //检测单位类别
                model.CheckedCompany     = tb_CheckedCompany.Text.Trim();     //被检单位
                model.CheckedCompanyCode = tb_CheckedCompanyCode.Text.Trim(); //被检单位编号
                model.CheckStartDate     = tb_CheckStartDate.Text.Trim();     //检测时间
                model.Organizer          = tb_Organizer.Text.Trim();          //抽样人
                model.FoodName           = tb_FoodName.Text.Trim();           //样品名称
                model.SampleCode         = tb_SampleCode.Text.Trim();         //样品编号
                model.StandValue         = tb_StandValue.Text.Trim();         //标准值
                model.ResultInfo         = tb_ResultInfo.Text.Trim();         //检测值单位
                model.UpLoader           = tb_UpLoader.Text.Trim();           //基层上传人
                model.IsReconsider       = (bool)tIsReconsider.IsChecked;     //是否提出复议(是、否)
                model.ReconsiderTime     = tReconsiderTime.Text;
                model.ProduceCompany     = tb_ProduceCompany.Text.Trim();     //生产单位
                _bll.UpdatePart(model, out ourEgg);
            }
            catch (Exception ex)
            {
                MessageBox.Show("保存数据时出现异常!\r\n异常信息:" + (ourEgg.Equals(string.Empty) ? ex.Message : ourEgg));
            }
            finally
            {
                if (ourEgg.Equals(string.Empty))
                {
                    if (MessageBox.Show("保存成功!\r\n是否返回【检测记录查询】界面?!", "操作提示", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                    {
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("保存数据时出现异常!\r\n异常信息:" + ourEgg);
                }
            }
        }
        /// <summary>
        /// ReadResultSave
        /// </summary>
        /// <param name="result"></param>
        public static int ReadResultSave(string[,] result)
        {
            string ourEgg      = string.Empty;
            int    CountLength = 0;

            if (result == null)
            {
                return(CountLength);
            }
            try
            {
                _model   = new tlsTtResultSecond();
                _nowTime = DateTime.Now;
                for (int i = 0; i < result.GetLength(0); i++)
                {
                    if (!result[i, 4].ToString().Contains("NA") && !result[i, 4].ToString().Contains("*") && !string.IsNullOrEmpty(result[i, 4]))
                    {
                        _model.ResultType = result[i, 0];
                        if (!string.IsNullOrEmpty(result[i, 1]))
                        {
                            _model.CheckNo = result[i, 1];
                        }
                        else
                        {
                            _model.CheckNo = _nowTime.ToString("yyyyMMddHHmmssff");//检测编号
                        }
                        _model.SampleCode         = result[i, 2];
                        _model.CheckPlaceCode     = result[i, 3];
                        _model.CheckPlace         = result[i, 4];
                        _model.FoodName           = result[i, 5];
                        _model.TakeDate           = result[i, 6];
                        _model.CheckStartDate     = result[i, 7];
                        _model.Standard           = result[i, 8];
                        _model.CheckMachine       = result[i, 9];
                        _model.CheckMachineModel  = result[i, 10];
                        _model.MachineCompany     = result[i, 11];
                        _model.CheckTotalItem     = result[i, 12];
                        _model.CheckValueInfo     = result[i, 13];
                        _model.StandValue         = result[i, 14];
                        _model.Result             = result[i, 15];
                        _model.ResultInfo         = result[i, 16];
                        _model.CheckUnitName      = result[i, 17];
                        _model.CheckUnitInfo      = result[i, 18];
                        _model.Organizer          = result[i, 19];
                        _model.UpLoader           = result[i, 20];
                        _model.ReportDeliTime     = result[i, 21];
                        _model.IsReconsider       = Convert.ToBoolean(result[i, 22]);
                        _model.ReconsiderTime     = result[i, 23];
                        _model.ProceResults       = result[i, 24];
                        _model.CheckedCompanyCode = result[i, 25];
                        _model.CheckedCompany     = result[i, 26];
                        _model.CheckedComDis      = result[i, 27];
                        _model.CheckPlanCode      = result[i, 28];
                        _model.DateManufacture    = result[i, 29];
                        _model.CheckMethod        = result[i, 30];
                        _model.APRACategory       = result[i, 31];
                        _model.Hole          = result[i, 32];
                        _model.SamplingPlace = result[i, 33];
                        _model.CheckType     = result[i, 34];

                        _bll.Insert(_model, out ourEgg);
                        if (ourEgg.Equals(string.Empty))
                        {
                            CountLength++;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("保存数据时出现异常!请联系管理员!\n\t" + ex.Message);
            }
            return(CountLength);
        }
        /// <summary>
        /// ResultSave
        /// </summary>
        /// <param name="result"></param>
        public static int ResultConserve(string[,] result)
        {
            string ourEgg      = string.Empty;
            int    CountLength = 0;

            if (result == null)
            {
                return(CountLength);
            }
            _model   = new tlsTtResultSecond();
            _nowTime = DateTime.Now;
            try
            {
                CheckPointInfo Cpoint = Global.samplenameadapter != null && Global.samplenameadapter.Count > 0 ? Global.samplenameadapter[0] : null;
                for (int i = 0; i < result.GetLength(0); i++)
                {
                    if (!result[i, 4].ToString().Contains("NA") && !result[i, 4].ToString().Contains("*") && !string.IsNullOrEmpty(result[i, 4]))
                    {
                        _model.SysCode    = Global.GETGUID(null, 1);
                        _model.CheckNo    = DateTime.Now.ToString("yyyyMMddHHmmssff") + Global.GetRandom() + result[i, 11]; //检测编号
                        _model.CheckType  = "抽检";
                        _model.SampleCode = result[i, 11];                                                                  //样品编号

                        string[] companys = result[i, 14].Split('|');                                                       //Global.KsMarketInfo.Split('|');
                        if (companys != null && companys.Length > 1)
                        {
                            _model.CheckedCompany     = companys[0]; //result[i, 14];//被检对象名称
                            _model.CheckedCompanyCode = companys[1]; //!string.IsNullOrEmpty(result[i, 14]) ? clsCompanyOpr.NameFromCode(result[i, 14]) : string.Empty;
                            if (companys.Length > 2)
                            {
                                _model.MarketType = companys[2];
                            }
                        }
                        _model.FoodName = result[i, 8]; //样品名称
                        _model.FoodType = string.Empty; //样品种类
                        string name = _model.FoodName;
                        try
                        {
                            if (name.Length > 0)
                            {
                                DataTable dt = _bll.GetAsDataTable(string.Format("FtypeNmae Like '{0}'", name), string.Empty, 7, 0);
                                if (dt != null && dt.Rows.Count > 0)
                                {
                                    name = dt.Rows[0]["SampleNum"].ToString();//样品编号
                                    if (name.Length <= 5)
                                    {
                                        if (name.Length == 5)
                                        {
                                            _model.FoodType = dt.Rows[0]["FtypeNmae"].ToString();
                                        }
                                        else
                                        {
                                            _model.FoodType = "自建样品";
                                        }
                                    }
                                    else
                                    {
                                        dt = _bll.GetAsDataTable(string.Format("SampleNum Like '{0}'", name.Substring(0, name.Length - 5)), string.Empty, 7, 0);
                                        if (dt != null && dt.Rows.Count > 0)
                                        {
                                            _model.FoodType = dt.Rows[0]["FtypeNmae"].ToString();//样品编号
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception)
                        {
                            _model.FoodType = "样品";
                        }

                        _model.CheckTotalItem = result[i, 2];  //检测项目
                        _model.CheckValueInfo = result[i, 4];
                        _model.StandValue     = result[i, 10]; //检测标准值
                        _model.Result         = result[i, 9];  //检测结论 (合格、不合格)

                        _model.ResultInfo = result[i, 5];      //检测值单位
                        //当判定符号为%时,对检测值进行数字转换
                        if (_model.ResultInfo != null && _model.ResultInfo.Equals("%"))
                        {
                            _model.CheckValueInfo = Convert.ToDouble(Global.StringConvertDouble(_model.CheckValueInfo) * 100).ToString("F3");
                        }
                        else if (!_model.CheckValueInfo.Equals("0"))
                        {
                            if (Global.StringConvertDouble(_model.CheckValueInfo) != 0)
                            {
                                _model.CheckValueInfo = Global.StringConvertDouble(_model.CheckValueInfo).ToString("F3");
                            }
                        }

                        //if (Cpoint != null)
                        //{
                        //    _model.CheckPlace = Cpoint.orgName;
                        //    _model.CheckPlaceCode = Cpoint.orgNum;
                        //    _model.CheckUnitName = Cpoint.pointName;
                        //    _model.APRACategory = Cpoint.pointType;
                        //}
                        //else
                        //{
                        //    _model.CheckPlace = "食品药品监督管理局";
                        //    _model.CheckPlaceCode = "0010010001";
                        //    _model.CheckUnitName = "食品药品监督管理局检测中心";
                        //    _model.APRACategory = "检测中心";
                        //}
                        _model.CheckPlaceCode = Global.KsMarketCode;                                   //Global.samplenameadapter.Count > 0 ? Global.samplenameadapter[0].CheckPlaceCode : string.Empty; //行政机构代码
                        _model.CheckPlace     = Global.KsMarketName;                                   //Global.samplenameadapter.Count > 0 ? Global.samplenameadapter[0].Organization : string.Empty; //检测设备型号
                        _model.CheckUnitName  = Global.KsMarketName;                                   // Global.samplenameadapter.Count > 0 ? Global.samplenameadapter[0].CheckPointName : string.Empty; //
                        _model.APRACategory   = "";                                                    //Global.samplenameadapter.Count > 0 ? Global.samplenameadapter[0].CheckPointType : string.Empty;

                        _model.UpLoader = result[i, 7];                                                //基层上传人
                        _model.TakeDate = _nowTime.ToString("yyyy-MM-dd");                             //抽样日期
                        _model.Standard = result[i, 12];                                               //检测依据

                        _model.ResultType        = result[i, 1];                                       //检测类别=检测手段
                        _model.Hole              = result[i, 0];                                       //检测孔
                        _model.CheckStartDate    = result[i, 6];                                       //检测日期=检测时间
                        _model.CheckUnitInfo     = result[i, 7];                                       //检测人员=检测人姓名
                        _model.Organizer         = result[i, 7];                                       //抽样人
                        _model.CheckMethod       = result[i, 3];                                       //检测方法
                        _model.CheckPlanCode     = result[i, 13];                                      //任务编号
                        _model.CheckMachine      = Global.InstrumentNameModel + Global.InstrumentName; //检测设备
                        _model.CheckMachineModel = Global.InstrumentNameModel;                         //检测设备型号
                        _model.MachineCompany    = "广州达元食品安全技术有限公司";                                   //检测设备生产厂家
                        _model.ContrastValue     = string.Empty;
                        _model.SampleId          = result[i, 15];
                        _model.DeviceId          = Wisdom.DeviceID;
                        _model.ProduceCompany    = result[i, 16];

                        //昆山相关
                        _model.DABH                  = result[i, 17];
                        _model.PositionNo            = result[i, 18];
                        _model.DABHName              = result[i, 19];
                        _model.SubItemCode           = result[i, 20];
                        _model.SubItemName           = result[i, 21];
                        _model.QuickCheckItemCode    = result[i, 22];
                        _model.QuickCheckSubItemCode = result[i, 23];

                        _bll.Insert(_model, out ourEgg);
                        if (ourEgg.Equals(string.Empty))
                        {
                            CountLength++;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                FileUtils.Log(ex.ToString());
                MessageBox.Show(ex.Message);
            }
            return(CountLength);
        }