コード例 #1
0
        decimal CheckDataValidate(decimal checkdata)
        {
            try
            {
                systemcheckset        sysset = null;
                List <systemcheckset> scsl   = SerializeXML <systemcheckset> .Getlist();

                if (scsl != null || scsl.Count > 0)
                {
                    sysset = scsl.FirstOrDefault();
                }
                if (sysset == null || sysset.throwvalue == null || sysset.throwvalue <= 0)
                {
                    return(checkdata);
                }
                decimal targetvalue  = Convert.ToDecimal(GetTargetValue());
                decimal throwdatemin = targetvalue * (((sysset.throwvalue ?? 0) / 100));
                decimal throwdatemax = targetvalue * (1 + ((sysset.throwvalue ?? 0) / 100));
                if (targetvalue > throwdatemax || targetvalue < throwdatemin)
                {
                    return(0);
                }
                return(checkdata);
            }
            catch { return(0); }
        }
コード例 #2
0
        void savecheckset()
        {
            List <systemcheckset> ls = new List <systemcheckset>();

            try {
                systemcheckset s = new systemcheckset();
                s.throwvalue = Convert.ToDecimal(this.tb_throw.Text.Trim());
                // s.boundaryvalue = Convert.ToDecimal(this.tb_jmax .Text .Trim  ());
                s.count       = Convert.ToInt32(this.tb_jcount.Text.Trim());
                s.arry        = Convert.ToInt32(this.tb_jarry.Text.Trim());
                s.ishavejuser = (this.rb_true.IsChecked == null || this.rb_true.IsChecked == false) ? false : true;
                s.noticeshow  = (this.rb_show.IsChecked == null || this.rb_show.IsChecked == false) ? false : true;
                s.noticetime  = Convert.ToInt32(this.tb_hour.Text.Trim()).ToString("D2") + ":" + Convert.ToInt32(this.tb_min.Text.Trim()).ToString("D2") + ":" + Convert.ToInt32(this.tb_second.Text.Trim()).ToString("D2");
                s.noticedays  = this.tb_day.Text.Trim();
                ls.Add(s);
                if (SerializeXML <systemcheckset> .exit())
                {
                    SerializeXML <systemcheckset> .del();
                }
                SerializeXML <systemcheckset> .SaveList(ls);

                MessageAlert.Alert("设置成功!");
            }

            catch (Exception ex) { MessageAlert.Error("出错!" + ex); }
        }
コード例 #3
0
        //void AddToList(ShowCheckresult sc)
        //{
        //    if (sc == null) return;
        //    if (CountPlus(sc))
        //    {

        //        sc.id = id;
        //        showcheckset.Add(sc);
        //        CheckDataBind();
        //        id++;

        //    }
        //}

        bool CountPlus(decimal checkdata)
        {
            systemcheckset        sysset = null;
            List <systemcheckset> scsl   = SerializeXML <systemcheckset> .Getlist();

            if (scsl != null || scsl.Count > 0)
            {
                sysset = scsl.FirstOrDefault();
            }
            if (procheckdata)
            {
                successcount++;
            }

            if (successcount > sysset.count)
            {
                arry         = sysset.arry ?? 1;
                successcount = 0;
                arry         = 4;
            }

            if (arry > sysset.arry)
            {
                finisharry++;
                NextCheck(finisharry);
                successcount = 0;
                arry         = 1;
                procheckdata = true;
            }

            if (finisharry > 3)
            {
                isFinishCheck = true;
                return(false);
            }

            ShowCheckresult sc = CheckResult(checkdata);

            sc.id = id;
            showcheckset.Add(sc);
            CheckDataBind();
            id++;

            if (sc.result.Equals("√"))
            {
                procheckdata = true;

                this.lb_status.Content = "本次不合格!";
            }
            else
            {
                procheckdata = false;
                successcount = 0;
                arry++;
                this.lb_status.Content = "本次不合格!";
            }
            return(true);
        }
コード例 #4
0
ファイル: Class1.cs プロジェクト: OldTangN/TorqueCheckManage
        /// <summary>
        /// 获取设置校验次数组数
        /// </summary>
        void getSystemSet()
        {
            List <systemcheckset> scsl = SerializeXML <systemcheckset> .Getlist();

            if (scsl != null || scsl.Count > 0)
            {
                sysset = scsl.FirstOrDefault();
            }
            sysset = null;
        }
