예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            cleaning();
            if (!String.IsNullOrEmpty(txtBarCode.Text))
            {
                Specs spec = DbFactory.Find(txtBarCode.Text, CurrentJob.IsFull);
                if (spec != null)
                {
                    //first process last spec;

                    /*
                     * if ((CurrentJob.IsFull==false) && (spec.IsFull))
                     * {
                     *  if (MessageBox.Show("此项检查是牵引变检查项目,是否继续检查?", "请确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No)
                     *      return;
                     * }*/
                    CurrentSpecs = spec;
                    InitView();
                }
                else
                {
                    MessageBox.Show("输入的编码不存在,请重新输入");
                }
            }
        }
예제 #2
0
 private void InitView()
 {
     tvMain.Nodes.Clear();
     tvMain.BeginUpdate();
     try
     {
         string sqlstring = String.Format("select Section,sequence,checkposition,id from DictSpecs where Section='{0}' order by sequence ", _keyName);
         if (!_Job.IsFull)
         {
             sqlstring = "select Section,sequence,checkposition,id from DictSpecs where isfull<>1 order by sequence";
         }
         using (IDataReader dr = DataAccess.ExecuteReader(sqlstring))
         {
             TreeNode t1      = null;
             TreeNode t2      = null;
             string   section = "";
             int      sequ    = 0;
             String   checkp  = "";
             while (dr.Read())
             {
                 if (!section.Equals(dr["Section"].ToString()))
                 {
                     section = dr["Section"].ToString();
                     t1      = new TreeNode(section);
                     tvMain.Nodes.Add(t1);
                 }
                 sequ   = Int32.Parse(dr["Sequence"].ToString());
                 checkp = dr["CheckPosition"].ToString();
                 t2     = new TreeNode(String.Format("{0}.{1}", sequ, checkp));
                 Specs spec = DbFactory.FindByFilter("ID=" + dr["ID"].ToString(), _Job.IsFull);
                 if (spec != null)
                 {
                     _Job.SetCheckToSpecs(spec);
                     if (spec.IsCheckAll)
                     {
                         t2.Checked   = true;
                         t2.ForeColor = System.Drawing.Color.Blue;
                     }
                     foreach (SpecsDetail detail in spec.Items)
                     {
                         TreeNode node = t2.Nodes.Add(String.Format("{0}({1})--{2}[{3}]",
                                                                    detail.CheckDetail, detail.CheckMethod,
                                                                    detail.SpecifiedSizeHeight, detail.KnockPosition));
                         node.Checked = detail.isChecked;
                         if (detail.isDone)
                         {
                             node.ForeColor = System.Drawing.Color.Blue;
                         }
                     }
                 }
                 t1.Nodes.Add(t2);
             }
             dr.Close();
         }
     }
     finally
     {
         tvMain.EndUpdate();
     }
 }
예제 #3
0
        public void SetCheckToSpecs(Specs spec)
        {
            //JobDetail detail = FindBySpecsID(spec.ID);
            JobDetail detail = findByBarCode(spec.BarCode);

            if (detail != null)
            {
                foreach (string kv in detail.CheckDetailList.Split(','))
                {
                    String[] checkresults = kv.Split('=');
                    if (checkresults.Length == 2)
                    {
                        int    spid        = Int32.Parse(checkresults[0]);
                        String checkresult = checkresults[1].Trim();
                        bool   ispass      = checkresult.Substring(0, 1) == "1" ? true : false;
                        string note        = "";
                        if (checkresult.Length > 2)
                        {
                            note = checkresult.Substring(2, checkresult.Length - 2);
                        }

                        SpecsDetail spdetail = spec.FindByID(spid);
                        if (spdetail != null)
                        {
                            spdetail.isChecked = ispass;
                            spdetail.isDone    = true;
                            spdetail.Note      = note;
                        }
                    }
                }
                spec.IsCheckAll = true;
                detail.BarCode  = spec.BarCode;
            }
        }
