コード例 #1
0
        //获取生产信息
        private void GetProductNumInfo()
        {
            string tt_sql = "select  count(1),0,0 " +
                            "from odc_insertcode  where taskcode = '" + this.textBox1.Text + "' ";

            string[] tt_array = new string[3];
            tt_array          = Dataset1.GetDatasetArray(tt_sql, tt_conn);
            this.label59.Text = tt_array[0];
        }
コード例 #2
0
        //获取生产信息
        private void GetProductNumInfo()
        {
            string tt_sql = "select  count(1),count(case when hprinttime is not null then 1 end),0 " +
                            "from odc_alllable  where taskscode = '" + this.textBox1.Text + "' ";

            string[] tt_array = new string[3];
            tt_array          = Dataset1.GetDatasetArray(tt_sql, tt_conn);
            this.label58.Text = tt_array[0];
            this.label59.Text = tt_array[1];
        }
コード例 #3
0
        //获取生产信息
        private void GetProductInfor()
        {
            string tt_sql = "select COUNT(1),sum(case when ageing = '1' then 1 else 0 end) N01,0  " +
                            "from ODC_ALLLABLE  where TASKSCODE = '" + this.textBox1.Text + "' ";

            string[] tt_array1 = new string[3];
            tt_array1          = Dataset1.GetDatasetArray(tt_sql, tt_conn);
            this.label17.Text  = tt_array1[0];
            this.label19.Text  = tt_array1[1];
            tt_shouldoldnumber = Convert.ToInt32(tt_array1[2]);
        }
コード例 #4
0
        private string getSaveorUploadRemark(string tt_user)
        {
            string tt_remark = "";
            string tt_sql    = "select count(1),min(Fcode),0 from odc_fhpassword " +
                               "where fname = '" + tt_user + "' ";

            string[] tt_array3 = new string[3];
            tt_array3 = Dataset1.GetDatasetArray(tt_sql, tt_conn);
            tt_remark = tt_array3[1];
            return(tt_remark);
        }
コード例 #5
0
        //生产数据记录
        private void GetProductInfo()
        {
            string tt_sql = "select top 10 count(1),count(case when boxlable is not null then 1 end),count(case when bosasn is not null then 1 end) " +
                            "from odc_alllable where taskscode ='" + this.textBox1.Text + "' ";

            string[] tt_array = new string[3];
            tt_array          = Dataset1.GetDatasetArray(tt_sql, tt_conn);
            this.label10.Text = tt_array[0];
            this.label12.Text = tt_array[1];
            this.label13.Text = tt_array[2];
        }
コード例 #6
0
        //获取未比对信息
        private string getCheckNumber(string tt_task, string tt_package)
        {
            string tt_checknum = "0";

            string tt_sql = "select  count(1),0,0 from odc_package " +
                            "where taskcode = '" + tt_task + "' and pagesn = '" + tt_package + "' and pageperson = '中箱已比对' ";

            string[] tt_array = new string[3];
            tt_array    = Dataset1.GetDatasetArray(tt_sql, tt_conn);
            tt_checknum = tt_array[0];
            return(tt_checknum);
        }
コード例 #7
0
        //获取MAC打印信息信息
        private void GetMACPrintNumInfo()
        {
            string tt_sql = "select  count(1),count(case when state is  NULL then 1  end) Fcount1, " +
                            "count(case when state is not NULL then 1  end) Fcount2 " +
                            "from odc_macinfo  where taskscode = '" + this.textBox1.Text + "'";

            string[] tt_array = new string[3];
            tt_array          = Dataset1.GetDatasetArray(tt_sql, tt_conn);
            this.label46.Text = tt_array[0];
            this.label47.Text = tt_array[1];
            this.label4.Text  = tt_array[2];
        }
コード例 #8
0
        //-------以下专门流程检验相关的,以及数据集操作----------

        #region 1、获取信息辅助方法

        //从流程表process获取全部流程字符串
        public static string getGyidAllProcess(string tt_gyid, string tt_conn)
        {
            string tt_gyidprocess = "单板工单流程没有找到";
            string tt_sql         = "select count(1),min(process),0 from odc_process where id = " + tt_gyid;

            string[] tt_array = new string[3];
            tt_array = Dataset1.GetDatasetArray(tt_sql, tt_conn);
            if (tt_array[0] == "1")
            {
                tt_gyidprocess = tt_array[1];
            }
            return(tt_gyidprocess);
        }
コード例 #9
0
        //获取站位顺序号
        private string GetNcodeSerialNo(string tt_gyid, string tt_code)
        {
            string tt_routnum = "0";

            string tt_sql = "select count(1),min(lcbz),0 from odc_routing " +
                            "where pid = " + tt_gyid + "  and pxid = " + tt_code;

            string[] tt_array = new string[3];
            tt_array = Dataset1.GetDatasetArray(tt_sql, tt_conn);

            if (tt_array[0] == "1")
            {
                tt_routnum = tt_array[1];
            }
            return(tt_routnum);
        }
