void process_RepairComponentAdded(RepairComponent obj)
 {
     Process(new MaterialsPartConsumed()
     {
         Part = obj.PartIn, Qty = 1
     });
 }
Exemplo n.º 2
0
        private void undoConsumptionLink_OpenLink(object sender, OpenLinkEventArgs e)
        {
            var transaction = partsUsedView.GetFocusedRow() as Transaction;

            //var rc = from f in m_process.AllProcessFailures
            //         from r in f.Repairs
            //         from c in r.Components.Where(c => c.ConsumptionId == transaction.TransId)
            //         select c;
            //var component = rc.First();

            RepairComponent component = null;

            foreach (var failure in m_process.AllProcessFailures)
            {
                foreach (var repair in failure.Repairs)
                {
                    foreach (var c in repair.Components)
                    {
                        if (c.ConsumptionId == transaction.TransId)
                        {
                            component = c;
                        }
                    }
                }
            }


            if (transaction != null)
            {
                if (MaterialService.UndoMaterialsConsumption(component, transaction))
                {
                    LoadPartsUsed(m_item.LotId);
                }
            }
        }
        void removeLink_Click(object sender, EventArgs e)
        {
            RepairComponent component = componentsView.GetFocusedRow() as RepairComponent;

            if (component != null)
            {
                m_repair.Components.Remove(component);
            }
        }
 public void SetColor(RepairComponent instanz)
 {
     try
     {
         instanz.GetComponent <Renderer>().material.SetColor("_BaseColor", Color.blue);
     }
     catch (System.Exception)
     {
         instanz.transform.GetChild(0).GetComponent <Renderer>().material.SetColor("_BaseColor", Color.blue);
     }
 }
        public bool Undo(RepairComponent rc, Transaction transaction)
        {
            var part = m_repo.Get <Part>(p => p.Id == transaction.Part.Id);
            var sfl  = m_repo.Get <Shopfloorline>(s => s.Label == transaction.DepartLocation);

            var transType = new AdjustmentTransactionType("MATLUNDO", "Service part consumption reversed", "IN");

            ExecutionHelpers.ThrowIfNull(() => rc, "Cannot find repair record for this transaction.");

            rc.ConsumptionId = default(int);

            return(MaterialService.AdjustMaterialConsumableItem
                       (part, sfl, transaction.Qty, "Service part consumption reversed.", transType, null));
        }
    private RepairComponent CreateObject(RepairComponent item, List <SpownPointSpot> listOfPossibleSpownSpots)
    {
        if (listOfPossibleSpownSpots.Count == 0)
        {
            return(null);
        }
        int index           = Random.Range(0, listOfPossibleSpownSpots.Count - 1);
        var _spownTransform = listOfPossibleSpownSpots[index];

        listOfPossibleSpownSpots.RemoveAt(index);
        var instanz = Instantiate <RepairComponent>(item, _spownTransform.transform.position, Quaternion.identity);

        SetColor(instanz);
        return(instanz);
    }
Exemplo n.º 7
0
    /// <summary>
    /// Returns false if the table is full already or the component type already exists.
    /// </summary>
    /// <param name="component"></param>
    /// <returns></returns>
    public bool AddComponentToConstructionPlace(RepairComponent component)
    {
        if (addedComponents.Count < maxAmountOfComponents)
        {
            component.SetUnpickable();
            addedComponents.Add(component);
            component.HideHUD();
            component.transform.SetParent(boxParent);
            component.transform.position = boxParent.position;
            component.transform.rotation = boxParent.rotation;
            component.SetAffectedByGravity(false);
            ChangePhase(ConstructionPhase.Loaded);
            return(true);
        }

        return(false);
    }
Exemplo n.º 8
0
        public static bool UndoMaterialsConsumption(RepairComponent component, Transaction transaction)
        {
            var controller = new ServiceMaterialsInventoryController();

            return(controller.Undo(component, transaction));
        }