예제 #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            CurrentSpecs.IsCheckAll = true;
            foreach (ListViewItem item in lvMain.Items)
            {
                SpecsDetail detail = CurrentSpecs.FindByID(Int32.Parse(item.Tag.ToString()));
                detail.isChecked = item.Checked;
                if (!detail.isChecked)
                {
                    CurrentSpecs.IsCheckAll = false;
                }
            }
            //JobDetail jobdetail = CurrentJob.FindBySpecsID(CurrentSpecs.ID);
            JobDetail jobdetail = CurrentJob.findByBarCode(CurrentSpecs.BarCode);

            if (jobdetail == null)
            {
                jobdetail = new JobDetail();
            }
            jobdetail.JobID           = CurrentJob.ID;
            jobdetail.SpecsID         = CurrentSpecs.ID;
            jobdetail.CheckTime       = DateTime.Now;
            jobdetail.isChecked       = CurrentSpecs.IsCheckAll;
            jobdetail.CheckDetailList = CurrentSpecs.CheckDetailList;
            jobdetail.BarCode         = CurrentSpecs.BarCode;
            CurrentJob.Items.Add(jobdetail);
            if (jobdetail.ID == 0)
            {
                jobdetail.ID              = DbFactory.JobDetailInsert(jobdetail);
                CurrentJob.CheckPosition += 1;
            }
            else
            {
                DbFactory.JobDetailUpdate(jobdetail);
            }


            //DbFactory.SaveJob(CurrentJob);
            if (AppHelper.IsLockOnCheck == false)
            {
                Specs spec = DbFactory.FindBySequence(CurrentSpecs.Sequence + 1, CurrentJob.IsFull);
                if (spec != null)
                {
                    CurrentSpecs = spec;
                    InitView();
                }
                else
                {
                    //work done.
                    MessageBox.Show("已经检查到最大序号!");
                }
            }
            else
            {
                InitView();
            }
        }
예제 #5
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(txtBarCode.Text))
     {
         Specs spec = DbFactory.Find(txtBarCode.Text);
         if (spec != null)
         {
             //first process last spec;
             CurrentSpecs = spec;
             InitView();
         }
     }
 }
예제 #6
0
 public FormCheck(JobMain job) : this()
 {
     CurrentJob = job;
     if (job.Items.Count > 0)
     {
         Int32 specsid = job.Items.Max(jobdetail => jobdetail.SpecsID);
         Specs spec    = DbFactory.FindByFilter("ID=" + specsid.ToString());
         if (spec != null)
         {
             CurrentSpecs = spec;
             InitView();
         }
     }
 }
예제 #7
0
        public static Specs FindByFilter(String sFilter, Boolean isFull)
        {
            Specs result = new Specs();

            using (IDataReader dr = DataAccess.ExecuteReader(String.Format("select * from DictSpecs where {0}", sFilter)))
            {
                if (dr.Read())
                {
                    result.BarCode       = (dr["barcode"] == DBNull.Value)?"":dr["barcode"].ToString();
                    result.ID            = Int32.Parse(dr["ID"].ToString());
                    result.Sequence      = Int32.Parse(dr["Sequence"].ToString());
                    result.Seciton       = dr["Section"].ToString();
                    result.CheckPosition = dr["CheckPosition"].ToString();
                    result.CheckMethod   = dr["CheckMethod"].ToString();
                    result.IsFull        = (dr["IsFull"] == DBNull.Value) ? false : Boolean.Parse(dr["IsFull"].ToString());
                    dr.Close();
                }
                else
                {
                    return(null);
                }
            }
            string sqlstring = String.Format("select * from DictSpecsItems where DictSpecsID={0}", result.ID);

            if (isFull == false)
            {
                sqlstring = String.Format("select * from DictSpecsItems where DictSpecsID={0} and IsFull<>1", result.ID);
            }
            using (IDataReader dr = DataAccess.ExecuteReader(sqlstring))
            {
                while (dr.Read())
                {
                    SpecsDetail detail = new SpecsDetail();
                    detail.ID                  = Int32.Parse(dr["id"].ToString());
                    detail.SpecsID             = result.ID;
                    detail.SpecifiedSizeHeight = (dr["SpecifiedSizeHeight"] == DBNull.Value) ? "" : dr["SpecifiedSizeHeight"].ToString();
                    detail.CheckDetail         = dr["CheckDetail"].ToString();
                    detail.CheckMethod         = (dr["CheckMethod"] == DBNull.Value) ? result.CheckMethod : dr["CheckMethod"].ToString();
                    detail.KnockPosition       = (dr["KnockPosition"] == DBNull.Value) ? "" : dr["KnockPosition"].ToString();
                    detail.IsFull              = (dr["IsFull"] == DBNull.Value) ? false : Boolean.Parse(dr["IsFull"].ToString());
                    result.Items.Add(detail);
                }
            }
            return(result);
        }