コード例 #10
0
        //获取前一站位
        private void GetBeforStation()
        {
            //数据初始化
            #region
            PutLableInfor("");
            comboBox2.DataSource          = null;
            this.dataGridView1.DataSource = null;
            this.richTextBox1.Text        = null;
            this.richTextBox1.BackColor   = Color.White;
            string tt_scan1  = this.textBox1.Text.Trim();
            string tt_scan2  = tt_scan1.Replace("-", "");
            string tt_sacn3  = tt_scan2.Replace(":", "");
            string tt_scansn = tt_sacn3.Replace(" ", "");
            //扫描数据
            SetRichtexBox("----开始过站操作----");
            SetRichtexBox("扫描数据为:" + tt_scansn);
            #endregion


            //第一步位数判断
            #region
            Boolean tt_flag1 = false;
            tt_flag1 = CheckStrLengh(tt_scan1, this.comboBox1.Text);
            #endregion


            //第二步获取MAC号
            #region
            string  tt_mac      = "";
            string  tt_taskcode = "";
            Boolean tt_flag2    = false;
            if (tt_flag1)
            {
                //选择的是MAC
                if (this.radioButton1.Checked == true)
                {
                    tt_flag2 = true;
                    tt_mac   = tt_scansn;
                    SetRichtexBox("2、扫描MAC号为:" + tt_mac + ",goon");
                }

                //选择的是单板号
                if (this.radioButton2.Checked == true)
                {
                    string tt_sql = "select count(1),min(maclable),min(taskscode)  from odc_alllable where pcbasn = '" + tt_scansn + "' ";

                    string[] tt_array = new string[3];
                    tt_array = Dataset1.GetDatasetArray(tt_sql, tt_conn);
                    if (tt_array[0] == "1")
                    {
                        tt_flag2    = true;
                        tt_mac      = tt_array[1];
                        tt_taskcode = tt_array[2];
                        SetRichtexBox("2、扫描MAC号为:" + tt_mac + ",工单号为:" + tt_taskcode + ",goon");
                    }
                    else
                    {
                        SetRichtexBox("2、该单板在alllable表中没有找到,over");
                        PutLableInfor("该单板在alllable表中没有找到,请确认");
                    }
                }
            }
            #endregion


            //第三步获取单板号
            #region
            string  tt_pcba  = "";
            Boolean tt_flag3 = false;
            if (tt_flag2)
            {
                //选择的单板号
                if (this.radioButton2.Checked == true)
                {
                    tt_flag3 = true;
                    tt_pcba  = tt_scansn;
                    SetRichtexBox("3、扫描单板号为:" + tt_pcba + ",goon");
                }


                //选择的是MAC
                if (this.radioButton1.Checked == true)
                {
                    string tt_sql3 = "select count(1),min(pcbasn),min(taskscode)  from odc_alllable where maclable = '" + tt_scansn + "' ";

                    string[] tt_array3 = new string[3];
                    tt_array3 = Dataset1.GetDatasetArray(tt_sql3, tt_conn);
                    if (tt_array3[0] == "1")
                    {
                        tt_flag3    = true;
                        tt_pcba     = tt_array3[1];
                        tt_taskcode = tt_array3[2];
                        SetRichtexBox("3、扫描单板号为:" + tt_pcba + ",工单号为:" + tt_taskcode + ",goon");
                    }
                    else
                    {
                        SetRichtexBox("3、该MAC在alllable表中没有找到,over");
                        PutLableInfor("该MAC在alllable表中没有找到,请确认");
                    }
                }
            }
            #endregion


            //第四步查看是否已装箱
            #region
            Boolean tt_flag4 = false;
            if (tt_flag3)
            {
                string tt_sql4 = "select count(1),0,0 from odc_package where pasn = '" + tt_pcba + "' ";

                string[] tt_array4 = new string[3];
                tt_array4 = Dataset1.GetDatasetArray(tt_sql4, tt_conn);
                if (tt_array4[0] == "0")
                {
                    tt_flag4 = true;
                    SetRichtexBox("4、该产品还没有装箱" + ",goon");
                }
                else
                {
                    SetRichtexBox("4、该产品还已装箱,over");
                    PutLableInfor("该产品还已装箱,请确认");
                }
            }
            #endregion


            //第五步 是否正在维修状态
            #region
            Boolean tt_flag5 = false;
            if (tt_flag4)
            {
                string   tt_sql5   = "select count(1),0,0 from repair where MAC='" + tt_mac + "' and type = 1 ";
                string[] tt_array5 = new string[3];
                tt_array5 = Dataset1.GetDatasetArray(tt_sql5, tt_conn);
                if (tt_array5[0] == "0")
                {
                    tt_flag5 = true;
                    SetRichtexBox("5、该产品不在维修状态" + ",goon");
                }
                else
                {
                    SetRichtexBox("5、该产品处于维修状态,over");
                    PutLableInfor("该产品处于维修状态,请确认");
                }
            }
            #endregion


            //第六步 查看工单流程
            #region
            string  tt_gyid       = "";
            string  tt_parenttask = "";
            Boolean tt_flag6      = false;
            if (tt_flag5)
            {
                string   tt_sql6   = "select count(1),min(gyid),min(parenttask) from odc_tasks where taskscode = '" + tt_taskcode + "' ";
                string[] tt_array6 = new string[3];
                tt_array6 = Dataset1.GetDatasetArray(tt_sql6, tt_conn);
                if (tt_array6[0] == "1")
                {
                    tt_flag6      = true;
                    tt_gyid       = tt_array6[1];
                    tt_parenttask = tt_array6[2].Trim();
                    SetRichtexBox("6、该产品流程配置为" + tt_gyid + ",goon");
                }
                else
                {
                    SetRichtexBox("6、没有找到该工单的流程配置," + tt_taskcode + "over");
                    PutLableInfor("没有找到该工单的流程配置,请确认!" + tt_taskcode);
                }
            }
            #endregion


            //第七步查找流程
            #region
            string  tt_proname = "";
            string  tt_process = "";
            Boolean tt_flag7   = false;
            if (tt_flag6)
            {
                string   tt_sql7   = "select count(1),min(name),min(process) from odc_process where id= " + tt_gyid;
                string[] tt_array7 = new string[3];
                tt_array7 = Dataset1.GetDatasetArray(tt_sql7, tt_conn);
                if (tt_array7[0] == "1")
                {
                    tt_flag7   = true;
                    tt_proname = tt_array7[1];
                    tt_process = tt_array7[2];
                    SetRichtexBox("7、该产品流程名称为" + tt_proname + ",流程顺序:" + tt_process + ",goon");
                }
                else
                {
                    SetRichtexBox("7、没有找到该工单的流程表顺序,");
                    PutLableInfor("没有找到该工单的流程表顺序,请确认!" + tt_taskcode);
                }
            }
            #endregion


            //第八步:查找当前站位
            #region
            string  tt_ncode = "";
            string  tt_riwid = "";
            Boolean tt_flag8 = false;
            if (tt_flag7)
            {
                string tt_sql8 = "select count(1),min(id),min(ncode) from odc_routingtasklist " +
                                 "where  pcba_pn = '" + tt_mac + "' and napplytype is null ";
                string[] tt_array8 = new string[3];
                tt_array8 = Dataset1.GetDatasetArray(tt_sql8, tt_conn);
                if (tt_array8[0] == "1")
                {
                    tt_riwid = tt_array8[1];
                    tt_ncode = tt_array8[2];

                    int tt_productname_check = 0;
                    if (Getproductname(tt_mac) == "HG6201M" ||
                        ("HG6201T,HG2201T".Contains(Getproductname(tt_mac)) &&
                         Getproductarea(tt_mac).Trim() != "安徽" &&
                         tt_parenttask != "小型化电信"))  //如果产品不属于需要测试吞吐量的产品 //这是用于早期流程切换兼容用的,如果没有流程切换就不用修改
                    {
                        tt_productname_check = 1;
                    }

                    if (tt_ncode == "2111" && tt_productname_check == 1)
                    {
                        tt_ncode = "2115";
                    }

                    tt_flag8 = true;
                    SetRichtexBox("8、该单板有待测站位,前站位:" + tt_array8[1] + ",当前站位" + tt_array8[2] + ", goon");
                }
                else
                {
                    SetRichtexBox("8、没有找到待测站位,或有多条待测站位,流程异常,over");
                    PutLableInfor("没有找到待测站位,或有多条待测站位,流程异常!");
                }
            }
            #endregion


            //第九步 查找流程顺序
            #region
            string  tt_prono = "0";
            Boolean tt_flag9 = false;
            if (tt_flag8)
            {
                string tt_sql9 = "select count(1),min(lcbz),0 from odc_routing " +
                                 "where pid = " + tt_gyid + "  and pxid = " + tt_ncode;

                string[] tt_array9 = new string[3];
                tt_array9 = Dataset1.GetDatasetArray(tt_sql9, tt_conn);

                if (tt_array9[0] == "1")
                {
                    tt_flag9 = true;
                    tt_prono = tt_array9[1];
                    SetRichtexBox("9、找到一个流程顺序号," + tt_prono + ",goon");
                }
                else
                {
                    if (tt_ncode == "3350")
                    {
                        tt_flag9 = true;
                        SetRichtexBox("9、当前站位为3350,需要往前追溯往,goon");
                    }
                    else
                    {
                        SetRichtexBox("9、该站位:" + tt_ncode + ",没有找到流程顺序号,over");
                        PutLableInfor("没有找到流程顺序号,流程异常请确认!");
                    }
                }
            }
            #endregion


            //第十步查找 3350 以前的站位
            #region
            string  tt_mataionstation = "";
            Boolean tt_flag10         = false;
            if (tt_flag9)
            {
                if (tt_ncode == "3350")
                {
                    int tt_productname_check = 0;
                    if (Getproductname(tt_mac) == "HG6201M" ||
                        ("HG6201T,HG2201T".Contains(Getproductname(tt_mac)) &&
                         Getproductarea(tt_mac).Trim() != "安徽" &&
                         tt_parenttask != "小型化电信"))  //如果产品不属于需要测试吞吐量的产品  //这是用于早期流程切换兼容用的,如果没有流程切换就不用修改
                    {
                        tt_productname_check = 1;
                    }

                    tt_mataionstation = GetFixBeforStation(tt_mac, tt_process, tt_productname_check);

                    if (tt_mataionstation != "0")
                    {
                        tt_flag10 = true;
                        SetRichtexBox("10、找到1个3350以前站位:" + tt_mataionstation + ",goon");
                    }
                    else
                    {
                        SetRichtexBox("10、没有找到1个3350以前站位:" + tt_mataionstation + ",over");
                        PutLableInfor("没有找到3350以前站位,流程异常请确认!");
                    }
                }
                else
                {
                    tt_flag10 = true;
                    SetRichtexBox("10、该站位:" + tt_ncode + ",不是3350,不用去找3350以前站位,goon");
                }
            }
            #endregion


            //第十一步查询跳转站位最大值
            #region
            string  tt_routmaxnum = "";
            Boolean tt_flag11     = false;
            if (tt_flag10)
            {
                if (tt_ncode == "3350")
                {
                    if (tt_mataionstation == "2111" &&
                        (Getproductname(tt_mac) == "HG6201M" ||
                         ("HG6201T,HG2201T".Contains(Getproductname(tt_mac)) &&
                          Getproductarea(tt_mac).Trim() != "安徽" &&
                          tt_parenttask != "小型化电信")))  //如果产品不属于需要测试吞吐量的产品 //这是用于早期流程切换兼容用的,如果没有流程切换就不用修改
                    {
                        tt_mataionstation = "2115";
                    }

                    tt_routmaxnum = GetNcodeSerialNo(tt_gyid, tt_mataionstation);
                    if (tt_routmaxnum != "0")
                    {
                        tt_flag11 = true;
                        SetRichtexBox("11、找到1个3350以前站位:" + tt_mataionstation + "顺序号:" + tt_routmaxnum + ",goon");
                    }
                    else
                    {
                        SetRichtexBox("11、没有找到1个3350以前站位:" + tt_mataionstation + "顺序号:" + tt_routmaxnum + ",over");
                        PutLableInfor("没有找到3350以前站位的顺序号,流程异常请确认!");
                    }
                }
                else
                {
                    int tt_rutnum = GetStringToInt(tt_prono) - 1;
                    tt_routmaxnum = tt_rutnum.ToString();
                    tt_flag11     = true;
                    SetRichtexBox("11、找到正常站位顺序:" + tt_prono + "的前最大顺序号:" + tt_routmaxnum + ",goon");
                }
            }
            #endregion


            //第十二步 开始加载下拉列表
            #region
            Boolean tt_flag12 = false;
            if (tt_flag11)
            {
                //string tt_sql = "select pxid from odc_routing " +
                //                 "where pid = '"+tt_gyid+"' and lcbz >= 2 and lcbz <= " +tt_routmaxnum +
                //                "  order by lcbz desc ";

                //DataSet ds12 = Dataset1.GetDataSet(tt_sql, tt_conn);
                //if (ds12.Tables.Count > 0 && ds12.Tables[0].Rows.Count > 0)
                //{
                //    comboBox2.DataSource = ds12.Tables[0];
                //    comboBox2.DisplayMember = "pxid";
                //    comboBox2.ValueMember = "pxid";
                //    tt_flag12 = true;
                //    setRichtexBox("12、下拉列表加载完毕,goon");
                //}

                string tt_ncode_temp = "";

                if (tt_mataionstation != "")
                {
                    tt_ncode_temp = GetNcode(tt_mataionstation);
                }
                else
                {
                    tt_ncode_temp = GetNcode(tt_ncode);
                }

                if (tt_ncode_temp != "0")
                {
                    string[] NCODE_Temp = tt_ncode_temp.Split(',');
                    comboBox2.DataSource    = NCODE_Temp;
                    comboBox2.DisplayMember = "";
                    comboBox2.ValueMember   = "";
                    tt_flag12 = true;
                    SetRichtexBox("12、下拉列表加载完毕,goon");
                }
                else
                {
                    SetRichtexBox("12、下拉列表加载异常,或没有前站位over");
                    PutLableInfor("下拉列表加载异常!获没有前站位了");
                }
            }
            #endregion


            //最后显示
            #region
            if (tt_flag12)
            {
                this.label8.Text     = tt_riwid;
                this.label6.Text     = tt_ncode;
                this.button1.Visible = true;
                PutLableInfor("下拉列表加载完毕,可以选择站位跳转!");
                this.richTextBox1.BackColor = Color.Chartreuse;
                GetMacStation(tt_mac);
            }
            else
            {
                this.richTextBox1.BackColor = Color.Red;
                if (tt_flag3)
                {
                    GetMacStation(tt_mac);
                }
            }
            #endregion
        }
