protected void SetUp()
        {
            _plant1 = Substitute.For <IPlant>();
            _plant1.Name.Returns(PLANT1_NAME);
            IMes            mes1 = Substitute.For <IMes>();
            ISchedulePlants isp1 = Substitute.For <ISchedulePlants>();

            _plant1.Mes.Returns(mes1);
            _plant1.PlantScheduler.Returns(isp1);
            _plant1.Workcenters.Returns(new List <IAcceptWorkorders>());

            _plant2 = Substitute.For <IPlant>();
            _plant2.Name.Returns(PLANT2_NAME);
            IMes            mes2 = Substitute.For <IMes>();
            ISchedulePlants isp2 = Substitute.For <ISchedulePlants>();

            _plant2.Mes.Returns(mes2);
            _plant2.PlantScheduler.Returns(isp2);
            _plant2.Workcenters.Returns(new List <IAcceptWorkorders>());

            List <IPlant> list = new List <IPlant>()
            {
                _plant1, _plant2
            };

            _subject = new Erp(ERP_NAME);
            _subject.Add(_plant1);
            _subject.Add(_plant2);
        }
Exemple #2
0
        private void ComboBox1_Leave(object sender, EventArgs e)
        {
            try
            {
                if (ComboBox1.Text == "")
                {
                    Erp.SetError(ComboBox1, "Type the File Name First..." +
                                 "Name Should Be More Than 5 Characters");
                    return;
                }

                if (ComboBox1.Text.Length <= 4)
                {
                    Erp.SetError(ComboBox1, "Type the File Name First..." +
                                 "Name Should Be More Than 5 Characters");
                    ComboBox1.Focus();
                    ComboBox1.Text = "";
                    return;
                }

                Common.FormatCombo(ComboBox1);

                if (ComboBox1.Text.Length > 4)
                {
                    switch ((ComboBox1.Text.Substring(0, 4)))
                    {
                    case "ENG_":
                        ComboBox1.Text = "eng_" + (ComboBox1.Text.Substring(4)).ToLower();
                        Erp.Clear();
                        break;

                    case "Eng_":
                        ComboBox1.Text = "eng_" + (ComboBox1.Text.Substring(4)).ToLower();
                        Erp.Clear();
                        break;

                    case "eng_":
                        ComboBox1.Text = "eng_" + (ComboBox1.Text.Substring(4)).ToLower();
                        Erp.Clear();
                        break;

                    default:
                        ComboBox1.Text = "eng_" + ComboBox1.Text.ToLower();
                        Erp.Clear();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("ComboBox1_Leave @ " + ex.Message);
            }
        }
Exemple #3
0
        public void Work(DayTime dayTime)
        {
            if (!_nextDump.Equals(dayTime))
            {
                return;
            }

            foreach (Change change in Changes)
            {
                if (change.IsAddToPlant)
                {
                    Erp.Receive(change.Woid, Name);
                }
                else
                {
                    Erp.Ship(change.Woid, Name);
                }
            }

            _nextDump = NextDumpTime(dayTime);
        }
Exemple #4
0
        private void mnuSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (ComboBox1.Text == "")
                {
                    Erp.SetError(ComboBox1, "Type the File Name First..." +
                                 "Name Should Be More Than 5 Characters");
                    return;
                }
                int x;
                for (x = 0; x <= (EngGView.RowCount - 1); x++)
                {
                    if (ComboBox1.Text == EngGView[0, x].Value.ToString())
                    {
                        flg_New = false;
                        break;
                    }
                    else
                    {
                        flg_New = true;
                    }
                }
                String strData = "";

                if (ComboBox1.Text == "")
                {
                    ComboBox1.Text = " ";
                }



                strData = strData + ComboBox1.Text + "', '";
                strData = strData + "Diesel";


                for (x = 1; x <= (EngGView.Columns.Count - 2); x++)
                {
                    if ((DataGrid[1, x].Value) == null)
                    {
                        DataGrid[1, x].Value = "***";
                    }
                    strData = strData + "', '" + DataGrid[1, x].Value.ToString();
                }

                if (flg_New == false)
                {
                    Common.Del_SqlTable("systb", ComboBox1.Text);
                    //MySqlCommand cDelete = new MySqlCommand();
                    //cDelete.CommandText = "DELETE FROM tblEngine WHERE EngineFile = '" + ComboBox1.Text.ToLower()  + "'";
                    //Common.Open_Connection("gen_db", "con");
                    //cDelete.Connection = Common.con;
                    //cDelete.ExecuteNonQuery();
                }

                Common.Open_Connection("gen_db", "con");
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = " INSERT INTO tblEngine VALUES ('" + strData + "')";
                cmd.Connection  = Common.con;
                cmd.ExecuteNonQuery();
                MessageBox.Show("File saved .....");
                Common.Create_OnLog("Normal", "Engine File Saved.....");
                Load_Datagrid();
            }
            catch (Exception ex)
            {
                MessageBox.Show("mnuSave_Click @ Error Code:-11007 " + ex.Message);
                Common.Create_OnLog("Alart", "Engine File  not Saved.....");
            }
        }