예제 #8
0
        public static Specs FindByFilter(String sFilter,Boolean isFull)
        {
            Specs result = new Specs();
            using (IDataReader dr = DataAccess.ExecuteReader(String.Format("select * from DictSpecs where {0}", sFilter)))
            {
                if (dr.Read())
                {
                    result.BarCode = (dr["barcode"]==DBNull.Value)?"":dr["barcode"].ToString();
                    result.ID = Int32.Parse(dr["ID"].ToString());
                    result.Sequence = Int32.Parse(dr["Sequence"].ToString());
                    result.Seciton = dr["Section"].ToString();
                    result.CheckPosition = dr["CheckPosition"].ToString();
                    result.CheckMethod = dr["CheckMethod"].ToString();
                    result.IsFull = (dr["IsFull"] == DBNull.Value) ? false : Boolean.Parse(dr["IsFull"].ToString());
                    dr.Close();
                }
                else
                {

                    return null;
                }
            }
            string sqlstring = String.Format("select * from DictSpecsItems where DictSpecsID={0}", result.ID);
            if (isFull==false)
                sqlstring = String.Format("select * from DictSpecsItems where DictSpecsID={0} and IsFull<>1", result.ID);
            using (IDataReader dr = DataAccess.ExecuteReader(sqlstring))
            {
                while (dr.Read())
                {
                    SpecsDetail detail = new SpecsDetail();
                    detail.ID=Int32.Parse(dr["id"].ToString());
                    detail.SpecsID=result.ID;
                    detail.SpecifiedSizeHeight=(dr["SpecifiedSizeHeight"] == DBNull.Value) ? "" : dr["SpecifiedSizeHeight"].ToString();
                    detail.CheckDetail=dr["CheckDetail"].ToString();
                    detail.CheckMethod=(dr["CheckMethod"] == DBNull.Value) ? result.CheckMethod : dr["CheckMethod"].ToString();
                    detail.KnockPosition =(dr["KnockPosition"] == DBNull.Value) ? "" : dr["KnockPosition"].ToString();
                    detail.IsFull = (dr["IsFull"] == DBNull.Value) ? false : Boolean.Parse(dr["IsFull"].ToString());
                    result.Items.Add(detail);
                }
            }
            return result;
        }
예제 #9
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (CurrentSpecs == null)
            {
                return;
            }
            Int32 sequ = CurrentSpecs.Sequence - 1;

            if (sequ <= 0)
            {
                sequ = 1;
            }
            Specs spec = DbFactory.FindBySequence(sequ, CurrentJob.IsFull);

            if (spec != null)
            {
                CurrentSpecs = spec;
                InitView();
            }
        }
예제 #10
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (CurrentSpecs == null)
            {
                return;
            }
            Int32 sequ = CurrentSpecs.Sequence + 1;

            if (sequ >= CurrentJob.NeedCheckPosition)
            {
                sequ = CurrentJob.NeedCheckPosition;
            }
            Specs spec = DbFactory.FindBySequence(sequ, CurrentJob.IsFull);

            if (spec != null)
            {
                CurrentSpecs = spec;
                InitView();
            }
        }