コード例 #11
0
        //子工单锁定事件
        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (this.checkBox1.Checked)
            {
                string tt_sql1 = "select  tasksquantity,product_name,areacode,fec,convert(varchar, taskdate, 102) fdate,customer,flhratio,Gyid,Tasktype " +
                                 "from odc_tasks where taskscode = '" + this.textBox1.Text + "' ";
                DataSet ds1 = Dataset1.GetDataSetTwo(tt_sql1, tt_conn);

                if (ds1.Tables.Count > 0 && ds1.Tables[0].Rows.Count > 0)
                {
                    this.label12.Text = ds1.Tables[0].Rows[0].ItemArray[0].ToString(); //工单数量
                    this.label13.Text = ds1.Tables[0].Rows[0].ItemArray[1].ToString(); //产品名称
                    this.label14.Text = ds1.Tables[0].Rows[0].ItemArray[2].ToString(); //地区
                    this.label17.Text = ds1.Tables[0].Rows[0].ItemArray[3].ToString(); //EC编码
                    this.label16.Text = ds1.Tables[0].Rows[0].ItemArray[4].ToString(); //生产日期

                    this.label54.Text = ds1.Tables[0].Rows[0].ItemArray[7].ToString(); //流程配置
                    this.label15.Text = ds1.Tables[0].Rows[0].ItemArray[8].ToString(); //物料编码



                    //第一步、流程检查
                    Boolean tt_flag1 = false;
                    if (!this.label54.Text.Equals(""))
                    {
                        bool tt_flag = GetNextCode(this.textBox1.Text, str);
                        if (tt_flag)
                        {
                            tt_flag1 = true;
                        }
                    }
                    else
                    {
                        MessageBox.Show("该工单没有配置流程,请检查");
                    }

                    //第二步、查找模板路径
                    Boolean tt_flag2 = false;
                    if (tt_flag1)
                    {
                        string tt_eccode = this.label17.Text;
                        string tt_sql2   = "select  docdesc,Fpath04,Fdata04,Macxp  from odc_ec where zjbm = '" + tt_eccode + "' ";

                        DataSet ds2 = Dataset1.GetDataSet(tt_sql2, tt_conn);
                        if (ds2.Tables.Count > 0 && ds2.Tables[0].Rows.Count > 0)
                        {
                            this.label20.Text = ds2.Tables[0].Rows[0].ItemArray[0].ToString();                           //EC描述
                            this.label18.Text = ds2.Tables[0].Rows[0].ItemArray[2].ToString();                           //数据类型
                            tt_path           = Application.StartupPath + ds2.Tables[0].Rows[0].ItemArray[1].ToString(); //模板路径
                            this.label19.Text = tt_path;
                            tt_flag2          = true;
                        }
                        else
                        {
                            MessageBox.Show("没有找到工单表的EC表配置信息,请确认!");
                        }
                    }


                    //第三步、总工单与子工单包容性检查
                    Boolean tt_flag3      = false;
                    string  tt_sontask    = this.textBox1.Text;
                    string  tt_fathertask = this.textBox9.Text;
                    if (tt_flag1 && tt_flag2)
                    {
                        if (tt_sontask.Contains(tt_fathertask))
                        {
                            tt_flag3 = true;
                        }
                        else
                        {
                            MessageBox.Show("总工单:" + tt_fathertask + ",与子工单:" + tt_sontask + ",不一致,请检查!");
                        }
                    }



                    //第四步、查找总工单是否存在
                    Boolean tt_flag4 = false;
                    if (tt_flag1 && tt_flag2 && tt_flag3)
                    {
                        string tt_sql4 = "select count(1),0,0 from odc_tasks " +
                                         "where taskscode = '" + tt_fathertask + "' ";

                        string[] tt_array4 = new string[3];
                        tt_array4 = Dataset1.GetDatasetArray(tt_sql4, tt_conn);
                        if (tt_array4[0] == "1")
                        {
                            tt_flag4 = true;
                        }
                        else
                        {
                            MessageBox.Show("工单表中没有找到该总工单:" + tt_fathertask + ",请确认!");
                        }
                    }



                    //第五步、查找流水号配置信息
                    Boolean tt_flag5 = false;
                    if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4)
                    {
                        string tt_sql5 = "select count(1),min(hostqzwh),0 from ODC_HOSTLABLEOPTIOAN " +
                                         "where taskscode = '" + this.textBox1.Text + "' ";
                        string[] tt_array5 = new string[3];
                        tt_array5 = Dataset1.GetDatasetArray(tt_sql5, tt_conn);
                        if (tt_array5[0] == "1")
                        {
                            tt_flag5          = true;
                            this.label65.Text = tt_array5[1];
                        }
                        else
                        {
                            MessageBox.Show("没有找到工单的串号表配置信息,请确认!");
                        }
                    }



                    //第六步 最后判断
                    if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4 && tt_flag5)
                    {
                        this.textBox1.Enabled = false;
                        this.textBox9.Enabled = false;

                        this.textBox2.Visible = true;
                        this.textBox7.Visible = true;
                        GetProductNumInfo();  //生产信息
                    }
                }
                else
                {
                    MessageBox.Show("没有查询此工单,请确认!");
                }
            }
            else
            {
                this.textBox1.Enabled = true;
                this.textBox9.Enabled = true;

                this.textBox2.Visible = false;
                this.textBox7.Visible = false;
                ClearLabelInfo();
                ScanDataInitial();
            }
        }
コード例 #12
0
        //MAC扫描过站
        private void tabControl2_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                //---开始MAC扫描
                ScanDataInitial();
                setRichtexBox("-----开始MAC过站扫描--------");
                string tt_smalltask = this.textBox1.Text.Trim();
                string tt_bigtask   = this.textBox9.Text.Trim();
                string tt_scanmac   = this.textBox2.Text.Trim();
                string tt_shortmac  = tt_scanmac.Replace(":", "");


                //第一步位数判断
                Boolean tt_flag1 = false;
                tt_flag1 = CheckStrLengh(tt_scanmac, this.textBox3.Text);


                //第二步包含符判断
                Boolean tt_flag2 = false;
                if (tt_flag1)
                {
                    tt_flag2 = CheckStrContain(tt_scanmac, this.textBox4.Text.Trim());
                }



                //第三步 检查模板
                Boolean tt_flag3 = false;
                if (tt_flag1 && tt_flag2)
                {
                    tt_flag3 = getPathIstrue(tt_path);
                    if (tt_flag3)
                    {
                        setRichtexBox("3、已找到一个铭牌模板,:" + tt_path + ",goon");
                    }
                    else
                    {
                        setRichtexBox("3、没有找到铭牌模板,:" + tt_path + ",over");
                        PutLableInfor("没有找到铭牌模板,请检查!");
                    }
                }


                //第四步第一次数量检查(同时生产的话会出现问题)
                Boolean tt_flag4      = false;
                int     tt_tasknumber = int.Parse(this.label12.Text);
                if (tt_flag1 && tt_flag2 && tt_flag3)
                {
                    int tt_productnum = int.Parse(this.label59.Text);
                    if (tt_productnum < tt_tasknumber)
                    {
                        tt_flag4 = true;
                        setRichtexBox("4、第一次数量检查,已获取序列号生产数量:" + tt_productnum.ToString() + ",小于计划数量:" + tt_tasknumber.ToString() + ",还可以再生产gong");
                    }
                    else
                    {
                        setRichtexBox("4、第一次数量检查,已获取序列号生产数量:" + tt_productnum.ToString() + ",大于等于计划数量:" + tt_tasknumber.ToString() + ",不能再生产gong");
                        PutLableInfor("生产数量已满不能再生产了!");
                    }
                }



                //第五步第二次数量检查
                Boolean tt_flag5 = false;
                if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4)
                {
                    string tt_sql5 = "select count(1),0,0 from odc_alllable " +
                                     "where taskscode = '" + tt_smalltask + "' ";

                    string[] tt_array5 = new string[3];
                    tt_array5 = Dataset1.GetDatasetArray(tt_sql5, tt_conn);

                    int tt_productnum1 = int.Parse(tt_array5[0]);
                    if (tt_productnum1 < tt_tasknumber)
                    {
                        tt_flag5 = true;
                        setRichtexBox("5、第二次数量检查,已获取序列号生产数量:" + tt_productnum1.ToString() + ",小于计划数量:" + tt_tasknumber.ToString() + ",还可以再生产gong");
                    }
                    else
                    {
                        setRichtexBox("5、第二次数量检查,已获取序列号生产数量:" + tt_productnum1.ToString() + ",大于等于计划数量:" + tt_tasknumber.ToString() + ",不能再生产gong");
                        PutLableInfor("生产数量已满不能再生产了!");
                    }
                }



                //第六步流程检查
                Boolean tt_flag6 = false;
                string  tt_gyid  = this.label54.Text;
                string  tt_ccode = this.label56.Text;
                string  tt_ncode = this.label57.Text;
                if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4 && tt_flag5)
                {
                    if (tt_ccode == "" || tt_ncode == "")
                    {
                        setRichtexBox("6、该工单没有配置流程," + tt_ccode + "," + tt_ncode + ",over");
                        PutLableInfor("没有获取到当前待测站位,及下一站位,请检查");
                    }
                    else
                    {
                        tt_flag6 = true;
                        setRichtexBox("6、该工单已配置流程," + tt_ccode + "," + tt_ncode + ",goon");
                    }
                }


                //第七步查找关联表数据
                Boolean tt_flag7       = false;
                string  tt_hostlable   = "";
                string  tt_smtaskscode = "";
                string  tt_longmac     = "";
                string  tt_oldtype     = "";
                string  tt_id          = "";
                string  tt_gpsn        = "";
                string  tt_pcba        = "";
                if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4 && tt_flag5 && tt_flag6)
                {
                    string tt_sql7 = "select hostlable,maclable,smtaskscode,bprintuser,id,ageing,shelllable,pcbasn from odc_alllable " +
                                     "where hprintman = '" + tt_bigtask + "' and taskscode = '" + tt_smalltask + "'    and maclable = '" + tt_shortmac + "' ";

                    DataSet ds7 = Dataset1.GetDataSet(tt_sql7, tt_conn);
                    if (ds7.Tables.Count > 0 && ds7.Tables[0].Rows.Count > 0)
                    {
                        tt_flag7       = true;
                        tt_hostlable   = ds7.Tables[0].Rows[0].ItemArray[0].ToString(); //主机条码
                        tt_shortmac    = ds7.Tables[0].Rows[0].ItemArray[1].ToString(); //短MAC
                        tt_smtaskscode = ds7.Tables[0].Rows[0].ItemArray[2].ToString(); //移动串号
                        tt_longmac     = ds7.Tables[0].Rows[0].ItemArray[3].ToString(); //长MAC
                        tt_id          = ds7.Tables[0].Rows[0].ItemArray[4].ToString(); //行ID
                        tt_oldtype     = ds7.Tables[0].Rows[0].ItemArray[5].ToString(); //老化状态
                        tt_gpsn        = ds7.Tables[0].Rows[0].ItemArray[6].ToString(); //GPSN
                        tt_pcba        = ds7.Tables[0].Rows[0].ItemArray[7].ToString(); //单板号
                        setRichtexBox("7、关联表查询到一条数据,hostlable=" + tt_hostlable + ",mac=" + tt_shortmac + ",smtaskscode=" + tt_smtaskscode + ",id=" + tt_id + ",老化ageing=" + tt_oldtype + ",goon");
                    }
                    else
                    {
                        setRichtexBox("7、关联表没有查询到数据,over");
                        PutLableInfor("关联表没有查询到数据,请检查!");
                    }
                }



                //第八步 查找站位信息
                Boolean tt_flag8 = false;
                if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4 && tt_flag5 && tt_flag6 && tt_flag7)
                {
                    string tt_sql8 = "select count(1),min(ccode),min(ncode) from odc_routingtasklist " +
                                     "where  pcba_pn = '" + tt_shortmac + "' and napplytype is null ";


                    string[] tt_array8 = new string[3];
                    tt_array8 = Dataset1.GetDatasetArray(tt_sql8, tt_conn);
                    if (tt_array8[0] == "1")
                    {
                        if (tt_array8[2] == tt_ccode)
                        {
                            tt_flag8 = true;
                            setRichtexBox("8、该单板有待测站位,站位:" + tt_array8[1] + "," + tt_array8[2] + ",可以过站 goon");
                        }
                        else
                        {
                            setRichtexBox("8、该单板待测站位不在" + tt_ccode + ",站位:" + tt_array8[1] + "," + tt_array8[2] + ",不可以过站 goon");
                            PutLableInfor("该单板当前站位:" + tt_array8[2] + "不在" + tt_ccode + "站位!");
                        }
                    }
                    else
                    {
                        setRichtexBox("8、没有找到待测站位,或有多条待测站位,流程异常,over");
                        PutLableInfor("没有找到待测站位,或有多条待测站位,流程异常!");
                    }
                }



                //第九步查询MACINFO信息
                Boolean tt_flag9 = false;
                if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4 && tt_flag5 && tt_flag6 && tt_flag7 && tt_flag8)
                {
                    tt_flag9 = true;
                    setRichtexBox("9、查找Macinfo表信息过 goon");
                }



                //第十步物料追溯添加
                Boolean tt_flag10 = false;
                if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4 && tt_flag5 && tt_flag6 && tt_flag7 && tt_flag8 && tt_flag9)
                {
                    tt_flag10 = true;
                    setRichtexBox("10、物料追溯记录过,gong");
                }



                //第十一步是否获取主机条码判断
                Boolean tt_flag11 = false;
                if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4 && tt_flag5 && tt_flag6 && tt_flag7 && tt_flag8 && tt_flag9 && tt_flag10)
                {
                    if (tt_hostlable == tt_shortmac)
                    {
                        tt_flag11 = true;
                        setRichtexBox("10、该条码主机条码:" + tt_hostlable + ",数据与MAC:" + tt_shortmac + "一致,还没有获取主机条码,gong");
                    }
                    else
                    {
                        setRichtexBox("10、该条码主机条码:" + tt_hostlable + ",数据与MAC:" + tt_shortmac + "不一致,可能已获取主机条码,ober");
                        setRichtexBox("10、可能已获取主机条码:" + tt_hostlable + ",请确认");
                    }
                }



                //第十二步开始过站

                Boolean tt_flag12 = false;
                if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4 && tt_flag5 && tt_flag6 && tt_flag7 && tt_flag8 && tt_flag10 && tt_flag11)
                {
                    string tt_username = STR;
                    tt_flag12 = Dataset1.FhwifSnInStation(tt_smalltask, tt_bigtask, tt_username,
                                                          tt_hostlable, tt_shortmac,
                                                          tt_gyid, tt_ccode, tt_ncode,
                                                          tt_conn);
                    if (tt_flag12)
                    {
                        setRichtexBox("12、该产品过站成功,请继续扫描,ok");
                    }
                    else
                    {
                        setRichtexBox("12、过站不成功,事务已回滚");
                        PutLableInfor("过站不成功,请检查或再次扫描!");
                    }
                }



                //第十三站:查询身程序序列号
                Boolean tt_flag13   = false;
                string  tt_boxlable = "";
                if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4 && tt_flag5 && tt_flag6 && tt_flag7 && tt_flag8 && tt_flag10 && tt_flag11 && tt_flag12)
                {
                    string tt_sql13 = "select count(1), min(boxlable),0 from odc_alllable " +
                                      "where taskscode = '" + tt_smalltask + "' and hprintman = '" + tt_bigtask + "' and maclable = '" + tt_shortmac + "' ";



                    string[] tt_array13 = new string[3];
                    tt_array13 = Dataset1.GetDatasetArray(tt_sql13, tt_conn);
                    if (tt_array13[0] == "1")
                    {
                        tt_flag13         = true;
                        tt_boxlable       = tt_array13[1];
                        this.label67.Text = tt_boxlable;
                        setRichtexBox("13、生产序列号获取成功,已获取序列号:" + tt_boxlable + ", goon");
                    }
                    else
                    {
                        setRichtexBox("13、生产序列号获取不成功,序列号:" + tt_boxlable + ", over");
                        PutLableInfor("生产序列号获取不成功,请检查!");
                    }
                }



                //最后判断
                if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4 && tt_flag5 && tt_flag6 && tt_flag7 && tt_flag8 && tt_flag10 && tt_flag11 && tt_flag12 && tt_flag13)
                {
                    //条码信息
                    this.label42.Text = tt_pcba;        //单板号
                    this.label43.Text = tt_boxlable;    //主机条码
                    this.label44.Text = tt_smtaskscode; //移动串号
                    this.label45.Text = tt_shortmac;    //短MAC
                    this.label46.Text = tt_longmac;     //长MAC
                    this.label47.Text = tt_gpsn;        //GPSN



                    //生产节拍
                    getProductRhythm();

                    //打印
                    GetParaDataPrint(1);
                    GetProductNumInfo();
                    CheckStation(tt_shortmac);
                    this.richTextBox1.BackColor = Color.Chartreuse;
                    PutLableInfor("过站成功,请继续扫描!");
                    textBox2.Focus();
                    textBox2.SelectAll();
                }
                else
                {
                    this.richTextBox1.BackColor = Color.Red;
                    textBox2.Focus();
                    textBox2.SelectAll();
                }
            }
        }
