Пример #1
0
        private List <HeiFeiMideaDll.OrderSet> GetData()
        {
            dataGridView1.EndEdit();
            DataTable dt  = (DataTable)dataGridView1.DataSource;
            DateTime  now = DateTime.Now;
            List <HeiFeiMideaDll.OrderSet> result = new List <HeiFeiMideaDll.OrderSet>();

            HeiFeiMideaDll.OrderSet tmp;
            for (int i = dt.Rows.Count - 1; i >= 0; i--)
            {
                tmp              = new HeiFeiMideaDll.OrderSet();
                tmp.OrderName    = All.Class.Num.ToString(dt.Rows[i]["OrderName"]);
                tmp.BarCode      = All.Class.Num.ToString(dt.Rows[i]["BarCode"]);
                tmp.BarStart     = All.Class.Num.ToInt(dt.Rows[i]["BarStart"]);
                tmp.BarEnd       = All.Class.Num.ToInt(dt.Rows[i]["BarEnd"]);
                tmp.LenNingCode  = All.Class.Num.ToString(dt.Rows[i]["LenNingCode"]);
                tmp.LenNingStart = All.Class.Num.ToInt(dt.Rows[i]["LenNingStart"]);
                tmp.LenNingEnd   = All.Class.Num.ToInt(dt.Rows[i]["LenNingEnd"]);
                tmp.PrintFile    = All.Class.Num.ToString(dt.Rows[i]["PrintFile"]);
                tmp.BoShi        = All.Class.Num.ToString(dt.Rows[i]["BoShi"]);
                tmp.OrderTime    = now;
                tmp.OrderYear    = now.Year;
                tmp.OrderMonth   = All.Class.Num.ToInt(dt.Rows[i]["OrderMonth"]);
                tmp.OrderDay     = All.Class.Num.ToInt(dt.Rows[i]["OrderDay"]);
                if (tmp.OrderName != "" && tmp.BarCode != "")
                {
                    result.Add(tmp);
                }
            }
            //检查当前条码格式是否已存在于记忆中
            List <string> BarFormatLists = frmMain.mMain.AllDataXml.LocalSet.FormatBarStr.ToList();

            result.ForEach(
                order =>
            {
                string nowFormatStr = GetFormatStrFromBar(order.BarCode);
                if (BarFormatLists.FindIndex(
                        barFormatList =>
                {
                    return(barFormatList == nowFormatStr);
                }) < 0)
                {
                    BarFormatLists.Add(nowFormatStr);
                    frmMain.mMain.AllDataXml.LocalSet.Save();
                }
            });
            return(result);
        }
Пример #2
0
            /// <summary>
            /// 将MCGS工位状态刷新过来
            /// </summary>
            public void FlushStatue(bool Init)
            {
                this.WorkStation = (int)(Math.Floor(this.ID / 3.0f)) + 1;
                switch (this.ID % 3)
                {
                case 0:
                    this.LineWorkStation = frmMain.mMain.AllCars.AllInfoStation[this.WorkStation].TestOne;
                    break;

                case 1:
                    this.LineWorkStation = frmMain.mMain.AllCars.AllInfoStation[this.WorkStation].TestTwo;
                    break;

                case 2:
                    this.LineWorkStation = frmMain.mMain.AllCars.AllInfoStation[this.WorkStation].TestThree;
                    break;
                }
                if (this.LineWorkStation == 0)
                {
                    return;
                }
                string tmpBarCode = "";

                switch (this.WorkStation)
                {
                default:
                    tmpBarCode = frmMain.mMain.AllCars.AllStatueLineStation[this.LineWorkStation - 1].BarCode;
                    break;

                case 11:
                    Dictionary <string, string> tmpLenNingCode = All.Class.SSFile.Text2Dictionary(frmMain.mMain.AllMeterData.AllReadValue.StringValue.Value[30 + this.ID]);
                    if (tmpLenNingCode.ContainsKey("BarCode"))
                    {
                        tmpBarCode = tmpLenNingCode["BarCode"];
                    }
                    break;
                }
                switch (this.WorkStation)
                {
                default:
                    this.TestResult = frmMain.mMain.AllCars.AllStatueLineStation[this.LineWorkStation - 1].OK;
                    this.TestTime   = frmMain.mMain.AllPCs.AllStatueTestTime.AllStatueTestTime[this.LineWorkStation - 1].TestTime;
                    break;

                case 11:
                    this.TestResult = true;
                    this.TestTime   = 0;
                    break;
                }
                if (this.BarCode == tmpBarCode)
                {
                    return;
                }
                if (tmpBarCode == "")
                {
                    this.BarCode   = "";
                    this.OrderMode = "";
                    this.OrderName = "";
                    this.ModeID    = "";
                    //this.ModeSet = new HeiFeiMideaDll.ModeSet();
                    if (BarCodeChange != null)
                    {
                        BarCodeChange(this.ID, this.WorkStation, this.BarCode, this.OrderName, null, null);
                    }
                    //CheckRootID();//清机器人ID
                    return;
                }
                this.BarCode = tmpBarCode;
                if (this.WorkStation == 11)//冷凝器上线处没有订单
                {
                    this.OrderName = "";
                }
                else
                {
                    HeiFeiMideaDll.OrderSet tmpOrder = HeiFeiMideaDll.OrderSet.GetOrder(frmMain.mMain.AllOrder, this.BarCode, this.WorkStation);
                    if (tmpOrder == null)
                    {
                        tmpOrder = HeiFeiMideaDll.OrderSet.GetOrder(this.BarCode, this.WorkStation, frmMain.mMain.AllDataXml.LocalSet.FormatBarStr, frmMain.mMain.AllDataBase.ReadData);
                    }
                    if (tmpOrder == null)
                    {
                        this.OrderName = "当前条码无订单";
                    }
                    else
                    {
                        this.OrderName = tmpOrder.OrderName;
                    }
                }
                switch (this.WorkStation)
                {
                default:
                    ModeSet = HeiFeiMideaDll.ModeSet.GetMode(
                        HeiFeiMideaDll.ModeSet.GetModeIDFromBar(this.BarCode, frmMain.mMain.AllDataXml.LocalSet.FormatBarStr),
                        frmMain.mMain.AllDataBase.ReadData);
                    if (ModeSet == null)
                    {
                        this.OrderMode = "";
                        this.ModeID    = "";
                    }
                    else
                    {
                        this.OrderMode = ModeSet.Mode;
                        this.ModeID    = ModeSet.ID;
                    }
                    if (!Init)
                    {
                        CheckRootID();
                    }
                    break;

                case 11:
                    string tmpModeID = "";
                    if (this.BarCode.Length > 12)    //折弯条码组成为【型号】+8位日期+4位流水
                    {
                        tmpModeID = this.BarCode.Substring(0, this.BarCode.Length - 12);
                    }
                    ModeZheWangSet = HeiFeiMideaDll.ModeZheWangSet.GetMode(tmpModeID, frmMain.mMain.AllDataBase.ReadData);
                    if (ModeZheWangSet == null)
                    {
                        this.OrderMode = "";
                        this.ModeID    = "";
                    }
                    else
                    {
                        this.OrderMode = ModeZheWangSet.Mode;
                        this.ModeID    = ModeZheWangSet.ID;
                    }
                    break;
                }
                if (BarCodeChange != null)
                {
                    BarCodeChange(this.ID, this.LineWorkStation, this.BarCode, this.OrderName, ModeSet, ModeZheWangSet);
                }
            }