예제 #11
0
        public static Specs Find(String barcode, Boolean isFull)
        {
            string sParam = "";

            barcode = barcode.Trim();
            if (barcode.Length == 16)
            {
                sParam = barcode.Substring(13, 3);
            }
            else
            {
                sParam = barcode.Substring(barcode.Length - 3, 3);
            }
            Specs result = FindByFilter(String.Format("ltrim(rtrim(barcode))='{0}'", sParam), isFull);

            if (result != null)
            {
                result.BarCode = barcode;
            }
            return(result);
        }
예제 #12
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            foreach (ListViewItem item in lvMain.Items)
            {
                SpecsDetail detail = CurrentSpecs.FindByID(Int32.Parse(item.Tag.ToString()));
                detail.isChecked = item.Checked;

            }
            JobDetail jobdetail = CurrentJob.FindBySpecsID(CurrentSpecs.ID);
            if (jobdetail == null)
            {
                jobdetail = new JobDetail();
            }
            jobdetail.JobID = CurrentJob.ID;
            jobdetail.SpecsID = CurrentSpecs.ID;
            jobdetail.CheckTime = DateTime.Now;
            jobdetail.isChecked = CurrentSpecs.IsCheckAll;
            jobdetail.CheckDetailList = CurrentSpecs.CheckDetailList;
            CurrentJob.Items.Add(jobdetail);
            if (jobdetail.ID == 0)
            {
                jobdetail.ID = DbFactory.JobDetailInsert(jobdetail);
                CurrentJob.CheckPosition += CurrentJob.CheckPosition;
            }
            else
                DbFactory.JobDetailUpdate(jobdetail);

            //DbFactory.SaveJob(CurrentJob);
            Specs spec = DbFactory.FindBySequence(CurrentSpecs.Sequence + 1);
            if (spec != null)
            {
                CurrentSpecs = spec;
                InitView();
            }
            else
            {
                //work done.
                MessageBox.Show("已经检查到最大序号!");
            }
        }
예제 #13
0
        public void SetCheckToSpecs(Specs spec)
        {
            JobDetail detail = FindBySpecsID(spec.ID);

            if (detail != null)
            {
                foreach (string kv in detail.CheckDetailList.Split(','))
                {
                    String[] checkresults = kv.Split('=');
                    if (checkresults.Length == 2)
                    {
                        int         spid     = Int32.Parse(checkresults[0]);
                        bool        ispass   = checkresults[1] == "1" ? true : false;
                        SpecsDetail spdetail = spec.FindByID(spid);
                        if (spdetail != null)
                        {
                            spdetail.isChecked = ispass;
                            spdetail.isDone    = true;
                        }
                    }
                }
                spec.IsCheckAll = true;
            }
        }
예제 #14
0
 private void txtSequ_ValueChanged(object sender, EventArgs e)
 {
     CurrentSpecs = DbFactory.FindBySequence(Int32.Parse(txtSequ.Value.ToString()), true);
     InitView();
 }
예제 #15
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(txtBarCode.Text))
     {
         Specs spec = DbFactory.Find(txtBarCode.Text);
         if (spec != null)
         {
             //first process last spec;
             CurrentSpecs = spec;
             InitView();
         }
     }
 }
예제 #16
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (CurrentSpecs == null)
         return;
     Int32 sequ = CurrentSpecs.Sequence + 1;
     if (sequ >= CurrentJob.NeedCheckPosition)
     {
         sequ = CurrentJob.NeedCheckPosition;
     }
     Specs spec = DbFactory.FindBySequence(sequ);
     if (spec != null)
     {
         CurrentSpecs = spec;
         InitView();
     }
 }
예제 #17
0
        public static bool UpdateSpecsBarCode(Specs spec, String barcode)
        {
            int result = DataAccess.ExecuteNonQuery(String.Format("Update DictSpecs set barcode='{0}' where id={1}", barcode, spec.ID));

            return(result == 1);
        }