コード例 #13
0
        //单板扫描
        private void textBox2_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                //开始单板扫描
                this.label13.Text = null;
                string tt_scanmac    = this.textBox2.Text.Trim();
                string tt_scanpcbasn = tt_scanmac.Replace(":", "");;
                string tt_task       = this.textBox1.Text.Trim();
                string tt_mac        = tt_scanpcbasn;
                this.richTextBox1.Text      = null;
                this.richTextBox1.BackColor = Color.White;
                setRichtexBox("------开始扫描单板号-------");

                //第一步位数判断
                Boolean tt_flag1 = false;
                tt_flag1 = CheckStrLengh(this.textBox2.Text.Trim(), this.textBox3.Text);


                //第二步包含符判断
                Boolean tt_flag2 = false;
                if (tt_flag1)
                {
                    tt_flag2 = CheckStrContain(this.textBox2.Text.Trim(), this.textBox4.Text.Trim());
                }


                //第三步 是否超计划老化判断
                Boolean tt_flag3 = false;
                if (tt_flag1 && tt_flag2)
                {
                    tt_alreadyoldnumber = Convert.ToInt32(this.label19.Text);
                    tt_shouldoldnumber  = Convert.ToInt32(this.label18.Text);

                    if (tt_alreadyoldnumber <= tt_shouldoldnumber)
                    {
                        tt_flag3 = true;
                        setRichtexBox("3、已老化数量还没有到应老化数量,goon");
                    }
                    else
                    {
                        setRichtexBox("3、已老化数量已超过应老化数量,不能再扫描了,over");
                        PutLableInfor("已老化数量已超过应老化数量!");
                    }
                }



                //第四步 判断是否已老化
                Boolean tt_flag4 = false;
                if (tt_flag1 && tt_flag2 && tt_flag3)
                {
                    string tt_sql4 = "select COUNT(1), sum(case when ageing = '1' then 1 else 0 end) N01,min(maclable) N02 " +
                                     "from ODC_ALLLABLE where TASKSCODE = '" + tt_task + "' and (PCBASN = '" + tt_scanpcbasn + "' or maclable = '" + tt_scanpcbasn + "') ";

                    string[] tt_array4 = new string[3];
                    tt_array4 = Dataset1.GetDatasetArray(tt_sql4, tt_conn);
                    if (tt_array4[0] == "1")
                    {
                        if (tt_array4[1] == "0")
                        {
                            tt_flag4 = true;
                            tt_mac   = tt_array4[2];
                            setRichtexBox("4、该单板还没进老化,可以老化,MAC:" + tt_mac + ",goon");
                        }
                        else
                        {
                            setRichtexBox("4、该单板已经进老化,不能再扫描了,over");
                            PutLableInfor("该单板已经进老化!不用再扫描");
                        }
                    }
                    else
                    {
                        setRichtexBox("4、该工单下没有发现该单板,确认是否工单选错了,或单板拿错了,over");
                        PutLableInfor("该工单下没有发现该单板,请检查!");
                    }
                }



                //第五步站位判断
                Boolean tt_flag5 = false;
                if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4)
                {
                    string tt_code = this.label22.Text;

                    string tt_sql5 = "select count(1),min(ccode),min(ncode) from odc_routingtasklist " +
                                     "where  pcba_pn = '" + tt_mac + "' and napplytype is null ";


                    string[] tt_array5 = new string[3];
                    tt_array5 = Dataset1.GetDatasetArray(tt_sql5, tt_conn);
                    if (tt_array5[0] == "1")
                    {
                        if (tt_array5[2] == tt_code)
                        {
                            tt_flag5 = true;
                            setRichtexBox("5、该单板有待测站位,站位:" + tt_array5[1] + "--->" + tt_array5[2] + ",可以老化扫描 goon");
                        }
                        else
                        {
                            setRichtexBox("5、该单板待测站位不在" + tt_code + ",站位:" + tt_array5[1] + "--->" + tt_array5[2] + ",不可以老化扫描 over");
                            PutLableInfor("该单板当前站位:" + tt_array5[2] + "不在" + tt_code + "站位!不能老化");
                        }
                    }
                    else
                    {
                        setRichtexBox("5、没有找到待测站位,或有多条待测站位,流程异常,over");
                        PutLableInfor("没有找到待测站位,或有多条待测站位,流程异常!");
                    }
                }



                //第六步 老化表做记录
                Boolean tt_flag6 = false;
                if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4 && tt_flag5)
                {
                    string tt_sql6 = "insert into ODC_BARCODELH(BARCODE,TASKSCODE,Fdate) " +
                                     "values('" + tt_mac + "','" + tt_task + "',getdate() ) ";

                    int tt_exec6 = Dataset1.ExecCommand(tt_sql6, tt_conn);

                    if (tt_exec6 > 0)
                    {
                        tt_flag6 = true;
                        setRichtexBox("6、数据已成功记录到老化表ODC_BARCODELH,goon");
                    }
                    else
                    {
                        setRichtexBox("6、数据没有记录到老化表ODC_BARCODELH,over");
                        PutLableInfor("数据没有记录到老化表,请再次扫描!");
                    }
                }



                //第七步 修改关联表状态
                Boolean tt_flag7 = false;
                if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4 && tt_flag5 && tt_flag6)
                {
                    string tt_sql7 = "update ODC_ALLLABLE set AGEING = '1' " +
                                     "where TASKSCODE = '" + tt_task + "' and (PCBASN = '" + tt_scanpcbasn + "' or maclable = '" + tt_mac + "') ";

                    int tt_exec7 = Dataset1.ExecCommand(tt_sql7, tt_conn);

                    if (tt_exec7 > 0)
                    {
                        tt_flag7 = true;
                        setRichtexBox("7、关联表数据已更新成功,goon");
                    }
                    else
                    {
                        setRichtexBox("7、关联表数据没有更新成功,over");
                        PutLableInfor("关联表数据没有更新成功,请再次扫描!");
                    }
                }



                //最后判断
                if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4 && tt_flag5 && tt_flag6 && tt_flag7)
                {
                    GetProductInfor();
                    PutLableInfor("老化记录成功,请继续扫描!");
                    this.richTextBox2.Text      = tt_scanpcbasn + "\n" + this.richTextBox2.Text;
                    this.richTextBox1.BackColor = Color.Chartreuse;
                }
                else
                {
                    this.richTextBox1.BackColor = Color.Red;
                }



                textBox2.Focus();
                textBox2.SelectAll();
            }
        }