コード例 #5
0
 public HandleData(users juser, userinfo zuser, wrench wrenchmodel, bool wrenchisgood, decimal setvalue = 0, decimal errorrangmin = 0, decimal errorrangmax = 0)
 {
     _wrench = wrenchmodel;
     //_checkdatashow = checkdatashow;
     _setvalue     = setvalue;
     _errorrangmin = errorrangmin;
     _errorrangmax = errorrangmax;
     _systemset    = GetSystem();
     _juser        = juser;
     _zuser        = zuser;
     _wrenchisgood = wrenchisgood;
 }
コード例 #6
0
        //void OnTimedEvent(object serder, EventArgs e)
        //{
        //    this.Dispatcher.Invoke(DispatcherPriority.Normal,
        //        new TimerDispatcherDelegate(UpdateUI));
        //}

        //void UpdateUI()
        //{
        //    try
        //    {
        //        uint result = Convert.ToUInt32(EncoderPlc.getIntimeData(),16);
        //        Console.WriteLine("值:"+result);
        //        this.machon.Text = Convert.ToInt64(EncoderPlc.getIntimeData(),16).ToString ();
        //        if (EncoderPlc.Direction())
        //        {
        //            direction_yes.Visibility = Visibility.Visible;
        //            direction_no.Visibility = Visibility.Hidden;
        //        }
        //        else
        //        {
        //            direction_yes.Visibility = Visibility.Hidden;
        //            direction_no.Visibility = Visibility.Visible;
        //        }
        //        if (EncoderPlc.ReDirection())
        //        {
        //            redirection_yes.Visibility = Visibility.Visible;
        //            redirection_no.Visibility = Visibility.Hidden;
        //        }
        //        else
        //        {
        //            redirection_yes.Visibility = Visibility.Hidden;
        //            redirection_no.Visibility = Visibility.Visible;
        //        }
        //    }
        //    catch(Exception ex)
        //    {
        //    }
        //}
        void checksetshow()
        {
            // bool sl = SerializeXML<systemcheckset>.exit();

            List <systemcheckset> ls = new List <systemcheckset>();

            try
            {
                ls = SerializeXML <systemcheckset> .Getlist();


                if (ls.Count > 0)
                {
                    systemcheckset s = new systemcheckset();
                    s = ls.FirstOrDefault();
                    this.tb_jarry.Text  = s.arry == null?"":s.arry.ToString();
                    this.tb_jcount.Text = s.count == null?"":s.count.ToString();
                    this.tb_throw.Text  = s.throwvalue.ToString();
                    radiobutton((s.ishavejuser == null || s.ishavejuser == false)?false:true);
                    string[] time = s.noticetime.Split(':');
                    if (time.Length >= 3)
                    {
                        this.tb_hour.Text   = Convert.ToInt32(time[0]).ToString("D2");
                        this.tb_min.Text    = Convert.ToInt32(time[1]).ToString("D2");
                        this.tb_second.Text = Convert.ToInt32(time[2]).ToString("D2");
                    }
                    this.tb_day.Text = s.noticedays.ToString();
                    if (s.noticeshow)
                    {
                        this.rb_show.IsChecked = true;
                    }
                    else
                    {
                        this.rb_notshow.IsChecked = true;
                    }
                }
            }
            catch
            {
                // MessageAlert.Alert("没有相应的检验参数设置"); return;
            }
        }
コード例 #7
0
        void getsystemset()
        {
            try
            {
                List <systemcheckset> scsl = SerializeXML <systemcheckset> .Getlist();

                erl = SerializeXML <errorrangset> .Getlist();

                ttml = SerializeXML <TorqueTestModel> .Getlist();

                if (scsl.Count > 0)
                {
                    _systemcheckset = scsl.FirstOrDefault();
                }
            }
            catch
            {
                MessageAlert.Alert("校验仪没有任何进行设置!不能校验!");
            }
        }