예제 #18
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(txtBarCode.Text))
     {
         Specs spec = DbFactory.Find(txtBarCode.Text,CurrentJob.IsFull);
         if (spec != null)
         {
             //first process last spec;
             if ((CurrentJob.IsFull==false) && (spec.IsFull))
             {
                 if (MessageBox.Show("此项检查是全面检查项目,是否继续检查?", "请确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No)
                     return;
             }
             CurrentSpecs = spec;
             InitView();
         }
         else
         {
             MessageBox.Show("输入的编码不存在,请重新输入");
         }
     }
 }
예제 #19
0
 private void txtSequ_ValueChanged(object sender, EventArgs e)
 {
     CurrentSpecs = DbFactory.FindBySequence(Int32.Parse(txtSequ.Value.ToString()),true);
     InitView();
 }
예제 #20
0
        public void SetCheckToSpecs(Specs spec)
        {
            JobDetail detail = FindBySpecsID(spec.ID);
            if (detail != null)
            {
                foreach (string kv in detail.CheckDetailList.Split(','))
                {

                    String[] checkresults = kv.Split('=');
                    if (checkresults.Length == 2)
                    {
                        int spid = Int32.Parse(checkresults[0]);
                        String checkresult = checkresults[1].Trim();
                        bool ispass = checkresult.Substring(0, 1) == "1" ? true : false;
                        string note = "";
                        if (checkresult.Length > 2)
                        {
                            note = checkresult.Substring(2, checkresult.Length - 2);
                        }

                        SpecsDetail spdetail = spec.FindByID(spid);
                        if (spdetail != null)
                        {
                            spdetail.isChecked = ispass;
                            spdetail.isDone = true;
                            spdetail.Note = note;
                        }
                    }
                }
                spec.IsCheckAll = true;
                detail.BarCode = spec.BarCode;
            }
        }
예제 #21
0
 public static bool UpdateSpecsBarCode(Specs spec, String barcode)
 {
     int result = DataAccess.ExecuteNonQuery(String.Format("Update DictSpecs set barcode='{0}' where id={1}", barcode, spec.ID));
     return result == 1;
 }
예제 #22
0
 public static bool SaveSpecs(Specs spec)
 {
     return false;
 }
예제 #23
0
 private void FormSpecsEdit_Load(object sender, EventArgs e)
 {
     CurrentSpecs = DbFactory.FindBySequence(1, true);
     InitCombobox();
     InitView();
 }
예제 #24
0
 public static bool SaveSpecs(Specs spec)
 {
     return(false);
 }
예제 #25
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (CurrentSpecs == null)
         return;
     Int32 sequ = CurrentSpecs.Sequence - 1;
     if (sequ <=0)
     {
         sequ = 1;
     }
     Specs spec = DbFactory.FindBySequence(sequ);
     if (spec != null)
     {
         CurrentSpecs = spec;
         InitView();
     }
 }
예제 #26
0
 private void FormSpecsEdit_Load(object sender, EventArgs e)
 {
     CurrentSpecs = DbFactory.FindBySequence(1,true);
     InitCombobox();
     InitView();
 }
예제 #27
0
        public void SetCheckToSpecs(Specs spec)
        {
            JobDetail detail = FindBySpecsID(spec.ID);
            if (detail != null)
            {
                foreach (string kv in detail.CheckDetailList.Split(','))
                {

                    String[] checkresults = kv.Split('=');
                    if (checkresults.Length == 2)
                    {
                        int spid = Int32.Parse(checkresults[0]);
                        bool ispass = checkresults[1] == "1" ? true : false;
                        SpecsDetail spdetail = spec.FindByID(spid);
                        if (spdetail != null)
                        {
                            spdetail.isChecked = ispass;
                            spdetail.isDone = true;
                        }
                    }
                }
                spec.IsCheckAll = true;
            }
        }