コード例 #14
0
        //查询站位信息
        private void GetNowMacSattion()
        {
            //数据准备
            this.dataGridView1.DataSource = null;
            ClearLabelInfo2();
            string tt_scan1  = this.textBox1.Text.Trim();
            string tt_scan2  = tt_scan1.Replace("-", "");
            string tt_sacn3  = tt_scan2.Replace(":", "");
            string tt_scansn = tt_sacn3.Replace(" ", "");

            //第一步位数判断
            Boolean tt_flag1 = false;

            tt_flag1 = CheckStrLengh2(tt_scan1, this.comboBox1.Text);


            //第二步获取MAC,PCBA号
            string  tt_mac   = "";
            Boolean tt_flag2 = false;

            if (tt_flag1)
            {
                //选择的是MAC
                if (this.radioButton1.Checked == true)
                {
                    tt_flag2 = true;
                    tt_mac   = tt_scansn;
                }

                //选择的是单板号
                if (this.radioButton2.Checked == true)
                {
                    string tt_sql = "select count(1),min(maclable),0  from odc_alllable where pcbasn = '" + tt_scansn + "' ";

                    string[] tt_array = new string[3];
                    tt_array = Dataset1.GetDatasetArray(tt_sql, tt_conn);
                    if (tt_array[0] == "1")
                    {
                        tt_flag2 = true;
                        tt_mac   = tt_array[1];
                    }
                    else
                    {
                        PutLableInfor("该单板在alllable表中没有找到,请确认");
                    }
                }
            }

            //第三步开始查询
            if (tt_flag2)
            {
                GetMacStation(tt_mac);
                if (this.dataGridView1.DataSource == null)
                {
                }
                else
                {
                    PutLableInfor("查询完毕!若需要跳站,请先点击确定按钮!");
                }
            }
        }
コード例 #15
0
        //彩盒条码扫描
        private void textBox7_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                this.label13.Text = null;
                this.label14.Text = null;

                string tt_boxlable = this.textBox7.Text.ToUpper().Trim();
                string tt_pcbasn   = "";

                //第一步位数效验
                Boolean tt_flag1 = false;
                if (CheckStrLengh(tt_boxlable, this.textBox6.Text))
                {
                    tt_flag1 = true;
                }
                else
                {
                    this.label13.Text = "位数不对";
                }

                //第二步 包含效验
                Boolean tt_flag2 = false;
                if (tt_flag1)
                {
                    if (CheckStrContain(tt_boxlable, this.textBox5.Text))
                    {
                        tt_flag2 = true;
                    }
                    else
                    {
                        this.label13.Text = "包含符不对";
                    }
                }


                //第三步 数据判断
                Boolean tt_flag3 = false;
                if (tt_flag1 && tt_flag2)
                {
                    string tt_sql4 = "select count(1),min(T2.pcbasn),min(pageperson) " +
                                     "from odc_package T1 " +
                                     "left outer join odc_alllable T2 " +
                                     "on T1.pasn = T2.pcbasn " +

                                     "where T1.taskcode = '" + this.textBox1.Text + "' and   T1.PAGESN = '" + tt_package + "' " +
                                     "and T2.boxlable = '" + tt_boxlable + "' ";

                    string[] tt_array4 = new string[3];
                    tt_array4 = Dataset1.GetDatasetArray(tt_sql4, tt_conn);
                    if (tt_array4[0] == "1")
                    {
                        if (tt_array4[2] == "中箱已比对")
                        {
                            this.label13.Text = "亲,该条码已比对,不用再比对了";
                        }
                        else
                        {
                            tt_pcbasn = tt_array4[1];
                            tt_flag3  = true;
                        }
                    }
                    else
                    {
                        this.label13.Text = "该箱号,没有找到对应的彩盒号";
                    }
                }


                //第四步 记录数据
                Boolean tt_flag4 = false;
                if (tt_flag1 && tt_flag2 && tt_flag3)
                {
                    string tt_update = "update odc_package set pageperson = '中箱已比对' " +
                                       "where taskcode = '" + this.textBox1.Text + "' and pagesn = '" + this.textBox2.Text + "' and pasn = '" + tt_pcbasn + "' ";

                    int tt_int = Dataset1.ExecCommand(tt_update, tt_conn);
                    if (tt_int > 0)
                    {
                        tt_flag4 = true;
                    }
                    else
                    {
                        this.label13.Text = "数据没有更新成功请重试";
                    }
                }



                //最后判断
                if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4)
                {
                    this.label14.Text      = "PASS";
                    this.label14.ForeColor = Color.Yellow;
                    this.label14.BackColor = Color.Chartreuse;

                    this.label20.Text      = getCheckNumber(this.textBox1.Text, this.textBox2.Text);
                    this.richTextBox1.Text = this.textBox7.Text + "\n" + this.richTextBox1.Text;

                    //获取未扫描信息
                    getCheckNumber2(this.textBox1.Text, this.textBox2.Text);

                    if (this.label19.Text == this.label20.Text)
                    {
                        this.textBox2.Enabled = true;
                        this.textBox2.Focus();
                        this.textBox2.SelectAll();
                    }
                    else
                    {
                        this.textBox7.Focus();
                        this.textBox7.SelectAll();
                    }
                }
                else
                {
                    this.label14.Text      = "FAIL";
                    this.label14.ForeColor = Color.Black;
                    this.label14.BackColor = Color.Red;

                    this.textBox7.Focus();
                    this.textBox7.SelectAll();
                }
            }
        }
コード例 #16
0
        //中箱箱号扫描
        private void textBox2_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                ClearLabelInfo();

                tt_package = this.textBox2.Text.ToUpper().Trim();

                //第一步位数效验
                Boolean tt_flag1 = false;
                if (CheckStrLengh(tt_package, this.textBox3.Text))
                {
                    tt_flag1 = true;
                }
                else
                {
                    this.label12.Text = "位数不对";
                }

                //第二步 包含效验
                Boolean tt_flag2 = false;
                if (tt_flag1)
                {
                    if (CheckStrContain(tt_package, this.textBox4.Text))
                    {
                        tt_flag2 = true;
                    }
                    else
                    {
                        this.label12.Text = "包含符不对";
                    }
                }



                //第三步工单检验
                Boolean tt_flag3 = false;
                if (tt_flag1 && tt_flag2)
                {
                    string tt_sql3 = "select  count(1),min(taskcode),0  from odc_package " +
                                     "where  taskcode = '" + this.textBox1.Text + "' and  PAGESN = '" + tt_package + "' ";

                    string[] tt_array3 = new string[3];
                    tt_array3 = Dataset1.GetDatasetArray(tt_sql3, tt_conn);
                    if (tt_array3[0] == "0")
                    {
                        this.label12.Text = "该工单没有找到该箱号记录,请确认工单号是否正确或箱号是否正确";
                    }
                    else
                    {
                        if (tt_array3[1] == this.textBox1.Text)
                        {
                            tt_flag3          = true;
                            this.label18.Text = tt_package;
                            this.label19.Text = tt_array3[0];
                        }
                        else
                        {
                            this.label12.Text = "工单不对," + tt_array3[1];
                        }
                    }
                }


                //最后判断
                if (tt_flag1 && tt_flag2 && tt_flag3)
                {
                    //获取已扫描信息
                    this.label20.Text = getCheckNumber(this.textBox1.Text, this.textBox2.Text);

                    //获取未扫描信息
                    getCheckNumber2(this.textBox1.Text, this.textBox2.Text);

                    this.textBox2.Enabled = false;

                    this.textBox7.Focus();
                    this.textBox7.SelectAll();
                }
                else
                {
                    this.textBox2.Focus();
                    this.textBox2.SelectAll();
                }

                this.label14.Text = null;
            }
        }
コード例 #17
0
        //维修跳转2100
        private void textBox2_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                //数据初始化
                PutLableInfor2("");
                this.richTextBox2.Text      = null;
                this.richTextBox2.BackColor = Color.White;
                string tt_scan1  = this.textBox2.Text.Trim();
                string tt_scan2  = tt_scan1.Replace("-", "");
                string tt_sacn3  = tt_scan2.Replace(":", "");
                string tt_scansn = tt_sacn3.Replace(" ", "");

                SetRichtexBox2("----开始站位跳转------");
                //第一步位数判断
                Boolean tt_flag1 = false;
                tt_flag1 = CheckStrLengh3(tt_scan1, this.comboBox3.Text);

                //第二步获取MAC,PCBA号
                string  tt_mac   = "";
                Boolean tt_flag2 = false;
                if (tt_flag1)
                {
                    //选择的是MAC
                    if (this.radioButton4.Checked == true)
                    {
                        tt_flag2 = true;
                        tt_mac   = tt_scansn;
                        SetRichtexBox2("2、选择的MAC为:" + tt_mac);
                    }

                    //选择的是单板号
                    if (this.radioButton3.Checked == true)
                    {
                        string tt_sql = "select count(1),min(maclable),0  from odc_alllable where pcbasn = '" + tt_scansn + "' ";

                        string[] tt_array = new string[3];
                        tt_array = Dataset1.GetDatasetArray(tt_sql, tt_conn);
                        if (tt_array[0] == "1")
                        {
                            tt_flag2 = true;
                            tt_mac   = tt_array[1];
                            SetRichtexBox2("2、选择的MAC为:" + tt_mac);
                        }
                        else
                        {
                            SetRichtexBox2("2、该单板在alllable表中没有找到,");
                            PutLableInfor2("该单板在alllable表中没有找到,请确认");
                        }
                    }
                }

                //第三步获取单板号
                string  tt_pcba     = "";
                string  tt_taskcode = "";
                Boolean tt_flag3    = false;
                if (tt_flag2)
                {
                    //选择的单板号
                    if (this.radioButton3.Checked == true)
                    {
                        tt_flag3 = true;
                        tt_pcba  = tt_scansn;
                        SetRichtexBox2("3、扫描单板号为:" + tt_pcba + ",goon");
                    }


                    //选择的是MAC
                    if (this.radioButton4.Checked == true)
                    {
                        string tt_sql3 = "select count(1),min(pcbasn),min(taskscode)  from odc_alllable where maclable = '" + tt_scansn + "' ";

                        string[] tt_array3 = new string[3];
                        tt_array3 = Dataset1.GetDatasetArray(tt_sql3, tt_conn);
                        if (tt_array3[0] == "1")
                        {
                            tt_flag3    = true;
                            tt_pcba     = tt_array3[1];
                            tt_taskcode = tt_array3[2];
                            SetRichtexBox2("3、扫描单板号为:" + tt_pcba + ",工单号为:" + tt_taskcode + ",goon");
                        }
                        else
                        {
                            SetRichtexBox2("3、该MAC在alllable表中没有找到,over");
                            PutLableInfor2("该MAC在alllable表中没有找到,请确认");
                        }
                    }
                }

                //第四步 是否正在维修状态
                Boolean tt_flag4 = false;
                if (tt_flag3)
                {
                    string   tt_sql5   = "select count(1),0,0 from repair where MAC='" + tt_mac + "' and type = 2 ";
                    string[] tt_array5 = new string[3];
                    tt_array5 = Dataset1.GetDatasetArray(tt_sql5, tt_conn);
                    if (tt_array5[0] == "1")
                    {
                        tt_flag4 = true;
                        SetRichtexBox2("4、该产品处于维修状态,且已修好,over");
                    }
                    else
                    {
                        SetRichtexBox2("4、该产品不在维修状态,goon");
                        PutLableInfor2("该产品不在维修状态,或还没有修好,请确认");
                    }
                }

                //第五步:查找当前站位
                string  tt_ncode = "";
                string  tt_riwid = "";
                Boolean tt_flag5 = false;
                if (tt_flag4)
                {
                    string tt_sql8 = "select count(1),min(id),min(ncode) from odc_routingtasklist " +
                                     "where  pcba_pn = '" + tt_mac + "' and napplytype is null ";
                    string[] tt_array8 = new string[3];
                    tt_array8 = Dataset1.GetDatasetArray(tt_sql8, tt_conn);
                    if (tt_array8[0] == "1")
                    {
                        tt_riwid = tt_array8[1];
                        tt_ncode = tt_array8[2];
                        tt_flag5 = true;
                        SetRichtexBox2("5、该单板有待测站位,ID号:" + tt_array8[1] + ",当前站位" + tt_array8[2] + ", goon");
                    }
                    else
                    {
                        SetRichtexBox2("5、没有找到待测站位,或有多条待测站位,流程异常,over");
                        PutLableInfor2("没有找到待测站位,或有多条待测站位,流程异常!");
                    }
                }

                //第六步 开始跳站
                Boolean tt_flag6 = false;
                if (tt_flag5)
                {
                    string tt_sql = "update odc_routingtasklist set ncode = '2110' ,Fremark = 'PR001维修站位跳转' " +
                                    " where  pcba_pn = '" + tt_mac + "' and napplytype is null  and id = " + tt_riwid;

                    int tt_exec = Dataset1.ExecCommand(tt_sql, tt_conn);

                    if (tt_exec > 0)
                    {
                        tt_flag6 = true;
                        SetRichtexBox2("6、跳转成功, goon");
                    }
                    else
                    {
                        SetRichtexBox2("6、跳转不成功,over");
                        PutLableInfor2("跳转不成功,请确认!");
                    }
                }

                //最后显示
                if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4 && tt_flag5 && tt_flag6)
                {
                    this.richTextBox2.BackColor = Color.Chartreuse;
                    PutLableInfor2("OK,跳转成功,请继续");
                    SetRichtexBox2("----OK,跳转成功,请继续----");
                }
                else
                {
                    this.richTextBox2.BackColor = Color.Red;
                    SetRichtexBox2("----Sorry,跳转失败----");
                    // PutLableInfor2("Sorry,跳转失败,请确认");
                }

                this.textBox2.Focus();
                this.textBox2.SelectAll();

                //-----------end-----------
            }
        }
コード例 #18
0
        //扫描
        private void textBox7_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                //---开始MAC扫描
                ScanDataInitial();
                setRichtexBox("-----开始MAC扫描--------");
                string tt_task     = this.textBox1.Text.ToUpper().Trim();
                string tt_scanmac  = this.textBox7.Text.Trim();
                string tt_shortmac = tt_scanmac.Replace("-", "");


                //第一步位数判断
                Boolean tt_flag1 = false;
                tt_flag1 = CheckStrLengh(tt_scanmac, this.textBox3.Text);


                //第二步包含符判断
                Boolean tt_flag2 = false;
                if (tt_flag1)
                {
                    tt_flag2 = CheckStrContain(tt_scanmac, this.textBox4.Text.Trim());
                }

                //第三步 不包含符判断
                Boolean tt_flag3 = false;
                if (tt_flag2)
                {
                    tt_flag3 = CheckStrContain2(tt_scanmac, this.textBox2.Text.Trim());
                }



                //第四步 扣数判断
                Boolean tt_flag4 = false;
                if (tt_flag3)
                {
                    int tt_shouldscan = getTransmitStrToInt(this.label58.Text);
                    int tt_scanint    = getTransmitStrToInt(this.label59.Text);
                    if (tt_scanint <= tt_shouldscan)
                    {
                        tt_flag4 = true;
                        setRichtexBox("4、还没有达到上限,应扫描数量:" + tt_shouldscan.ToString() + ",实际扫描数量:" + tt_scanint.ToString() + ",goon");
                    }
                    else
                    {
                    }
                }



                //第五步 获取单板信息
                string  tt_pcba  = "";
                string  tt_mac   = "";
                Boolean tt_flag5 = false;
                if (tt_flag4)
                {
                    string tt_sql5 = "select pcbasn,maclable  from odc_alllable " +
                                     "where hprintman = '" + tt_task + "' and maclable = '" + tt_shortmac + "' ";

                    DataSet ds5 = Dataset1.GetDataSet(tt_sql5, tt_conn);
                    if (ds5.Tables.Count > 0 && ds5.Tables[0].Rows.Count > 0)
                    {
                        tt_flag5 = true;
                        tt_pcba  = ds5.Tables[0].Rows[0].ItemArray[0].ToString(); //单板号
                        tt_mac   = ds5.Tables[0].Rows[0].ItemArray[1].ToString(); //单板号
                        setRichtexBox("5、关联表查询到一条数据,pcba=" + tt_pcba + ",mac=" + tt_mac + ",goon");
                    }
                    else
                    {
                        setRichtexBox("5、关联表没有查询到数据,over");
                        PutLableInfor("关联表没有查询到数据,请检查!");
                    }
                }



                //第六步 获取站位
                Boolean tt_flag6 = false;
                if (tt_flag5)
                {
                    string tt_sql6 = "select count(1),min(ccode),min(ncode) from odc_routingtasklist " +
                                     "where  pcba_pn = '" + tt_shortmac + "' and napplytype is null ";

                    string[] tt_array6 = new string[3];
                    tt_array6 = Dataset1.GetDatasetArray(tt_sql6, tt_conn);
                    if (tt_array6[0] == "1")
                    {
                        if (tt_array6[2] == tt_ccode)
                        {
                            tt_flag6 = true;
                            setRichtexBox("6、该单板有待测站位,站位:" + tt_array6[1] + "," + tt_array6[2] + ",可以过站 goon");
                        }
                        else if (tt_array6[2] == "2220")
                        {
                            tt_flag6 = true;
                            setRichtexBox("6、该单板有待测站位,站位:" + tt_array6[1] + "," + tt_array6[2] + ",可以过站 goon");
                        }
                        else if (int.Parse(tt_array6[2]) < int.Parse(tt_ccode) || "2200,2205".Contains(tt_array6[2]))
                        {
                            setRichtexBox("6、该单板待测站位不在" + tt_ccode + ",站位:" + tt_array6[1] + "," + tt_array6[2] + ",不可以过站 goon");
                            PutLableInfor("该单板当前站位:" + tt_array6[2] + "不在" + tt_ccode + "站位,产品尚未测试耦合,不允许进站");
                        }
                        else
                        {
                            setRichtexBox("6、该单板待测站位不在" + tt_ccode + ",站位:" + tt_array6[1] + "," + tt_array6[2] + ",不可以过站 goon");
                            PutLableInfor("该单板当前站位:" + tt_array6[2] + "不在" + tt_ccode + "站位!");
                        }
                    }
                    else
                    {
                        setRichtexBox("6、没有找到待测站位,或有多条待测站位,流程异常,over");
                        PutLableInfor("没有找到待测站位,或有多条待测站位,流程异常!");
                    }
                }

                //第六步附 检查2115 站位状态
                Boolean tt_flag6_1 = false;
                if (tt_flag6)
                {
                    string tt_sql6_1 = "select ncode,napplytype from dbo.odc_routingtasklist where pcba_pn = '" + tt_shortmac + "' and ccode = '2115'";

                    string  tt_allprocesses = Dataset2.getGyidAllProcess(tt_gyid, tt_conn);
                    DataSet ds6_1           = Dataset1.GetDataSetTwo(tt_sql6_1, tt_conn);
                    bool    tt_processcheck = true;
                    if (ds6_1.Tables.Count > 0 && ds6_1.Tables[0].Rows.Count > 0)
                    {
                        string tt_napplytype = "1";
                        for (int i = 0; i < ds6_1.Tables[0].Rows.Count; i++)
                        {
                            tt_napplytype = ds6_1.Tables[0].Rows[i].ItemArray[1].ToString();
                            if (tt_napplytype == "0")
                            {
                                tt_processcheck = false;
                                break;
                            }
                        }

                        if ((tt_allprocesses.Contains("2111") && tt_napplytype == "1") || tt_processcheck)
                        {
                            tt_flag6_1 = true;
                            setRichtexBox("6.1、该产品产品耦合测试没有出现过不良,或者有2111站位,且当前已通过耦合测试,可以过站,goon");
                        }
                        else if (!tt_allprocesses.Contains("2111") && !tt_processcheck)
                        {
                            setRichtexBox("6.1、该产品流程没有2111站位,且耦合测试曾经出现过测试失败,不允许过站,over");
                            PutLableInfor("该产品2111不是必测站位,且耦合测试曾经出现过测试失败,不建议测试吞吐量!");
                        }
                        else if (tt_allprocesses.Contains("2111") && tt_napplytype == "0")
                        {
                            setRichtexBox("6.1、该产品流程有2111站位,但耦合测试没有通过测试,不允许过站,over");
                            PutLableInfor("该产品流程有2111站位,但耦合测试没有通过测试,不允许过站!");
                        }
                    }
                    else
                    {
                        string tt_sql6_2 = "select ncode,napplytype from dbo.odc_routingtasklist where pcba_pn = '" + tt_shortmac + "' and ccode = '2185'";

                        tt_allprocesses = Dataset2.getGyidAllProcess(tt_gyid, tt_conn);
                        DataSet ds6_2 = Dataset1.GetDataSetTwo(tt_sql6_2, tt_conn);
                        tt_processcheck = true;
                        if (ds6_2.Tables.Count > 0 && ds6_2.Tables[0].Rows.Count > 0)
                        {
                            string tt_napplytype = "1";
                            for (int i = 0; i < ds6_2.Tables[0].Rows.Count; i++)
                            {
                                tt_napplytype = ds6_2.Tables[0].Rows[i].ItemArray[1].ToString();
                                if (tt_napplytype == "0")
                                {
                                    tt_processcheck = false;
                                    break;
                                }
                            }

                            if ((tt_allprocesses.Contains("2111") && tt_napplytype == "1") || tt_processcheck)
                            {
                                tt_flag6_1 = true;
                                setRichtexBox("6.1、该产品产品耦合测试没有出现过不良,或者有2111站位,且当前已通过耦合测试,可以过站,goon");
                            }
                            else if (!tt_allprocesses.Contains("2111") && !tt_processcheck)
                            {
                                setRichtexBox("6.1、该产品流程没有2111站位,且耦合测试曾经出现过测试失败,不允许过站,over");
                                PutLableInfor("该产品2111不是必测站位,且耦合测试曾经出现过测试失败,不建议测试吞吐量!");
                            }
                        }
                        else
                        {
                            setRichtexBox("6.1、没有找到耦合站位状态,流程异常,over");
                            PutLableInfor("没有找到耦合站位状态,流程异常!");
                        }
                    }
                }

                //第七步 开始过站
                Boolean tt_flag7 = false;
                if (tt_flag6_1)
                {
                    string tt_sql7 = "update odc_routingtasklist set ncode = '2111',Fremark ='10%扫描耦合' " +
                                     "where pcba_pn = '" + tt_mac + "' and napplytype is null ";

                    int tt_int7 = Dataset1.ExecCommand(tt_sql7, tt_conn);
                    if (tt_int7 > 0)
                    {
                        tt_flag7 = true;
                        setRichtexBox("7、OK过站成功,跳站到2111");
                    }
                    else
                    {
                        setRichtexBox("7、Fail过站失败,over");
                        PutLableInfor("跳站2111失败,请重新扫描!");
                    }
                }



                //第八步 记录数据
                Boolean tt_flag8 = false;
                if (tt_flag7)
                {
                    string tt_sql8 = "insert into odc_insertcode(Taskcode,MAC,PCBA,Ncode,Fdate) " +
                                     "values('" + tt_task + "','" + tt_mac + "','" + tt_pcba + "','" + tt_ccode + "',getdate()) ";
                    int tt_int8 = Dataset1.ExecCommand(tt_sql8, tt_conn);
                    if (tt_int8 > 0)
                    {
                        tt_flag8 = true;
                        setRichtexBox("8、过站记录成功,goon");
                    }
                    else
                    {
                        setRichtexBox("8、过站记录成功,over");
                        PutLableInfor("过站记录失败,扫描其他单板!");
                    }
                }



                //最后判断
                if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4 && tt_flag5 && tt_flag6 && tt_flag7 && tt_flag8)
                {
                    GetProductNumInfo();
                    this.richTextBox1.BackColor = Color.Chartreuse;
                    setRichtexBox("9、over");
                    tt_yield++;
                    this.label8.Text = tt_yield.ToString();
                    PutListViewData(tt_mac, tt_pcba);
                    PutLableInfor("请继续扫描");
                    textBox7.Focus();
                    textBox7.SelectAll();
                }
                else
                {
                    this.richTextBox1.BackColor = Color.Red;
                    textBox7.Focus();
                    textBox7.SelectAll();
                }
            }
        }
