Ejemplo n.º 1
0
 public cCarLocal()
 {
     AllStatueCar = new StatueCar[HeiFeiMideaDll.cMain.AllCarCount];
     for (int i = 0; i < AllStatueCar.Length; i++)
     {
         AllStatueCar[i] = new StatueCar();
     }
     AllStatueLineStation = new StatueLineStation[HeiFeiMideaDll.cMain.AllStopStationCount];
     for (int i = 0; i < AllStatueLineStation.Length; i++)
     {
         AllStatueLineStation[i] = new StatueLineStation();
         AllStatueLineStation[i].LineStationIndex = i + 1;
     }
     AllInfoLineStation = new HeiFeiMideaDll.cDataLocal.InfoLineStation[HeiFeiMideaDll.cMain.AllStopStationCount];
     for (int i = 0; i < AllInfoLineStation.Length; i++)
     {
         AllInfoLineStation[i]             = new HeiFeiMideaDll.cDataLocal.InfoLineStation();
         AllInfoLineStation[i].WorkStation = i + 1;
     }
     AllStatueStation = new StatueStation[HeiFeiMideaDll.cMain.AllComputerShowCount];
     for (int i = 0; i < AllStatueStation.Length; i++)
     {
         AllStatueStation[i] = new StatueStation(i);
         AllStatueStation[i].BarCodeChange += cCarLocal_BarCodeChange;
     }
     AllStatueOther = new cStatueOther[HeiFeiMideaDll.cMain.AllOtherMachineCount];
     for (int i = 0; i < AllStatueOther.Length; i++)
     {
         AllStatueOther[i] = new cStatueOther(i + 1);
     }
     AllStatueLengNinQi = new StatueLengNinQi();
 }
Ejemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            dataGridView1.EndEdit();
            DataTable dt = (DataTable)dataGridView1.DataSource;
            List <HeiFeiMideaDll.cDataLocal.InfoLineStation> infoLineStations = new List <HeiFeiMideaDll.cDataLocal.InfoLineStation>();

            HeiFeiMideaDll.cDataLocal.InfoLineStation tmpInfoLineStation;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                tmpInfoLineStation             = new HeiFeiMideaDll.cDataLocal.InfoLineStation();
                tmpInfoLineStation.WorkStation = All.Class.Num.ToInt(dt.Rows[i]["WorkStation"]);
                tmpInfoLineStation.StationName = All.Class.Num.ToString(dt.Rows[i]["StationName"]);
                tmpInfoLineStation.TestStation = All.Class.Num.ToBool(dt.Rows[i]["TestStation"]);
                tmpInfoLineStation.TimeOut     = All.Class.Num.ToInt(dt.Rows[i]["TimeOut"]);
                if (tmpInfoLineStation.StationName == "")
                {
                    All.Window.MetroMessageBox.Show(this, "对不起,工位的名称不能为空,请输入工位名称", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (tmpInfoLineStation.TestStation && tmpInfoLineStation.TimeOut < 0)
                {
                    All.Window.MetroMessageBox.Show(this, "对不起,输入的超时时间错误,检测工位的时间不能小于0", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                infoLineStations.Add(tmpInfoLineStation);
            }
            bool result = frmMain.mMain.AllDataBase.Local.SaveInfoLineStation(infoLineStations);

            if (result)
            {
                All.Window.MetroMessageBox.Show(this, "所有数据保存完毕,请重新启动程序以应用这些设置", "保存完成", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                All.Window.MetroMessageBox.Show(this, "数据保存失败,请检查数据的正确性后再重新保存", "保存失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }