Exemplo n.º 1
0
 private void Save()
 {
     if (!string.IsNullOrEmpty(_UnqualifiedValue))
     {
         _AllNumber = TestResultConserve.ResultConserve(_CheckValue);
         if (_AllNumber > 0)
         {
             LabelInfo.Content = "成功保存 " + _AllNumber + " 条数据!";
             button3.IsEnabled = false;
             button1.IsEnabled = true;
         }
         else
         {
             LabelInfo.Content = "保存失败或是未检出!";
         }
     }
     else
     {
         MessageBox.Show("未检出");
     }
 }
Exemplo n.º 2
0
 private void Save()
 {
     _AllNumber = TestResultConserve.ResultConserve(_CheckValue);
 }
Exemplo n.º 3
0
        private void UpdateStatus(byte[] data)
        {
            string[] types = { "数据测试中", "测试完成", "未检出", "加标测试" };
            int      count = _canvases.Count;

            for (int i = 0; i < count; i++)
            {
                int offset  = i * 16;
                int type    = (data[offset + 8] << 8) | (data[offset + 9]);
                int time    = (data[offset + 10] << 8) | (data[offset + 11]);
                int v       = (data[offset + 12] << 8) | (data[offset + 13]);
                int a       = (data[offset + 14] << 24 | data[offset + 15] << 16 | data[offset + 16] << 8 | data[offset + 17]);
                int density = (data[offset + 18] << 24 | data[offset + 19] << 16 | data[offset + 20] << 8 | data[offset + 21]);
                _listTime[i].Content = "时间:" + time * 0.1 + "S";
                _listMV[i].Content   = "电位:" + v + "mV";
                _listUA[i].Content   = "电流:" + a * (0.0001) + "uA";
                //取最大电流
                if (maxA < a * (0.0001))
                {
                    maxA = a * (0.0001);
                }

                if (time > 0 && time < 2200 && v > 64436)
                {
                    if (_cruveWindow == null)
                    {
                        _cruveWindow = new CurveWindow();
                        _cruveWindow.Show();
                        Global.timeValue = time * 0.1;
                        Global.xValue    = v;
                        Global.yValue    = a * (0.0001);
                    }
                    else
                    {
                        Global.timeValue = time * 0.1;
                        Global.xValue    = v;
                        Global.yValue    = a * (0.0001);
                    }
                    dobv[index] = v;
                    doba[index] = a * 0.0001;
                    index++;
                }
                else
                {
                    _cruveWindow = null;
                }
                _listDensity[i].Content = "浓度:" + density * 0.0001 + "ug/l";
                _Value = Convert.ToString(density * 0.0001);
                if (type < 4)
                {
                    _listStage[i].Content = types[type];
                }
                else
                {
                    _listStage[i].Content = "检测到未知数据";
                }

                if (type != 0)
                {
                    //计算浓度
                    //x=(b*b-4*a(c-y)-b)/2a
                    //a=A2,b=A1,c=A0,y为电流(取最高值)
                    double xV = Math.Pow(((_item.a1 * _item.a1) - (4 * _item.a2) * (_item.a0 - maxA)), 1f / 2);
                    double x  = (xV - _item.a1) / (2 * _item.a2);
                    _listJudgmentReult[i].Text = (x * _item.DilutionRatio > _item.Requirements) ? "不合格" : "合格";
                    _listtextNongdu[i].Text    = (x * _item.DilutionRatio).ToString("F4") + "ug/l";
                    btn_result.IsEnabled       = true;
                }

                if (type == 1)
                {
                    _StandardValue             = TestResultConserve.UnqualifiedOrQualified((density * 0.0001).ToString(), _item.Hole[i].SampleName, _item.Name);
                    _UnqualifiedValue          = Convert.ToString(_StandardValue[0]);
                    _listStandardValue[i].Text = Convert.ToString(_StandardValue[2]);
                    _listJudgmentReult[i].Text = Convert.ToString(_StandardValue[1]);

                    _CheckValue[i, 0]  = String.Format("{0:D2}", (i + 1));
                    _CheckValue[i, 1]  = "重金属";
                    _CheckValue[i, 2]  = _item.Name;
                    _CheckValue[i, 3]  = string.Empty;// methodToString[item.Method];
                    _CheckValue[i, 4]  = _Value;
                    _CheckValue[i, 5]  = _item.Unit;
                    _CheckValue[i, 6]  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    _CheckValue[i, 7]  = LoginWindow._userAccount.UserName;
                    _CheckValue[i, 8]  = string.IsNullOrEmpty(_item.Hole[i].SampleName) ? string.Empty : _item.Hole[i].SampleName;
                    _CheckValue[i, 9]  = Convert.ToString(_StandardValue[0]);
                    _CheckValue[i, 10] = Convert.ToString(_StandardValue[2]);
                    _CheckValue[i, 11] = String.Format("{0:D5}", _item.SampleNum);
                    _CheckValue[i, 12] = Convert.ToString(_StandardValue[1]);
                    _CheckValue[i, 13] = _item.Hole[i].TaskName ?? string.Empty;
                    _CheckValue[i, 14] = string.IsNullOrEmpty(_item.Hole[i].CompanyName) ? string.Empty : _item.Hole[i].CompanyName;
                    _CheckValue[i, 15] = string.IsNullOrEmpty(_item.Hole[i].SampleId) ? string.Empty : _item.Hole[i].SampleId;
                    _CheckValue[i, 16] = _item.Hole[i].ProduceCompany;
                    _AllNumber         = TestResultConserve.ResultConserve(_CheckValue);
                    if (LoginWindow._userAccount.UpDateNowing)
                    {
                        ButtonUpdate_Click(null, null);
                    }
                }
            }
        }