コード例 #19
0
        //异常处理
        private void Button3_Click(object sender, EventArgs e)
        {
            //数据准备
            string tt_scan   = this.textBox1.Text.Trim().ToUpper();
            string tt_scansn = GetShortMac(tt_scan);


            //第一步 条码确定
            #region
            bool tt_flag1 = false;
            MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
            DialogResult      dr         = MessageBox.Show("确定要对条码:" + tt_scansn + ",进行处理吗?这个处理主要是出来没有待测站位\\有多个待测站位\\没有1920站位的情况,请确认你输入的是单板号,还是MAC", "异常处理", messButton);
            if (dr == DialogResult.OK)//如果点击“确定”按钮
            {
                tt_flag1 = true;
            }
            #endregion


            //第二步 确定MAC
            #region
            bool   tt_flag2    = false;
            string tt_shortmac = "";
            if (tt_flag1)
            {
                //选择的是MAC
                if (this.radioButton1.Checked == true)
                {
                    tt_flag2    = true;
                    tt_shortmac = tt_scansn;
                }


                //选择的是单板号
                if (this.radioButton2.Checked == true)
                {
                    string tt_sql2 = "select count(1),min(maclable),min(taskscode)  from odc_alllable where pcbasn = '" + tt_scansn + "' ";

                    string[] tt_array2 = new string[3];
                    tt_array2 = Dataset1.GetDatasetArray(tt_sql2, tt_conn);
                    if (tt_array2[0] == "1")
                    {
                        tt_flag2    = true;
                        tt_shortmac = tt_array2[1];
                    }
                    else
                    {
                        MessageBox.Show("根据你输入的单板号:" + tt_scansn + ",无法在关联表中找到对应的MAC");
                    }
                }
            }
            #endregion


            //第三步 确定单板号
            #region
            bool   tt_flag3 = false;
            string tt_pcba  = "";
            if (tt_flag2)
            {
                //选择的单板号
                if (this.radioButton2.Checked == true)
                {
                    tt_flag3 = true;
                    tt_pcba  = tt_scansn;
                }

                //选择的是MAC
                if (this.radioButton1.Checked == true)
                {
                    string tt_sql3 = "select count(1),min(pcbasn),min(taskscode)  from odc_alllable where maclable = '" + tt_scansn + "' ";

                    string[] tt_array3 = new string[3];
                    tt_array3 = Dataset1.GetDatasetArray(tt_sql3, tt_conn);
                    if (tt_array3[0] == "1")
                    {
                        tt_flag3 = true;
                        tt_pcba  = tt_array3[1];
                    }
                    else
                    {
                        MessageBox.Show("根据你输入的MAC:" + tt_scansn + ",无法在关联表中找到对应的单板号");
                    }
                }
            }

            #endregion


            //第四步 确定待测站位个数/是否缺失1920站位
            #region
            int    tt_intrownum = 0;
            string tt_nullmaxid = "";
            string tt_nullminid = "";
            bool   tt_flag4     = false;
            bool   tt_flag4_1   = false;
            if (tt_flag3)
            {
                string tt_sql4 = "select count(1),max(id),min(id) from odc_routingtasklist " +
                                 "where  pcba_pn = '" + tt_shortmac + "' and napplytype is NULL ";

                string tt_sql4_1 = "select id,ncode,ccode from odc_routingtasklist " +
                                   "where pcba_pn  = '" + tt_shortmac + "' and ncode = '2100' and napplytype = '1' order by id";

                string tt_sql4_2 = "select count(1),max(id),min(id) from odc_routingtasklist " +
                                   "where  pcba_pn = '" + tt_shortmac + "' and ncode = '2100' and napplytype = '1'";

                DataSet tt_dataset1  = Dataset2.getMacAllCodeInfo(tt_shortmac, tt_conn);
                int     tt_int1920id = Dataset2.getFirstCodeId(tt_dataset1);

                string[] tt_array4 = new string[3];
                tt_array4 = Dataset1.GetDatasetArray(tt_sql4, tt_conn);

                string[] tt_array4_2 = new string[3];
                tt_array4_2 = Dataset1.GetDatasetArray(tt_sql4_2, tt_conn);

                DataSet ds4_1 = Dataset1.GetDataSet(tt_sql4_1, tt_conn);
                if (ds4_1.Tables.Count > 0 && ds4_1.Tables[0].Rows.Count > 0 && tt_int1920id == -2)
                {
                    string tt_id_1    = ds4_1.Tables[0].Rows[0].ItemArray[0].ToString();
                    string tt_ccode_1 = ds4_1.Tables[0].Rows[0].ItemArray[1].ToString();
                    string tt_ncode_1 = ds4_1.Tables[0].Rows[0].ItemArray[2].ToString();

                    if (int.Parse(tt_ccode_1) > 1920 && tt_id_1 == tt_array4_2[2])
                    {
                        tt_flag4_1 = true;
                    }
                }

                if (tt_array4[0] == "1" && tt_flag4_1 == false)
                {
                    MessageBox.Show("该MAC:" + tt_shortmac + ",只有一个待测站位,没有异常,不需要处理");
                }
                else if (tt_flag4_1)
                {
                    int chang_ccode1920 = Change_ccode1920(tt_shortmac, tt_array4_2[2]);
                    MessageBox.Show("该MAC:" + tt_shortmac + ",无1920站位的问题已处理完毕");
                }
                else
                {
                    tt_flag4     = true;
                    tt_intrownum = GetStringToInt(tt_array4[0]);
                    tt_nullmaxid = tt_array4[1];
                    tt_nullminid = tt_array4[2];
                }
            }
            #endregion


            //第五步 确定异常问题
            #region
            bool tt_flag5 = false; //没有待测站位
            bool tt_flag6 = false; //多个待测站位
            if (tt_flag4)
            {
                if (tt_intrownum == 0)
                {
                    tt_flag5 = true;
                }
                else
                {
                    if (tt_intrownum > 1)
                    {
                        tt_flag6 = true;
                    }
                }
            }
            #endregion


            //第五步 没有待测站位处理
            #region
            if (tt_flag5)
            {
                string tt_rowmaxid = "";
                string tt_sql5     = "select count(1),max(id),0 from odc_routingtasklist " +
                                     "where  pcba_pn = '" + tt_shortmac + "' ";

                string[] tt_array5 = new string[3];
                tt_array5 = Dataset1.GetDatasetArray(tt_sql5, tt_conn);

                //查找最大的ID值
                bool tt_flag51 = false;
                if (tt_array5[0] == "0")
                {
                    MessageBox.Show("MAC:" + tt_shortmac + ",在站位表中没有找到记录");
                }
                else
                {
                    tt_flag51   = true;
                    tt_rowmaxid = tt_array5[1];
                }

                if (tt_flag51)
                {
                    string tt_sql51 = "update odc_routingtasklist set napplytype = NULL " +
                                      "where pcba_pn = '" + tt_shortmac + "' and id = " + tt_rowmaxid;

                    int tt_intexec = Dataset1.ExecCommand(tt_sql51, tt_conn);
                    if (tt_intexec > 0)
                    {
                        MessageBox.Show("---OK---,操作1成功,该MAC:" + tt_shortmac + ",没有待测站位,现在已给出一个待测站位,请再次查询");
                    }
                    else
                    {
                        MessageBox.Show("---Fail---,操作1失败,该MAC:" + tt_shortmac + ",没有待测站位,现在还是没有给出待测站位,请再次检查");
                    }
                }
            }
            #endregion


            //第六步 有多个待测站位,确定处理方法
            #region
            bool   tt_flag7  = false;
            bool   tt_flag8  = false;
            string tt_maxid2 = "";
            if (tt_flag6)
            {
                string tt_sql6 = "select count(1),max(id),0 from odc_routingtasklist " +
                                 "where  pcba_pn = '" + tt_shortmac + "' ";

                string[] tt_array6 = new string[3];
                tt_array6 = Dataset1.GetDatasetArray(tt_sql6, tt_conn);


                if (tt_array6[0] == "0")
                {
                    MessageBox.Show("程序逻辑有问题,这是查找有多个待测站位的最大ID值,但是MAC:" + tt_shortmac + ",在站位表中没有发现有多个待测站位");
                }
                else
                {
                    tt_maxid2 = tt_array6[1];
                    if (tt_nullmaxid == tt_maxid2)   //MAC的最大ID值和多个待测站位的最大ID值一致
                    {
                        tt_flag7 = true;
                    }
                    else
                    {
                        tt_flag8 = true;
                    }
                }
            }
            #endregion


            //第七步 有多个待测值 最大待测ID值和MAC的最大ID值一致(正常情况)
            #region
            if (tt_flag7)
            {
                string tt_sql7 = "update odc_routingtasklist set napplytype = 1 " +
                                 "where pcba_pn = '" + tt_shortmac + "' and napplytype is NULL and ID <" + tt_nullmaxid + " and id>=" + tt_nullminid;

                int tt_intexec7 = Dataset1.ExecCommand(tt_sql7, tt_conn);
                if (tt_intexec7 > 0)
                {
                    MessageBox.Show("---OK---,操作2成功,该MAC:" + tt_shortmac + ",有多个待测站位,最大ID值就是待测站位,现在已只有一个待测站位,请再次查询");
                }
                else
                {
                    MessageBox.Show("---Fail---,操作2失败,该MAC:" + tt_shortmac + ",有多个待测站位,最大ID值就是待测站位,现在还是没有给出一个待测站位,请再次检查");
                }
            }
            #endregion


            //第八步 有多个待测值 最大待测ID值和MAC的最大ID值不一致(非正常情况)
            #region
            if (tt_flag8)
            {
                //第8.1步 将最大ID值的设置为待测站位
                string tt_sql81 = "update odc_routingtasklist set napplytype = NULL " +
                                  "where pcba_pn = '" + tt_shortmac + "' and id = " + tt_maxid2;

                int tt_intexec81 = Dataset1.ExecCommand(tt_sql81, tt_conn);

                //第8.2步 将其他的待测站位取消
                string tt_sql82 = "update odc_routingtasklist set napplytype = 1 " +
                                  "where pcba_pn = '" + tt_shortmac + "' and napplytype is NULL and ID <=" + tt_nullmaxid + " and id>=" + tt_nullminid;

                int tt_intexec82 = Dataset1.ExecCommand(tt_sql82, tt_conn);

                //第8.3步 判断
                if (tt_intexec81 > 0 && tt_intexec82 > 0)
                {
                    MessageBox.Show("---OK---,操作3成功,该MAC:" + tt_shortmac + ",有多个待测站位,最大ID值不是待测站位,现在已只有一个待测站位,请再次查询");
                }
                else
                {
                    MessageBox.Show("---Fail---,操作4失败,该MAC:" + tt_shortmac + ",有多个待测站位,最大ID值不是待测站位,现在还是没有给出一个待测站位,请再次检查");
                }
            }
            #endregion
        }
