예제 #1
0
        private void járművekBeállításaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fuvarTörléseToolStripMenuItem_Click(null, null);
            AppLogger.WriteEvent("Járműbeállítás");

            using (CarDataGridPane grid = new CarDataGridPane(vehicles, summary, false))
            {
                grid.BeforeKapacitasChg += new VoidDelegate(cargrid_BeforeKapacitasChg);
                grid.BeforeElsoFuvarChg += new VoidDelegate(cargrid_BeforeElsoFuvarChg);
                grid.BeforeDelelottChg  += new VoidDelegate(cargrid_BeforeDelelottChg);
                grid.BeforeDelutanChg   += new VoidDelegate(cargrid_BeforeDelutanChg);
                grid.BeforeRowDelete    += new VoidDelegate(cargrid_BeforeRowDelete);

                if (grid.ShowDialog() == DialogResult.OK)
                {
                    FillCarData();
                    Auto activeVeh = (Auto)statview.Tag;

                    remaining          = activeVeh.SzabadCimek(activePeriod);
                    aktualisMenet.Text = remaining.ToString();

                    if (leftTab.SelectedIndex == 0)
                    {
                        UpdateStat();
                    }
                }
            }
        }
예제 #2
0
        private void NapszakSelect()
        {
            try
            {
                if (statview.SelectedRows.Count > 0)
                {
                    partialRepo = fullRepo.GetNapszakAdat(activePeriod);

                    Auto aktivAuto = (Auto)statview.Tag;

                    remaining             = aktivAuto.SzabadCimek(activePeriod);
                    availableWorkTxt.Text = remaining.ToString();

                    browser.Document.InvokeScript("showGroup", new object[] { activePeriod + 1 });
                }

                actualWorkSet.Clear();

                if (leftTab.SelectedIndex == 1)
                {
                    UpdateCimlista();
                }
            }
            catch (Exception ex)
            {
                AppLogger.WriteException(ex);
                AppLogger.WriteEvent("A kivétel elkapva.");
            }
        }
예제 #3
0
        private void statview_SelectionChanged(object sender, EventArgs e)
        {
            Auto sel = null;

            try
            {
                if (vehicles.Count > 0 && statview.SelectedRows.Count > 0)
                {
                    CheckAbandonState();

                    sel = statview.SelectedRows[0].Cells[0].Value == null ? vehicles[0] :
                          findByInfo(statview.SelectedRows[0].Cells[0].Value.ToString());

                    statview.Tag = sel;

                    remaining          = sel.SzabadCimek(activePeriod);
                    aktualisMenet.Text = remaining.ToString();
                    groupCapacity      = sel.Kapacitas;

                    soforinfo.Text = sel.Sofor;
                    segedinfo.Text = sel.Seged;

                    FillSingleCarData();

                    if (infoÜzemmódToolStripMenuItem.Checked)
                    {
                        browser.Document.InvokeScript("showAutoInfo", new object[] { sel.Index });
                    }
                }
            }
            catch (Exception ex)
            {
                AppLogger.WriteException(ex);
                AppLogger.WriteEvent("A kivétel elkapva.");
            }
        }
예제 #4
0
        private void fixateBtn_Click(object sender, EventArgs e)
        {
            if (statview.Tag != null)
            {
                Auto activeVehicle = (Auto)statview.Tag;

                if (actualWorkSet.Count > 0)
                {
                    if (remaining < actualWorkSet.Count)
                    {
                        MessageBox.Show("Az aktív járműnek nincs elég szabad címe a napszakban.\nAz összeszívás nem lehetséges.", "Nincs szabad cím",
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                        fuvarTörléseToolStripMenuItem_Click(null, null);
                        return;
                    }

                    if (groupCapacity > 0)
                    {
                        if (MessageBox.Show("A jármű tartályában " + groupCapacity + " m3-nyi hely maradt.\n Mégis lezárjam a fordulót?",
                                            "Szabad kapacitás maradt", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                            == DialogResult.No)
                        {
                            fuvarTörléseToolStripMenuItem_Click(null, null);
                            return;
                        }
                    }
                    if (groupCapacity < 0)
                    {
                        if (MessageBox.Show("A jármű kapacitása " + (-groupCapacity) + " m3-rel túl van terhelve.\n Mégis lezárjam a fordulót?",
                                            "Túlterhelés", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                            == DialogResult.No)
                        {
                            fuvarTörléseToolStripMenuItem_Click(null, null);
                            return;
                        }
                    }

                    int    dist  = Uthossz(actualWorkSet.ToArray());
                    double limit = activeVehicle.Kapacitas <= WorkData.HatarKapacitas ? Properties.Settings.Default.otkm :
                                   Properties.Settings.Default.tizkm;

                    if (limit > 0 && dist + activeVehicle.OsszTavolsag > limit)
                    {
                        if (MessageBox.Show("A jármű összes km értéke meghaladja a beállított limitet.\nFolytatja?",
                                            "Távolságlimit túllépés", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)
                        {
                            fuvarTörléseToolStripMenuItem_Click(null, null);
                            return;
                        }
                    }

                    WorkData        wd;
                    List <WorkData> workGroup = new List <WorkData>();

                    foreach (int tid in actualWorkSet)
                    {
                        wd = partialRepo[tid];

                        if (wd.Kobmeter != WorkData.HatarKapacitas)
                        {
                            unfive[activePeriod]--;
                            smallM3        -= wd.Kobmeter;
                            kism3Unmap.Text = smallM3.ToString();
                        }
                        else
                        {
                            unbig[activePeriod]--;
                            bigM3           -= wd.Kobmeter;
                            nagym3Unmap.Text = bigM3.ToString();
                        }

                        workGroup.Add(wd);


                        AppLogger.WriteMapping(activeVehicle.Rendszam, wd.Cim);

                        browser.Document.InvokeScript("hide", new object[] { tid, activeVehicle.Index, activeVehicle.NapszakForduloSzam(activePeriod) + 1 });
                    }

                    if (actualWorkSet.Count > 0)
                    {
                        savedState++;
                        activeVehicle.AddFuvar(workGroup, dist);

                        remaining          = activeVehicle.SzabadCimek(activePeriod);
                        aktualisMenet.Text = remaining.ToString();

                        groupCapacity = activeVehicle.Kapacitas;

                        foreach (int id in actualWorkSet)
                        {
                            RestoreJunction(id);
                        }

                        FillSingleCarData();
                    }
                    unFiveLabel[activePeriod].Text = unfive[activePeriod].ToString();
                    unBigLabel[activePeriod].Text  = unbig[activePeriod].ToString();

                    if (leftTab.SelectedIndex == 0)
                    {
                        UpdateStat();
                    }
                    else
                    {
                        UpdateCimlista();
                    }
                }
            }

            actualWorkSet.Clear();
            clickedGroup.Items.Clear();
        }