Пример #1
0
        public void AddUsage(RepairObject repairObject, DateTime start, DateTime end, int usage)
        {
            //todo проверить не вводилась ли наработка за этот период ранее

            //Добавить запись в журнал наработки
            var newUsage = new UsageActual()
            {
                Object = repairObject,
                Start  = start,
                End    = end,
                Usage  = usage
            };

            repository.Save(newUsage);

            //Добавить наработку в последние ремонты
            var lastMaintenance = query.FindLastMaintenanceByObjectId(repairObject.Id);

            lastMaintenance.ToList().ForEach(last =>
            {
                last.AddUsage(usage);
                repository.Save(last);
            });

            //Добавить наработку с начала эксплуатации
            repairObject.UsageFromStartup += usage;
            repository.Save(repairObject);
        }
Пример #2
0
        private void btnEmployee_Click(object sender, EventArgs e)
        {
            string Jobss = txtJobID.Text;

            string EmpIDss = txtEmployeeID.Text;

            if (Jobss == "" || EmpIDss == "")
            {
                MessageBox.Show("Please fill the all required feilds");
            }
            else
            {
                RepairObject objRepair = new RepairObject();

                EmployeeObject objEmployee = new EmployeeObject();

                objEmployee.empid = Convert.ToInt32(txtEmployeeID.Text);

                objRepair.JobID = Convert.ToInt32(txtJobID.Text);

                DialogResult dr;
                dr = MessageBox.Show("Do you want to save the record", "Confirm", MessageBoxButtons.YesNo);
                if (dr.ToString() == "Yes")
                {
                    try
                    {
                        MegaCoolMethods mcm = new MegaCoolMethods();


                        bool result = mcm.EmpRepair(objRepair, objEmployee);

                        if (result)
                        {
                            MessageBox.Show("Successfully Saved", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);


                            RepairEmpFillGrid();

                            RepairEmpCurrentFillGrid();

                            txtEmployeeID.Clear();
                        }
                        else
                        {
                            MessageBox.Show("Unable to Save", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }


                    catch (Exception ex)
                    {
                        MessageBox.Show("" + ex);
                    }
                }
                else
                {
                    MessageBox.Show("Record is not saved", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Пример #3
0
        private void btnReleaseEmp_Click(object sender, EventArgs e)
        {
            string Jobss = txtJobID.Text;

            string EmpIDss = txtEmployeeID.Text;

            if (Jobss == "" || EmpIDss == "")
            {
                MessageBox.Show("Please fill the all required feilds");
            }
            else
            {
                //  string EmployeeID = txtEmployeeID.Text;

                //  string JobID = txtJobID.Text;
                RepairObject objRepair = new RepairObject();

                EmployeeObject objEmployee = new EmployeeObject();

                objEmployee.empid = Convert.ToInt32(txtEmployeeID.Text);

                objRepair.JobID = Convert.ToInt32(txtJobID.Text);



                DialogResult dr;

                dr = MessageBox.Show("Do you want to Release this Employee", "Confirm", MessageBoxButtons.YesNo);

                MegaCoolMethods mcm = new MegaCoolMethods();

                bool result = mcm.ReleaseEmployee(objRepair, objEmployee);

                if (dr.ToString() == "Yes")
                {
                    if (result)
                    {
                        MessageBox.Show("Employee Released", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        RepairEmpCurrentFillGrid();
                        RepairEmpFillGrid();

                        txtEmployeeID.Clear();
                    }
                    else
                    {
                        MessageBox.Show("Unable to Delete", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Record is not deleted", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Пример #4
0
    // Use this for initialization
    protected virtual void Awake()
    {
        animator = gameObject.GetComponent <Animator>();

        myCharacterSprite = gameObject.GetComponent <SpriteRenderer>();

        RepairShowObject = GameObject.Find("TouchPad").GetComponent <RepairObject>();

        animator = GetComponent <Animator> ();

        playerData = GameManager.Instance.player;
    }
Пример #5
0
        protected override void Build(IRepository repository)
        {
            new SpecificationFactory(repository);
            new MaintenanceTypeFactory(repository);
            new MeasureUnitFactory(repository);

            var ts = new RepairObjectGroup {
                Name = "Транспортные средства"
            };

            ts.AddSpecification(new GroupSpecification(SpecificationFactory.RegistrationNumber));
            ts.AddSpecification(new GroupSpecification(SpecificationFactory.EngineVolume));

            var cars = new RepairObjectGroup {
                Name = "Легковые автомобили"
            };
            var engine_1_8 = new RepairObjectGroup {
                Name = "Объём двигателя от 1,8 л до 3,5 л"
            };

            cars.AddChild(engine_1_8);
            ts.AddChild(cars);

            repository.Save(ts);
            repository.Save(cars);
            repository.Save(engine_1_8);

            //Интервал ТО-1 10 ткм, либо 1 раз в 2 года
            var Interval_TO1 = new MaintenanceInterval(
                engine_1_8,
                MaintenanceTypeFactory.TO1_Repair,
                TimePeriod.Year, 2,
                MeasureUnitFactory.Km, 10000
                );

            //Интервал ТО-2 20 ткм
            var Interval_TO2 = new MaintenanceInterval(
                engine_1_8,
                MaintenanceTypeFactory.TO2_Repair,
                MeasureUnitFactory.Km,
                20000
                );

            repository.Save(Interval_TO1);
            repository.Save(Interval_TO2);

            Car = new RepairObject(engine_1_8, "999", DateTime.Now);
            repository.Save(Car);
        }
Пример #6
0
        public void PlanningMaintenance(RepairObject repairObject, DateTime start, DateTime end)
        {
            var intervals = query.FindMaintenanceIntervalsByObjectId(repairObject.Id);
            var last      = query.FindLastMaintenanceByObjectId(repairObject.Id);

            var intervalType = intervals.First().IntervalType;

            switch (intervalType)
            {
            case MaintenanceIntervalType.ByTime:
            {
                break;
            }

            case MaintenanceIntervalType.ByUsage:
            {
                var usagePlanned = query.FindUsagePlannedByObjectId(repairObject.Id);

                //Исходя из плановой наработки нужно расчитать сколько ему осталось до ремонта
                intervals.OrderByDescending(x => x.Quantity).ToList().ForEach(x =>
                    {
                    });


                break;
            }

            default:
            {
                throw new Exception("Не задан расчёт графика ППР для данного типа интервала");
            }
            }


            if (intervalType == MaintenanceIntervalType.ByUsage)
            {
            }

            intervals.OrderByDescending(x => x.Quantity).ToList().ForEach(x =>
            {
            });


            //Посмотреть межремонтные интервалы
            //Если подходит ремонт, то добавить запись в график ППР

            throw new NotImplementedException();
        }
Пример #7
0
    public override void Init(int _nDay, Player _player)
    {
        fValue = 0.3f;

        nCostDay = _nDay;

        nDightDay = (int)(nCostDay * fDivisionDay);

        nIndex = (int)E_EPIC_INDEX.E_EPIC_FREEZING_TUNA;

        cPlayerData = _player;

        RepairShowObject = GameObject.Find("RepairPanel").GetComponentInChildren <RepairObject>();

        fValue += fValue * nDightDay * fDivisionDay;

        strExplain = string.Format("현재 남은 물 1%마다 수리력 {0}% 증가", fValue);
    }
Пример #8
0
    public override void Init(int _nDay, Player _player)
    {
        fValue = 50f;

        nIndex = (int)E_EPIC_INDEX.E_EPIC_ENGINE_HAMMER;

        nCostDay = _nDay;

        nDightDay = (int)(nCostDay * fDivisionDay);

        cPlayerData = _player;

        fValue += fValue * nDightDay * fDivisionDay;

        RepairShowObject = GameObject.Find("RepairPanel").GetComponentInChildren <RepairObject>();

        strExplain = string.Format("온도 70% 도달시 크리데미지 {0}%증가 온도 30% 이하일 때 효과 삭제", fValue);
    }
    private void OnTriggerStay(Collider other)
    {
        GameObject otherGO = other.gameObject;

        if (string.Equals(otherGO.tag, "Repairable"))
        {
            if (Input.GetButton("Repair") && (!isHolding))
            {
                if (currentPickupCooldown <= 0f)
                {
                    Repair.clip = repairSFX[Random.Range(0, repairSFX.Length)];
                    Repair.Play();
                    RepairObject repairO = otherGO.GetComponent <RepairObject>();
                    repairO.sendRepairs(playerRepairAmount);
                    currentPickupCooldown = playerRepairCooldown;
                }
            }
        }
        if (string.Equals(otherGO.tag, "Pickupable"))
        {
            if (Input.GetButton("Pickup") && (!isHolding) && (currentPickupCooldown <= 0f))
            {
                otherGO.transform.position = pickupLocation.transform.position;
                heldObject = otherGO;
                heldObject.GetComponent <Rigidbody>().isKinematic = true;
                isHolding = true;
                Pickup.Play();
                currentPickupCooldown = playerPickupCooldown;
                InkAmount cart = heldObject.GetComponent <InkAmount>();
                if (snapLocation != null)
                {
                    snapLocation.GetComponent <InkPlacement>().removeCartrigeObject();
                }
                otherGO.transform.parent = pickupLocation.transform;
                if (cart != null)
                {
                    cart.RemoveSelf();
                }
                Material mat = heldObject.GetComponent <Renderer>().material;
                SetFade(mat);
                mat.color = new Color(mat.color.r, mat.color.g, mat.color.b, .5f);
            }
        }
    }
Пример #10
0
        private void btnReInv_Click(object sender, EventArgs e)
        {
            RepairObject objRepair = new RepairObject();

            //    objRepair.JobID = Convert.ToInt32(txtJobID2.Text);

            string jobIDss = txtJobID2.Text;

            if (jobIDss == "")
            {
                MessageBox.Show("Please Enter the Job ID");
            }

            else
            {
                int JobID = objRepair.JobID;

                RepairInventoryFillGrid();
            }
        }
Пример #11
0
        public void AddMaintenance(
            RepairObject repairObject,
            MaintenanceType maintenanceType,
            DateTime start,
            DateTime?end,
            MaintenanceReason unplannedReason
            )
        {
            //Добавить запись в журнал обслуживания
            var maintenance = new MaintenanceActual()
            {
                Type            = maintenanceType,
                Start           = start,
                Object          = repairObject,
                UnplannedReason = unplannedReason
            };

            repository.Save(maintenance);

            if (end != null)
            {
                FinalizeMaintenance(maintenance, end.Value);
            }
        }
Пример #12
0
        protected override void Build(IRepository repository)
        {
            new MaintenanceTypeFactory(repository);
            new SpecificationFactory(repository);
            new MeasureUnitFactory(repository);

            var eMotors = new RepairObjectGroup {
                Name = "Электродвигатели"
            };
            var eMotorType = new RepairObjectGroup {
                Name = "ЭД синхронный с к.з. ротором"
            };
            var eMotorModel = new RepairObjectGroup {
                Name = "1AN3R-355Z-6"
            };

            eMotors.AddChild(eMotorType);
            eMotorType.AddChild(eMotorModel);

            var interval_T = new MaintenanceInterval(
                eMotorType,
                MaintenanceTypeFactory.T_Repair,
                MeasureUnitFactory.WorkHours,
                8000,
                8760,
                12
                );

            var interval_C = new MaintenanceInterval(
                eMotorType,
                MaintenanceTypeFactory.C_Repair,
                MeasureUnitFactory.WorkHours,
                42000,
                43800,
                2
                );

            var interval_K = new MaintenanceInterval(
                eMotorType,
                MaintenanceTypeFactory.K_Repair,
                MeasureUnitFactory.WorkHours,
                130000,
                131400,
                1
                );

            repository.Save(interval_T);
            repository.Save(interval_C);
            repository.Save(interval_K);

            eMotors.AddSpecification(new GroupSpecification(SpecificationFactory.Power));
            eMotors.AddSpecification(new GroupSpecification(SpecificationFactory.RPM));

            repository.Save(eMotors);

            var eMotor = new RepairObject(eMotorModel, "К-401В", DateTime.Now)
            {
                FactoryNumber   = "3452",
                InventoryNumber = "123456678"
            };

            eMotor.AddSpecification(new ObjectSpecification(SpecificationFactory.Execution, "1"));

            ElectroMotor = eMotor;
        }
Пример #13
0
        private void btnAddEmployee_Click(object sender, EventArgs e)
        {
            if (txtCus.Text == "" || comboBoxR_Type.Text == "" || txtDetails.Text == "" || comboSupervisor.Text == "")
            {
                MessageBox.Show("Please fill the all required feilds");
            }
            else
            {
                RepairObject objRepair = new RepairObject();

                CustomerObject objCustomer = new CustomerObject();

                EmployeeObject objEmployee = new EmployeeObject();

                objCustomer.Nic = txtCus.Text;

                objRepair.JobStartDate = dtpStart.Value;

                objRepair.JobEndDate = dtpEnd.Value;

                objRepair.rType = comboBoxR_Type.Text;

                objRepair.Details = txtDetails.Text;

                objEmployee.empid = Convert.ToInt32(comboSupervisor.Text);



                bool checker1 = false;

                bool checker2 = false;



                if (objRepair.JobStartDate >= DateTime.Today)
                {
                    checker1 = true;
                }

                if (objRepair.JobEndDate >= DateTime.Today)
                {
                    checker2 = true;
                }

                if (checker1 == false || checker2 == false)
                {
                    MessageBox.Show("You cant enter this date");
                }
                else
                {
                    string nic = txtCus.Text;

                    if ((nic.Count(char.IsDigit) == 9) && nic.EndsWith("v", StringComparison.OrdinalIgnoreCase))
                    {
                        DialogResult dr;
                        dr = MessageBox.Show("Do you want to save the record", "Confirm", MessageBoxButtons.YesNo);
                        if (dr.ToString() == "Yes")
                        {
                            try
                            {
                                MegaCoolMethods mcm = new MegaCoolMethods();


                                bool result = mcm.AddNewRepairJob(objRepair, objCustomer, objEmployee);

                                if (result)
                                {
                                    MessageBox.Show("Successfully Saved", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);


                                    RepairFillGrid();

                                    avCusFillGrid();

                                    tabControl1.SelectedTab = tabPage2;
                                }
                                else
                                {
                                    MessageBox.Show("Unable to Save", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                            catch (ApplicationException appEx)
                            {
                                MessageBox.Show(appEx.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }

                            catch (Exception ex)
                            {
                                throw ex;
                            }
                        }
                        else
                        {
                            MessageBox.Show("Record is not saved", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }

                    else
                    {
                        MessageBox.Show("Error in NIC");
                    }
                }
            }
        }
Пример #14
0
        private void btnUpdateJob_Click(object sender, EventArgs e)
        {
            RepairObject objRepair = new RepairObject();

            EmployeeObject objEmployee = new EmployeeObject();



            objRepair.rType = comboBoxR_Type.Text;

            objRepair.JobEndDate = dtpEnd.Value;

            objRepair.Details = txtDetails.Text;

            string JobIDss = txtJobID3.Text;

            string Superviss = comboSupervisor.Text;

            if (JobIDss == "" || objRepair.rType == "" || txtDetails.Text == "" || comboSupervisor.Text == "")
            {
                MessageBox.Show("Please fill the all required feilds");
            }
            else
            {
                bool checker = false;



                if (objRepair.JobEndDate >= DateTime.Today)
                {
                    checker = true;
                }

                if (checker == false)
                {
                    MessageBox.Show("You cant enter this date");
                }
                else
                {
                    objRepair.JobID = Convert.ToInt32(txtJobID3.Text);

                    objEmployee.empid = Convert.ToInt32(comboSupervisor.Text);

                    DialogResult dr;
                    dr = MessageBox.Show("Do you want to save the record", "Confirm", MessageBoxButtons.YesNo);
                    if (dr.ToString() == "Yes")
                    {
                        try
                        {
                            MegaCoolMethods mcm = new MegaCoolMethods();


                            bool result = mcm.UpdateRepairJob(objEmployee, objRepair);

                            if (result)
                            {
                                MessageBox.Show("Successfully Saved", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);

                                RepairUpdateFillGrid();

                                RepairFillGrid();
                            }
                            else
                            {
                                MessageBox.Show("Unable to Save", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }


                        catch (Exception ex)
                        {
                            MessageBox.Show("" + ex);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Record is not saved", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }
Пример #15
0
        private void btnAddItem_Click(object sender, EventArgs e)
        {
            RepairObject objRepair = new RepairObject();

            StockObject objStock = new StockObject();

            objStock.inventoryID = cbInventID.Text;

            objRepair.ItemNo = txtItemNO.Text;

            if (objStock.inventoryID == "" || txtJobID2.Text == "" || txtItemNO.Text == "" || txtCost.Text == "")
            {
                MessageBox.Show("Please fill the all required feilds");
            }
            else
            {
                objRepair.JobID = Convert.ToInt32(txtJobID2.Text);

                objStock.sellingPrice = Convert.ToDouble(txtCost.Text);

                DialogResult dr;
                dr = MessageBox.Show("Do you want to save the record", "Confirm", MessageBoxButtons.YesNo);
                if (dr.ToString() == "Yes")
                {
                    try
                    {
                        MegaCoolMethods mcm = new MegaCoolMethods();


                        bool result = mcm.RepairInventory(objRepair, objStock);

                        if (result)
                        {
                            MessageBox.Show("Successfully Saved", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);


                            RepairFillGrid();

                            RepairInvFillGrid();

                            RepairInventoryFillGrid();
                        }
                        else
                        {
                            MessageBox.Show("Unable to Save", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    catch (ApplicationException appEx)
                    {
                        MessageBox.Show(appEx.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
                else
                {
                    MessageBox.Show("Record is not saved", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Пример #16
0
    }                                                                                                           //보스 끝

    void Awake()
    {
        repairObj = FindObjectOfType <RepairObject> ();
    }