using MESClassLibrary.BLL.Log;
using PunchAndWeld.DataSouce;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Web.Services.Description;
using System.Windows.Forms;

namespace PunchAndWeld
{
    public partial class FrmOtherParts : Form
    {
        OtherPart parts = new OtherPart();
        int[] isCheck = new int[6] { 0, 0, 0, 0, 0, 0 };
        private static string productID3 = "", productID4 = "", productID5 = "", productID6 = "", productID7 = "", productID8 = "";

        static int a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, a6 = 0;
        static string[] s1 = new string[1];
        static string[] s2 = new string[1];
        static string[] s3 = new string[1];
        static string[] s4 = new string[1];
        static string[] s5 = new string[1];
        static string[] s6 = new string[1];

        public FrmOtherParts(OtherPart part)
        {
            InitializeComponent();
            parts = part;
        }

        private void FrmOtherParts_Load(object sender, EventArgs e)
        {
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
            textBox4.Text = "";
            textBox5.Text = "";
            textBox6.Text = "";
            textBox1.Enabled = false;
            textBox2.Enabled = false;
            textBox3.Enabled = false;
            textBox4.Enabled = false;
            textBox5.Enabled = false;
            textBox6.Enabled = false;
            label4.Text = "";
            label5.Text = "";
            label6.Text = "";
            label7.Text = "";
            label9.Text = "";
            label11.Text = "";
            int[] isCheck = new int[6] { 0, 0, 0, 0, 0, 0 };
            label4.Text = ProScreenFunc.GetPartNoByID(parts.productID3);
            label5.Text = ProScreenFunc.GetPartNoByID(parts.productID4);
            label6.Text = ProScreenFunc.GetPartNoByID(parts.productID5);

            label7.Text = ProScreenFunc.GetPartNoByID(parts.productID6);
            label9.Text = ProScreenFunc.GetPartNoByID(parts.productID7);
            label11.Text = ProScreenFunc.GetPartNoByID(parts.productID8);

            qty3.Text = parts.qty3;
            qty4.Text = parts.qty4;
            qty5.Text = parts.qty5;
            qty9.Text = parts.qty6;
            qty10.Text = parts.qty7;
            qty11.Text = parts.qty8;

            s1 = new string[int.Parse(qty3.Text)];
            s2 = new string[int.Parse(qty4.Text)];
            s3 = new string[int.Parse(qty5.Text)];
            s4 = new string[int.Parse(qty9.Text)];
            s5 = new string[int.Parse(qty10.Text)];
            s6 = new string[int.Parse(qty11.Text)];
            a1 = 0; a2 = 0; a3 = 0; a4 = 0; a5 = 0; a6 = 0;

            if (!string.IsNullOrWhiteSpace(parts.productID3))
            {
                textBox1.Enabled = true;
            }
            if (!string.IsNullOrWhiteSpace(parts.productID4))
            {
                textBox2.Enabled = true;
            }
            if (!string.IsNullOrWhiteSpace(parts.productID5))
            {
                textBox3.Enabled = true;
            }

            if (!string.IsNullOrWhiteSpace(parts.productID6))
            {
                textBox4.Enabled = true;
            }
            if (!string.IsNullOrWhiteSpace(parts.productID7))
            {
                textBox5.Enabled = true;
            }
            if (!string.IsNullOrWhiteSpace(parts.productID8))
            {
                textBox6.Enabled = true;
            }

            if (textBox1.Enabled)
            {
                textBox1.Focus();
            }
            else if (textBox2.Enabled)
            {
                textBox2.Focus();
            }
            else if (textBox3.Enabled)
            {
                textBox3.Focus();
            }
            else if (textBox4.Enabled)
            {
                textBox4.Focus();
            }
            else if (textBox5.Enabled)
            {
                textBox5.Focus();
            }
            else if (textBox6.Enabled)
            {
                textBox6.Focus();
            }
        }

        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter) 
                {
                    string barcode = textBox1.Text.Trim();
                    if (string.IsNullOrWhiteSpace(barcode))
                    {
                        MessageBox.Show("条码不能为空!", "提示", MessageBoxButtons.OK);
                        textBox1.SelectAll();
                        textBox1.Focus();
                        return;
                    }

                    productID3 = ProScreenFunc.GetProductID(barcode);
                    if (parts.productID3 == productID3)
                    {
                        s1[a1] = barcode;
                        if (a1 < int.Parse(qty3.Text)-1)
                        {
                            a1++;
                            textBox1.SelectAll();
                            textBox1.Focus();
                        }
                        else
                        {
                            isCheck[0] = 1;
                            if (textBox2.Enabled)
                            {
                                textBox2.Text = "";
                                textBox2.Focus();
                            }
                            else if (textBox3.Enabled)
                            {
                                textBox3.Text = "";
                                textBox3.Focus();
                            }
                            else if (textBox4.Enabled)
                            {
                                textBox4.Text = "";
                                textBox4.Focus();
                            }
                            else if (textBox5.Enabled)
                            {
                                textBox5.Text = "";
                                textBox5.Focus();
                            }
                            else if (textBox6.Enabled)
                            {
                                textBox6.Text = "";
                                textBox6.Focus();
                            }
                            else
                            {
                                isCheck[1] = 1;
                                isCheck[2] = 1;
                                isCheck[3] = 1;
                                isCheck[4] = 1;
                                isCheck[5] = 1;
                                if (isCheck[0] == 0)
                                {
                                    MessageBox.Show("关键零件号1未校验!");
                                    textBox1.SelectAll();
                                    textBox1.Focus();
                                    return;
                                }
                                if (isCheck[1] == 0)
                                {
                                    MessageBox.Show("关键零件号2未校验!");
                                    textBox2.SelectAll();
                                    textBox2.Focus();
                                    return;
                                }
                                if (isCheck[2] == 0)
                                {
                                    MessageBox.Show("关键零件号3未校验!");
                                    textBox3.SelectAll();
                                    textBox3.Focus();
                                    return;
                                }
                                if (isCheck[3] == 0)
                                {
                                    MessageBox.Show("关键零件号4未校验!");
                                    textBox4.SelectAll();
                                    textBox4.Focus();
                                    return;
                                }
                                if (isCheck[4] == 0)
                                {
                                    MessageBox.Show("关键零件号5未校验!");
                                    textBox5.SelectAll();
                                    textBox5.Focus();
                                    return;
                                }
                                if (isCheck[5] == 0)
                                {
                                    MessageBox.Show("关键零件号6未校验!");
                                    textBox6.SelectAll();
                                    textBox6.Focus();
                                    return;
                                }
                                ScanAll.ScanResult = true;
                                ScanAll.barCode1 = string.Join(",", s1);
                                ScanAll.partNo1 = ProScreenFunc.GetPartNoByID(productID3);
                                ScanAll.barCode2 = "";
                                ScanAll.partNo2 = "";
                                ScanAll.barCode3 = "";
                                ScanAll.partNo3 = "";

                                ScanAll.barCode4 ="";
                                ScanAll.partNo4 = "";
                                ScanAll.barCode5 = "";
                                ScanAll.partNo5 = "";
                                ScanAll.barCode6 = "";
                                ScanAll.partNo6 = "";
                                this.Close();
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("扫入条码与总成不匹配,请检查后再次扫描");
                        textBox1.SelectAll();
                        textBox1.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
            }
        }

        private void textBox2_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    string barcode = textBox2.Text.Trim();
                    if (string.IsNullOrWhiteSpace(barcode))
                    {
                        MessageBox.Show("条码不能为空!", "提示", MessageBoxButtons.OK);
                        textBox2.SelectAll();
                        textBox2.Focus();
                        return;
                    }

                    productID4 = ProScreenFunc.GetProductID(barcode);
                    if (parts.productID4 == productID4)
                    {
                        s2[a2] = barcode;
                        if (a2 < int.Parse(qty4.Text)-1)
                        {
                            a2++;
                            textBox2.SelectAll();
                            textBox2.Focus();
                        }
                        else
                        {
                            isCheck[1] = 1;

                            if (textBox3.Enabled)
                            {
                                textBox3.Text = "";
                                textBox3.Focus();
                            }
                            else if (textBox4.Enabled)
                            {
                                textBox4.Text = "";
                                textBox4.Focus();
                            }
                            else if (textBox5.Enabled)
                            {
                                textBox5.Text = "";
                                textBox5.Focus();
                            }
                            else if (textBox6.Enabled)
                            {
                                textBox6.Text = "";
                                textBox6.Focus();
                            }
                            else
                            {
                                isCheck[2] = 1;
                                isCheck[3] = 1;
                                isCheck[4] = 1;
                                isCheck[5] = 1;

                                if (isCheck[0] == 0)
                                {
                                    MessageBox.Show("关键零件号1未校验!");
                                    textBox2.Text = "";
                                    textBox1.SelectAll();
                                    textBox1.Focus();
                                    return;
                                }
                                if (isCheck[1] == 0)
                                {
                                    MessageBox.Show("关键零件号2未校验!");
                                    textBox2.SelectAll();
                                    textBox2.Focus();
                                    return;
                                }
                                if (isCheck[2] == 0)
                                {
                                    MessageBox.Show("关键零件号3未校验!");
                                    textBox3.SelectAll();
                                    textBox3.Focus();
                                    return;
                                }
                                if (isCheck[3] == 0)
                                {
                                    MessageBox.Show("关键零件号4未校验!");
                                    textBox4.SelectAll();
                                    textBox4.Focus();
                                    return;
                                }
                                if (isCheck[4] == 0)
                                {
                                    MessageBox.Show("关键零件号54未校验!");
                                    textBox5.SelectAll();
                                    textBox5.Focus();
                                    return;
                                }
                                if (isCheck[5] == 0)
                                {
                                    MessageBox.Show("关键零件号6未校验!");
                                    textBox6.SelectAll();
                                    textBox6.Focus();
                                    return;
                                }

                                ScanAll.ScanResult = true;
                                ScanAll.barCode1 = string.Join(",", s1); 
                                ScanAll.partNo1 = ProScreenFunc.GetPartNoByID(productID3);
                                ScanAll.barCode2 = string.Join(",", s2);
                                ScanAll.partNo2 = ProScreenFunc.GetPartNoByID(productID4);
                                ScanAll.barCode3 = "";
                                ScanAll.partNo3 = "";

                                ScanAll.barCode4 = "";
                                ScanAll.partNo4 = "";
                                ScanAll.barCode5 = "";
                                ScanAll.partNo5 = "";
                                ScanAll.barCode6 = "";
                                ScanAll.partNo6 = "";
                                this.Close();
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("扫入条码与总成不匹配,请检查后再次扫描");
                        textBox2.SelectAll();
                        textBox2.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
            }
        }

        private void textBox3_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    string barcode = textBox3.Text.Trim();
                    if (string.IsNullOrWhiteSpace(barcode))
                    {
                        MessageBox.Show("条码不能为空!", "提示", MessageBoxButtons.OK);
                        textBox3.SelectAll();
                        textBox3.Focus();
                        return;
                    }

                    productID5 = ProScreenFunc.GetProductID(barcode);
                    if (parts.productID5 == productID5)
                    {
                        s3[a3] = barcode;
                        if (a3 < int.Parse(qty5.Text)-1)
                        {
                            a3++;
                            textBox3.SelectAll();
                            textBox3.Focus();
                        }
                        else
                        {
                            isCheck[2] = 1;

                            if (textBox4.Enabled)
                            {
                                textBox4.Text = "";
                                textBox4.Focus();
                            }
                            else if (textBox5.Enabled)
                            {
                                textBox5.Text = "";
                                textBox5.Focus();
                            }
                            else if (textBox6.Enabled)
                            {
                                textBox6.Text = "";
                                textBox6.Focus();
                            }
                            else
                            {
                                isCheck[3] = 1;
                                isCheck[4] = 1;
                                isCheck[5] = 1;

                                if (isCheck[0] == 0)
                                {
                                    MessageBox.Show("关键零件号1未校验!");
                                    textBox3.Text = "";
                                    textBox1.SelectAll();
                                    textBox1.Focus();
                                    return;
                                }
                                if (isCheck[1] == 0)
                                {
                                    MessageBox.Show("关键零件号2未校验!");
                                    textBox3.Text = "";
                                    textBox2.SelectAll();
                                    textBox2.Focus();
                                    return;
                                }
                                if (isCheck[2] == 0)
                                {
                                    MessageBox.Show("关键零件号3未校验!");
                                    textBox3.SelectAll();
                                    textBox3.Focus();
                                    return;
                                }
                                if (isCheck[3] == 0)
                                {
                                    MessageBox.Show("关键零件号4未校验!");
                                    textBox4.SelectAll();
                                    textBox4.Focus();
                                    return;
                                }
                                if (isCheck[4] == 0)
                                {
                                    MessageBox.Show("关键零件号5未校验!");
                                    textBox5.SelectAll();
                                    textBox5.Focus();
                                    return;
                                }
                                if (isCheck[5] == 0)
                                {
                                    MessageBox.Show("关键零件号5未校验!");
                                    textBox6.SelectAll();
                                    textBox6.Focus();
                                    return;
                                }

                                ScanAll.ScanResult = true;
                                ScanAll.barCode1 = string.Join(",", s1); 
                                ScanAll.partNo1 = ProScreenFunc.GetPartNoByID(productID3);
                                ScanAll.barCode2 = string.Join(",", s2);
                                ScanAll.partNo2 = ProScreenFunc.GetPartNoByID(productID4);
                                ScanAll.barCode3 = string.Join(",", s3);
                                ScanAll.partNo3 = ProScreenFunc.GetPartNoByID(productID5);

                                ScanAll.barCode4 = "";
                                ScanAll.partNo4 = "";
                                ScanAll.barCode5 = "";
                                ScanAll.partNo5 = "";
                                ScanAll.barCode6 = "";
                                ScanAll.partNo6 = "";
                                this.Close();
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("扫入条码与总成不匹配,请检查后再次扫描");
                        textBox3.SelectAll();
                        textBox3.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
            }
        }


        private void textBox4_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    string barcode = textBox4.Text.Trim();
                    if (string.IsNullOrWhiteSpace(barcode))
                    {
                        MessageBox.Show("条码不能为空!", "提示", MessageBoxButtons.OK);
                        textBox4.SelectAll();
                        textBox4.Focus();
                        return;
                    }


                    productID6 = ProScreenFunc.GetProductID(barcode);
                    if (parts.productID6 == productID6)
                    {
                        s4[a4] = barcode;
                        if (a4 < int.Parse(qty9.Text)-1)
                        {
                            a4++;
                            textBox4.SelectAll();
                            textBox4.Focus();
                        }
                        else
                        {
                            isCheck[3] = 1;

                            if (textBox5.Enabled)
                            {
                                textBox5.Text = "";
                                textBox5.Focus();
                            }
                            else if (textBox6.Enabled)
                            {
                                textBox6.Text = "";
                                textBox6.Focus();
                            }
                            else
                            {
                                isCheck[4] = 1;
                                isCheck[5] = 1;


                                if (isCheck[0] == 0)
                                {
                                    MessageBox.Show("关键零件号1未校验!");
                                    textBox4.Text = "";
                                    textBox1.SelectAll();
                                    textBox1.Focus();
                                    return;
                                }
                                if (isCheck[1] == 0)
                                {
                                    MessageBox.Show("关键零件号2未校验!");
                                    textBox4.Text = "";
                                    textBox2.SelectAll();
                                    textBox2.Focus();
                                    return;
                                }
                                if (isCheck[2] == 0)
                                {
                                    MessageBox.Show("关键零件号3未校验!");
                                    textBox4.Text = "";
                                    textBox3.SelectAll();
                                    textBox3.Focus();
                                    return;
                                }
                                if (isCheck[3] == 0)
                                {
                                    MessageBox.Show("关键零件号4未校验!");
                                    textBox4.SelectAll();
                                    textBox4.Focus();
                                    return;
                                }
                                if (isCheck[4] == 0)
                                {
                                    MessageBox.Show("关键零件号5未校验!");
                                    textBox5.SelectAll();
                                    textBox5.Focus();
                                    return;
                                }
                                if (isCheck[5] == 0)
                                {
                                    MessageBox.Show("关键零件号6未校验!");
                                    textBox6.SelectAll();
                                    textBox6.Focus();
                                    return;
                                }

                                ScanAll.ScanResult = true;
                                ScanAll.barCode1 = string.Join(",", s1);
                                ScanAll.partNo1 = ProScreenFunc.GetPartNoByID(productID3);
                                ScanAll.barCode2 = string.Join(",", s2);
                                ScanAll.partNo2 = ProScreenFunc.GetPartNoByID(productID4);
                                ScanAll.barCode3 = string.Join(",", s4);
                                ScanAll.partNo3 = ProScreenFunc.GetPartNoByID(productID5);

                                ScanAll.barCode4 = string.Join(",", s4);
                                ScanAll.partNo4 = ProScreenFunc.GetPartNoByID(productID6);
                                ScanAll.barCode5 = "";
                                ScanAll.partNo5 = "";
                                ScanAll.barCode6 = "";
                                ScanAll.partNo6 = "";
                                this.Close();
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("扫入条码与总成不匹配,请检查后再次扫描");
                        textBox4.SelectAll();
                        textBox4.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
            }
        }

        private void textBox5_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    string barcode = textBox5.Text.Trim();
                    if (string.IsNullOrWhiteSpace(barcode))
                    {
                        MessageBox.Show("条码不能为空!", "提示", MessageBoxButtons.OK);
                        textBox5.SelectAll();
                        textBox5.Focus();
                        return;
                    }

                    

                    productID7 = ProScreenFunc.GetProductID(barcode);
                    if (parts.productID7 == productID7)
                    {
                        s5[a5] = barcode;
                        if (a5 < int.Parse(qty10 .Text)-1)
                        {
                            a5++;
                            textBox5.SelectAll();
                            textBox5.Focus();
                        }
                        else
                        {
                            isCheck[4] = 1;

                            if (textBox6.Enabled)
                            {
                                textBox6.Text = "";
                                textBox6.Focus();
                            }
                            else 
                            {
                                isCheck[4] = 1;
                                isCheck[5] = 1;

                                if (isCheck[0] == 0)
                                {
                                    MessageBox.Show("关键零件号1未校验!");
                                    textBox5.Text = "";
                                    textBox1.SelectAll();
                                    textBox1.Focus();
                                    return;
                                }
                                if (isCheck[1] == 0)
                                {
                                    MessageBox.Show("关键零件号2未校验!");
                                    textBox5.Text = "";
                                    textBox2.SelectAll();
                                    textBox2.Focus();
                                    return;
                                }
                                if (isCheck[2] == 0)
                                {
                                    MessageBox.Show("关键零件号3未校验!");
                                    textBox3.SelectAll();
                                    textBox3.Focus();
                                    return;
                                }
                                if (isCheck[3] == 0)
                                {
                                    MessageBox.Show("关键零件号4未校验!");
                                    textBox5.Text = "";
                                    textBox4.SelectAll();
                                    textBox4.Focus();
                                    return;
                                }
                                if (isCheck[4] == 0)
                                {
                                    MessageBox.Show("关键零件号5未校验!");
                                    textBox5.SelectAll();
                                    textBox5.Focus();
                                    return;
                                }
                                if (isCheck[5] == 0)
                                {
                                    MessageBox.Show("关键零件号6未校验!");
                                    textBox6.SelectAll();
                                    textBox6.Focus();
                                    return;
                                }

                                ScanAll.ScanResult = true;
                                ScanAll.barCode1 = string.Join(",", s1);
                                ScanAll.partNo1 = ProScreenFunc.GetPartNoByID(productID3);
                                ScanAll.barCode2 = string.Join(",", s2);
                                ScanAll.partNo2 = ProScreenFunc.GetPartNoByID(productID4);
                                ScanAll.barCode3 = string.Join(",", s3);
                                ScanAll.partNo3 = ProScreenFunc.GetPartNoByID(productID5);

                                ScanAll.barCode4 = string.Join(",", s4);
                                ScanAll.partNo4 = ProScreenFunc.GetPartNoByID(productID6);
                                ScanAll.barCode5 = string.Join(",", s5);
                                ScanAll.partNo5 = ProScreenFunc.GetPartNoByID(productID7);
                                ScanAll.barCode6 = "";
                                ScanAll.partNo6 = "";
                                this.Close();
                            }

                            
                        }
                    }
                    else
                    {
                        MessageBox.Show("扫入条码与总成不匹配,请检查后再次扫描");
                        textBox5.SelectAll();
                        textBox5.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
            }
        }

        private void textBox6_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    string barcode = textBox6.Text.Trim();
                    if (string.IsNullOrWhiteSpace(barcode))
                    {
                        MessageBox.Show("条码不能为空!", "提示", MessageBoxButtons.OK);
                        textBox6.SelectAll();
                        textBox6.Focus();
                        return;
                    }

                    

                    productID8 = ProScreenFunc.GetProductID(barcode);
                    if (parts.productID8 == productID8)
                    {
                        s6[a6] = barcode;
                        if (a6 < int.Parse(qty11.Text)-1)
                        {
                            a6++;
                            textBox6.SelectAll();
                            textBox6.Focus();
                        }
                        else
                        {
                            isCheck[5] = 1;

                            if (isCheck[0] == 0)
                            {
                                MessageBox.Show("关键零件号1未校验!");
                                textBox6.Text = "";
                                textBox1.SelectAll();
                                textBox1.Focus();
                                return;
                            }
                            if (isCheck[1] == 0)
                            {
                                MessageBox.Show("关键零件号2未校验!");
                                textBox6.Text = "";
                                textBox2.SelectAll();
                                textBox2.Focus();
                                return;
                            }
                            if (isCheck[2] == 0)
                            {
                                MessageBox.Show("关键零件号3未校验!");
                                textBox6.Text = "";
                                textBox3.SelectAll();
                                textBox3.Focus();
                                return;
                            }
                            if (isCheck[3] == 0)
                            {
                                MessageBox.Show("关键零件号4未校验!");
                                textBox6.Text = "";
                                textBox4.SelectAll();
                                textBox4.Focus();
                                return;
                            }
                            if (isCheck[4] == 0)
                            {
                                MessageBox.Show("关键零件号5未校验!");
                                textBox6.Text = "";
                                textBox5.SelectAll();
                                textBox5.Focus();
                                return;
                            }
                            if (isCheck[5] == 0)
                            {
                                MessageBox.Show("关键零件号6未校验!");
                                textBox6.SelectAll();
                                textBox6.Focus();
                                return;
                            }

                            ScanAll.barCode1 = string.Join(",", s1);
                            ScanAll.partNo1 = ProScreenFunc.GetPartNoByID(productID3);
                            ScanAll.barCode2 = string.Join(",", s2);
                            ScanAll.partNo2 = ProScreenFunc.GetPartNoByID(productID4);
                            ScanAll.barCode3 = string.Join(",", s3);
                            ScanAll.partNo3 = ProScreenFunc.GetPartNoByID(productID5);

                            ScanAll.barCode4 = string.Join(",", s4);
                            ScanAll.partNo4 = ProScreenFunc.GetPartNoByID(productID6);
                            ScanAll.barCode5 = string.Join(",", s5);
                            ScanAll.partNo5 = ProScreenFunc.GetPartNoByID(productID7);
                            ScanAll.barCode6 = string.Join(",", s6);
                            ScanAll.partNo6 = ProScreenFunc.GetPartNoByID(productID8); ;
                            this.Close();
                        }
                    }
                    else
                    {
                        MessageBox.Show("扫入条码与总成不匹配,请检查后再次扫描");
                        textBox6.SelectAll();
                        textBox6.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            ScanAll.ScanResult = false;
            this.Close();
        }
    }
}