コード例 #20
0
        //流程检查,获取下一流程
        private bool GetNextCode(string tt_task, string tt_username)
        {
            Boolean tt_flag = false;

            //第一步获取当前站位
            Boolean tt_flag1    = false;
            string  tt_testcode = "";
            string  tt_sql1     = "select count(1),min(Fcode),0 " +
                                  " from odc_fhpassword where Fname = '" + tt_username + "' ";

            string[] tt_array1 = new string[3];
            tt_array1 = Dataset1.GetDatasetArrayTwo(tt_sql1, tt_conn);

            if (tt_array1[0] == "1")
            {
                tt_testcode = tt_array1[1];
                tt_flag1    = true;
            }
            else
            {
                MessageBox.Show("当前用户号:" + tt_username + "没有找到设定的待测站位,请确认");
            }


            //第二步获取当前站位
            Boolean tt_flag2     = false;
            string  tt_firstcode = "";
            string  tt_ccode     = "";
            string  tt_process   = "";

            if (tt_flag1)
            {
                string tt_sql2 = "select count(1),min(b.PXID) ,min(a.GYID) " +
                                 "from odc_tasks a,odc_routing b " +
                                 "WHERE a.GYID=b.PID AND b.LCBZ=1 AND a.TASKSCODE='" + tt_task + "' ";
                string[] tt_array2 = new string[3];
                tt_array2 = Dataset1.GetDatasetArray(tt_sql2, tt_conn);
                if (tt_array2[0] == "1")
                {
                    tt_firstcode = tt_array2[1];
                    tt_ccode     = tt_testcode;

                    tt_process = tt_array2[2];
                    tt_flag2   = true;
                }
                else
                {
                    MessageBox.Show("该工单没有配置流程,请检查流程位置工单表以及流程表!");
                }
            }


            //第三步检查第一站位与设定的站位是否一致
            Boolean tt_flag3 = false;

            if (tt_flag1 && tt_flag2)
            {
                if (tt_ccode == tt_testcode)
                {
                    tt_flag3 = true;
                }
                else
                {
                    MessageBox.Show("程序设定待测站位与流程的第一站位不匹配,请检查!");
                }
            }


            //第四步 获取下一站位
            Boolean tt_flag4 = false;
            string  tt_ncode = "";

            if (tt_flag1 && tt_flag2 && tt_flag3)
            {
                string tt_sql4 = "select count(1),min(z.pxid),min(z.lcbz) " +
                                 " from odc_tasks t,odc_routing z  " +
                                 " where t.gyid=z.pid  and t.taskscode='" + tt_task + "' " +
                                 " and z.lcbz in( select (lcbz+1) lcbz " +
                                 "from odc_tasks a,odc_routing b " +
                                 "where b.pid=a.gyid and b.pxid='" + tt_ccode + "' " +
                                 " and a.taskscode='" + tt_task + "') ";



                string[] tt_array4 = new string[3];
                tt_array4 = Dataset1.GetDatasetArray(tt_sql4, tt_conn);
                if (tt_array4[0] == "1")
                {
                    tt_flag4 = true;
                    tt_ncode = tt_array4[1];
                }
                else
                {
                    MessageBox.Show("该工单流程配置异常,有前站位没有后站位,请检查流程位置工单表以及流程表!");
                }
            }


            if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4)
            {
                tt_flag            = true;
                this.textBox2.Text = tt_ccode;
                this.textBox4.Text = tt_ncode;
            }



            return(tt_flag);
        }
コード例 #21
0
        //铭牌主机条码扫描
        private void textBox2_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                ClearLabelInfo1();


                tt_hostlable = this.textBox2.Text.ToUpper().Trim();

                //第一步位数效验
                Boolean tt_flag1 = false;
                if (CheckStrLengh(tt_hostlable, this.textBox3.Text))
                {
                    tt_flag1 = true;
                }
                else
                {
                    this.textBox14.Text      = "位数不对";
                    this.textBox14.BackColor = Color.Red;
                }

                //第二步 包含效验
                Boolean tt_flag2 = false;
                if (tt_flag1)
                {
                    if (CheckStrContain(tt_hostlable, this.textBox4.Text))
                    {
                        tt_flag2 = true;
                    }
                    else
                    {
                        this.textBox14.Text      = "包含符不对";
                        this.textBox14.BackColor = Color.Red;
                    }
                }


                //第三步工单检验
                Boolean tt_flag3 = false;
                if (tt_flag1 && tt_flag2)
                {
                    string tt_sql3 = "select count(1),min(taskscode),0  from odc_alllable " +
                                     "where hostlable = '" + tt_hostlable + "' ";

                    string[] tt_array3 = new string[3];
                    tt_array3 = Dataset1.GetDatasetArray(tt_sql3, tt_conn);
                    if (tt_array3[0] == "1")
                    {
                        if (tt_array3[1] == this.textBox1.Text)
                        {
                            tt_flag3 = true;
                        }
                        else
                        {
                            this.textBox14.Text      = "工单不对," + tt_array3[1];
                            this.textBox14.BackColor = Color.Red;
                        }
                    }
                    else
                    {
                        this.textBox14.Text      = "没找到该记录";
                        this.textBox14.BackColor = Color.Red;
                    }
                }



                //第四步查找信息
                Boolean tt_flag4 = false;
                if (tt_flag1 && tt_flag2 && tt_flag3)
                {
                    string tt_sql4 = "select bprintuser,boxlable,dystlable,id from odc_alllable " +
                                     "where taskscode =  '" + this.textBox1.Text + "' and hostlable = '" + tt_hostlable + "'";

                    DataSet ds4 = Dataset1.GetDataSet(tt_sql4, tt_conn);
                    if (ds4.Tables.Count > 0 && ds4.Tables[0].Rows.Count > 0)
                    {
                        tt_flag4     = true;
                        tt_shortmac  = ds4.Tables[0].Rows[0].ItemArray[0].ToString().Substring(0, 17);
                        tt_boxlable  = ds4.Tables[0].Rows[0].ItemArray[1].ToString();
                        tt_shellable = ds4.Tables[0].Rows[0].ItemArray[2].ToString();
                        tt_id        = ds4.Tables[0].Rows[0].ItemArray[3].ToString();
                    }
                    else
                    {
                        this.textBox14.Text      = "该工单下,没找到该记录";
                        this.textBox14.BackColor = Color.Red;
                    }
                }



                //最后判断
                if (tt_flag1 && tt_flag2 && tt_flag3 && tt_flag4)
                {
                    this.textBox14.Text      = "PASS";
                    this.textBox14.BackColor = Color.Chartreuse;


                    if (this.checkBox3.Checked)
                    {
                        if (this.checkBox7.Checked)
                        {
                            this.textBox10.Focus();
                            this.textBox10.SelectAll();
                        }
                        else
                        {
                            this.textBox17.Focus();
                            this.textBox17.SelectAll();
                        }
                    }
                    else
                    {
                        this.textBox7.Focus();
                        this.textBox7.SelectAll();
                    }
                }
                else
                {
                    this.textBox2.Focus();
                    this.textBox2.SelectAll();
                }
            }
        }