コード例 #8
0
        private void bt_print_Click(object sender, RoutedEventArgs e)
        {
            if (this.dt_showdate.SelectedIndex < 0)
            {
                MessageAlert.Alert("请选择要打印的行!");
                return;
            }
            int                   cid    = 1;
            systemcheckset        sysset = null;
            List <systemcheckset> scsl   = SerializeXML <systemcheckset> .Getlist();

            if (scsl != null || scsl.Count > 0)
            {
                sysset = scsl.FirstOrDefault();
            }
            WrenchCheckOut           wco = dt_showdate.SelectedItem as WrenchCheckOut;
            List <torquecheckrecord> cd  = CheckTargetRecord.SelectByCheckTargetID(wco.guid);
            wrench w = Wrench.selectByBarcode(wco.wrenchbarcode);
            List <ShowCheckresult> scr = new List <ShowCheckresult>();

            if (cd != null)
            {
                List <torquecheckrecord> success = cd.FindAll(p => p.isEffective == true);
                foreach (torquecheckrecord t in success)
                {
                    scr.Add(new ShowCheckresult()
                    {
                        id = cid, checkdata = t.analyserValue, setdata = t.torqueTargetValue, normalrang = (t.torqueTargetValue * (1 + Convert.ToDecimal(t.errorRangeMin))).ToString("f2") + "~" + (t.torqueTargetValue * (1 + Convert.ToDecimal(t.errorRangeMax))).ToString("f2"), result = t.passedFlag == true ? "√" : "×", error = t.torqueTargetValue == 0 ? "" : (((t.analyserValue - t.torqueTargetValue) / t.torqueTargetValue) * 100).ToString("f2") + "%"
                    });
                    cid++;
                }

                List <string> successdata = GetCheckTarget(success);

                foreach (string s in successdata)
                {
                    cd.RemoveAll(p => { if (p.torqueTargetValue.ToString("f2") == s)
                                        {
                                            return(true);
                                        }
                                        else
                                        {
                                            return(false);
                                        } });
                }
                List <string> faildataa = GetCheckTarget(cd);
                foreach (string s in faildataa)
                {
                    List <torquecheckrecord> fail = cd.FindAll(p => p.torqueTargetValue.ToString("f2") == s);
                    int m = 0;
                    foreach (torquecheckrecord t in fail)
                    {
                        if (m >= sysset.count)
                        {
                            break;
                        }
                        scr.Add(new ShowCheckresult()
                        {
                            id = cid, checkdata = t.analyserValue, setdata = t.torqueTargetValue, normalrang = (t.torqueTargetValue * (1 + Convert.ToDecimal(t.errorRangeMin))).ToString("f2") + "~" + (t.torqueTargetValue * (1 + Convert.ToDecimal(t.errorRangeMax))).ToString("f2"), result = t.passedFlag == true ? "√" : "×", error = t.torqueTargetValue == 0 ? "" : (((t.analyserValue - t.torqueTargetValue) / t.torqueTargetValue) * 100).ToString("f2") + "%"
                        });
                        m++;
                        cid++;
                    }
                }
            }
            #region


            //foreach (torquecheckrecord ck in cd)
            //{
            //    decimal check= Convert.ToDecimal(ck.analyserValue );
            //    decimal setvalue= Convert.ToDecimal(wco.torquetargetvalue);
            //    decimal derror = Convert.ToDecimal(((check - setvalue) / setvalue).ToString("f4"));
            //    scr.Add(new ShowCheckresult() { checkdata =check, setdata =setvalue, normalrang = wco.errorrange,normalmax=wco.errormax ,normalmin =wco.errormin , errorrang =derror,result = ck.passedFlag  ? "√" : "×" });
            //}
            if (scr == null || scr.Count <= 0)
            {
                MessageAlert.Alert("选中行没有详细的校验数据!");
                return;
            }


            //foreach (torquecheckrecord t in cd)
            //{
            //    if (t.isEffective)
            //        confcount++;
            //}
            //if (confcount <= 0)
            //{
            //    systemcheckset _systemcheckset = new systemcheckset();
            //    try
            //    {
            //        confcount = Convert.ToInt16(_systemcheckset.count);
            //    }
            //    catch { confcount = 0; }
            //}
            //if (confcount <= 0)
            //    confcount = 5;
            HandleData hd = new HandleData(wco.juserinfo.user, wco.zuserinfo, w, wco.is_good, Convert.ToDecimal(wco.torquetargetvalue), Convert.ToDecimal(10), Convert.ToDecimal(10));
            //hd.Checkdatashow = scr;
            //hd.filterdata();
            //List<ShowCheckresult> lssc = hd.Getprint();
            PrintSingleCheckdata psc = PrintSingleCheckdata.GetPrintSingleCheckdata(w, scr, cd.Count, Convert.ToDecimal(wco.torquetargetvalue), wco.juserinfo, wco.zuserinfo, Convert.ToDateTime(wco.checkdate), wco.is_good);
            psc.Topmost = true;
            psc.Owner   = _main;
            psc.Show();
            #endregion
        }