Example #1
0
        /// <summary>
        /// 确定修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void labelRepair_Click(object sender, EventArgs e)
        {
            clsUpdateData updata = new clsUpdateData();
            clsSetSqlData sql    = new clsSetSqlData();
            string        err    = string.Empty;

            try
            {
                for (int i = 0; i < CheckDatas.Rows.Count; i++)
                {
                    //updata.bianhao = CheckDatas.Rows[i].Cells[0].Value.ToString();
                    //Global.bianhao = CheckDatas.Rows[i].Cells[0].Value.ToString();
                    ////updata.Chkxiangmu = CheckDatas.Rows[i].Cells[1].Value.ToString();
                    //Global.Chkxiangmu = CheckDatas.Rows[i].Cells[1].Value.ToString();
                    ////updata.ChkTime = CheckDatas.Rows[i].Cells[2].Value.ToString();
                    //Global.ChkTime =DateTime.Parse( CheckDatas.Rows[i].Cells[2].Value.ToString());
                    ////updata.ChkSample = CheckDatas.Rows[i].Cells[3].Value.ToString();
                    //Global.ChkSample = CheckDatas.Rows[i].Cells[3].Value.ToString();
                    //updata.result = CheckDatas.Rows[i].Cells[14].Value.ToString();
                    //updata.unit = CheckDatas.Rows[i].Cells[5].Value.ToString();
                    //updata.GetSampTime = CheckDatas.Rows[i].Cells[6].Value.ToString();
                    //updata.GetSampPlace = CheckDatas.Rows[i].Cells[7].Value.ToString();
                    //updata.intrument = CheckDatas.Rows[i].Cells[8].Value.ToString();
                    //updata.Chktestbase = CheckDatas.Rows[i].Cells[9].Value.ToString();
                    ////updata.ChklimitData = CheckDatas.Rows[i].Cells[8].Value.ToString();
                    //updata.ChkPeople = CheckDatas.Rows[i].Cells[10].Value.ToString();
                    //updata.ChkUnit = CheckDatas.Rows[i].Cells[11].Value.ToString();
                    //updata.quantityin = CheckDatas.Rows[i].Cells[12].Value.ToString();
                    //updata.sampleNum = CheckDatas.Rows[i].Cells[13].Value.ToString();
                    //sql.UpdateResult(updata, out err);

                    updata.ChkSample    = CheckDatas.Rows[i].Cells[0].Value.ToString();;
                    updata.Chkxiangmu   = CheckDatas.Rows[i].Cells[1].Value.ToString();
                    updata.result       = CheckDatas.Rows[i].Cells[2].Value.ToString();
                    updata.unit         = CheckDatas.Rows[i].Cells[3].Value.ToString();
                    updata.Chktestbase  = CheckDatas.Rows[i].Cells[4].Value.ToString();
                    updata.ChklimitData = CheckDatas.Rows[i].Cells[5].Value.ToString();
                    updata.intrument    = CheckDatas.Rows[i].Cells[6].Value.ToString();
                    updata.conclusion   = CheckDatas.Rows[i].Cells[7].Value.ToString();
                    updata.detectunit   = CheckDatas.Rows[i].Cells[8].Value.ToString();
                    updata.GetSampTime  = CheckDatas.Rows[i].Cells[9].Value.ToString();
                    updata.GetSampPlace = CheckDatas.Rows[i].Cells[10].Value.ToString();
                    updata.ChkUnit      = CheckDatas.Rows[i].Cells[11].Value.ToString();
                    updata.ChkPeople    = CheckDatas.Rows[i].Cells[12].Value.ToString();
                    updata.ChkTime      = CheckDatas.Rows[i].Cells[13].Value.ToString();

                    sql.RepairResult(updata, ssid[i], out err);
                }

                MessageBox.Show("修改成功", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
            this.Close();
        }
Example #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            clsUpdateData updata = new clsUpdateData();

            string err = string.Empty;

            try
            {
                updata.ChkSample        = txtSampleName.Text.Trim();
                updata.Chkxiangmu       = txtChkItem.Text.Trim();
                updata.result           = txtChkResult.Text.Trim();
                updata.unit             = txtUnit.Text.Trim();
                updata.Chktestbase      = txtTestBase.Text.Trim();
                updata.ChklimitData     = txtStandValue.Text.Trim();
                updata.intrument        = txtIntrument.Text.Trim();
                updata.conclusion       = txtConclusion.Text.Trim();
                updata.detectunit       = txtdetectunit.Text.Trim();
                updata.ChkUnit          = txtInspectionunit.Text.Trim();
                updata.ChkPeople        = txtTester.Text.Trim();
                updata.ChkTime          = txtChkTime.Text.Trim();
                updata.ChkSampleCode    = txtSampeCode.Text.Trim();
                updata.Retester         = txtReTester.Text.Trim();
                updata.chkcompanycode   = txtcompanycode.Text.Trim();
                updata.Shenfenzheng     = txtSfzh.Text.Trim();
                updata.jigoubianhao     = txtJigouNum.Text.Trim();
                updata.ChkitemCode      = txtBigItemCode.Text.Trim();
                updata.ChkitemsmallCode = txtSamllItemcode.Text.Trim();
                updata.retest           = txtRetest.Text.Trim();
                updata.beizhu           = txtbeizhu.Text.Trim();
                updata.Jingyinghu       = txtopertor.Text.Trim();
                updata.stallnum         = txtStallNum.Text.Trim();
                updata.markettype       = txtUnittype.Text.Trim();

                //updata.GetSampTime = txtGettime.Text.Trim();
                //updata.GetSampPlace = txtAddress.Text.Trim();

                //updata.sampleNum = txtSampleNum.Text.Trim();
                //updata.CheckCompanyNature = txtUnitNature.Text.Trim();
                //updata.sampletype = txtSampleType.Text.Trim();//样品种类
                //updata.ProductPlace = txtProductPlace.Text.Trim();//产地
                //updata.ProductUnit = txtProductUnit.Text.Trim();//生产单位
                //updata.ProductDate = txtProductDate.Text.Trim();//生产日期
                //updata.SendDate = txtSendDate.Text.Trim();//送检日期
                //updata.DoResult = txtDoResult.Text.Trim();//处理结果

                sql.RepairResult(updata, ssid, out err);

                this.DialogResult = DialogResult.OK;
                MessageBox.Show("数据修改成功", "提示");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }

            this.Close();
        }
Example #3
0
        /// <summary>
        /// 数据上传
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdata_Click(object sender, EventArgs e)
        {
            if (CheckDatas.Rows.Count < 1)
            {
                MessageBox.Show("没有检测数据上传", "提示");
                return;
            }

            if (Global.ServerAdd.Length == 0)
            {
                MessageBox.Show("服务器地址不能为空", "提示");
                return;
            }
            if (Global.DetectUnit.Length == 0)
            {
                MessageBox.Show("检测单位不能为空", "提示");
                return;
            }

            DialogResult tishi = MessageBox.Show("共有" + CheckDatas.Rows.Count + "条数据是否上传", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (tishi == DialogResult.No)
            {
                return;
            }
            btnUpdata.Enabled   = false;
            Global.ServerAdd    = ConfigurationManager.AppSettings["ServerAddr"];     //服务器地址
            Global.DetectUnit   = ConfigurationManager.AppSettings["UpDetectUnit"];   //检测单位
            Global.DetectUnitNo = ConfigurationManager.AppSettings["UpDetectUnitNo"]; //检测单位编号
            Global.UploadType   = ConfigurationManager.AppSettings["UploadType"];     //上传类型
            Global.IntrumentNum = ConfigurationManager.AppSettings["IntrumentNum"];   //设备ID

            string err     = "";
            int    iok     = 0;
            int    ino     = 0;
            string ErrInfo = "";

            try
            {
                for (int i = 0; i < CheckDatas.Rows.Count; i++)
                {
                    //边查询边上传
                    StringBuilder sbd = new StringBuilder();

                    sbd.Append("Checkitem='");
                    sbd.Append(CheckDatas.Rows[i].Cells[2].Value.ToString());
                    sbd.Append("' and SampleName='");
                    sbd.Append(CheckDatas.Rows[i].Cells[1].Value.ToString());
                    sbd.Append("' and CheckData='");
                    sbd.Append(CheckDatas.Rows[i].Cells[3].Value.ToString());
                    sbd.Append("' and CheckTime=#");
                    sbd.Append(DateTime.Parse(CheckDatas.Rows[i].Cells[14].Value.ToString()));
                    sbd.Append("#");
                    //查询界面上没有的数据信息
                    DataTable rt = sqlSet.GetDataTable(sbd.ToString(), "");
                    if (rt != null && rt.Rows.Count > 0)
                    {
                        udata.detectunit = CheckDatas.SelectedRows[i].Cells[9].Value.ToString();       //被检单位
                        udata.checkunit  = CheckDatas.SelectedRows[i].Cells[11].Value.ToString();      //被检单位
                        udata.checkitem  = CheckDatas.SelectedRows[i].Cells[1].Value.ToString();       //检测项目
                        udata.ttime      = CheckDatas.SelectedRows[i].Cells[13].Value.ToString();      //检测时间
                        udata.chkdata    = CheckDatas.SelectedRows[i].Cells[2].Value.ToString();       //检测数值
                        udata.unit       = System.Web.HttpUtility.UrlEncode(rt.Rows[0][4].ToString()); //System.Web.HttpUtility.UrlEncode("%");//数值单位 对非法字符进行url转换

                        if (CheckDatas.SelectedRows[i].Cells[7].Value.ToString() == "阴性" || CheckDatas.SelectedRows[i].Cells[7].Value.ToString() == "合格")
                        {
                            udata.Conclusion = "合格";// 检测结论
                        }
                        else
                        {
                            udata.Conclusion = "不合格";
                        }
                        udata.samplenumber  = rt.Rows[0][18].ToString();                             //样品编号
                        udata.samplename    = CheckDatas.SelectedRows[i].Cells[0].Value.ToString();  //样品名称
                        udata.sampleOrigin  = CheckDatas.SelectedRows[i].Cells[10].Value.ToString(); //样品产地
                        udata.testbase      = rt.Rows[0][12].ToString();                             //检测依据
                        udata.ChkMachineNum = rt.Rows[0][20].ToString();                             //设备编号
                        udata.standvalue    = rt.Rows[0][13].ToString();                             //标准值
                        udata.chker         = CheckDatas.SelectedRows[i].Cells[12].Value.ToString();
                        udata.uptype        = int.Parse(Global.UploadType);
                        udata.shebeiID      = Global.IntrumentNum;

                        string rd = KeRunUpData.UpData(udata);

                        JavaScriptSerializer   jsup = new JavaScriptSerializer();
                        KeRunUpData.ReturnInfo retu = jsup.Deserialize <KeRunUpData.ReturnInfo>(rd); //将json数据转化为对象类型并赋值给list

                        if (retu.status == "1" && retu.info == "success")
                        {
                            CheckDatas.SelectedRows[i].DefaultCellStyle.BackColor = Color.Green;//上传成功变绿色
                            iok = iok + 1;
                            clsUpdateData ud = new clsUpdateData();
                            ud.result  = CheckDatas.SelectedRows[i].Cells[2].Value.ToString();
                            ud.ChkTime = CheckDatas.SelectedRows[i].Cells[13].Value.ToString();
                            sqlSet.SetUpLoadData(ud, out err);
                        }
                        else
                        {
                            ino     = ino + 1;
                            ErrInfo = ErrInfo + "(" + ino + ")" + retu.info;
                        }
                    }
                }
                MessageBox.Show("共成功上传" + iok + "条数据;失败" + ino + "条数据,失败原因:" + ErrInfo, "数据上传");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
            btnUpdata.Enabled = true;
        }
Example #4
0
        /// <summary>
        /// 数据上传
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void btnadd_Click(object sender, EventArgs e)
        {
            btnadd.Enabled        = false;
            Global.ServerAdd      = ConfigurationManager.AppSettings["ServerAddr"];
            Global.ServerName     = ConfigurationManager.AppSettings["ServerName"];
            Global.ServerPassword = ConfigurationManager.AppSettings["ServerPassword"];
            string err = "";
            int    iok = 0;
            int    ino = 0;

            try
            {
                //登录
                string rt = TYUpData.Logon();

                JavaScriptSerializer js   = new JavaScriptSerializer();
                TYUpData.login       list = js.Deserialize <TYUpData.login>(rt);     //将json数据转化为对象类型并赋值给list
                Global.CompanyCode        = list.qycode;
                Global.UserCode = list.userid;

                for (int i = 0; i < CheckDatas.Rows.Count; i++)
                {
                    udata.shuliang = CheckDatas.Rows[i].Cells[11].Value.ToString().Trim();
                    udata.ttime    = CheckDatas.Rows[i].Cells[9].Value.ToString().Trim();
                    udata.chker    = CheckDatas.Rows[i].Cells[16].Value.ToString().Trim();

                    udata.duixiang    = CheckDatas.Rows[i].Cells[1].Value.ToString().Trim();
                    udata.chkdata     = CheckDatas.Rows[i].Cells[3].Value.ToString().Trim();
                    udata.companyCode = Global.CompanyCode;
                    if (CheckDatas.Rows[i].Cells[8].Value.ToString().Trim() == "阴性" || CheckDatas.Rows[i].Cells[8].Value.ToString().Trim() == "合格")
                    {
                        udata.Conclusion = "合格";
                        udata.hegelv     = "100";//合格率
                    }
                    else
                    {
                        udata.Conclusion = "不合格";
                        udata.hegelv     = "0";//合格率
                    }

                    string rd = TYUpData.UpData(udata);

                    JavaScriptSerializer jsup = new JavaScriptSerializer();
                    TYUpData.Upload      retu = jsup.Deserialize <TYUpData.Upload>(rd);     //将json数据转化为对象类型并赋值给list
                    if (retu.isSucess == "上传成功")
                    {
                        CheckDatas.Rows[i].DefaultCellStyle.BackColor = Color.Green;//上传成功变绿色
                        iok = iok + 1;
                        clsUpdateData ud = new clsUpdateData();
                        ud.result  = CheckDatas.Rows[i].Cells[3].Value.ToString().Trim();
                        ud.ChkTime = CheckDatas.Rows[i].Cells[9].Value.ToString().Trim();
                        sql.SetUpLoadData(ud, out err);
                    }
                    else
                    {
                        ino = ino + 1;
                    }
                }
                MessageBox.Show("共成功上传" + iok + "条数据,失败" + ino + "条数据", "数据上传");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
            btnadd.Enabled = true;
        }