public void EnsureCompatibleUnit(IExtendedMaterialModel material, IMaterialUnit unit) { if (!m_conversionHelper.AreCompatible(material.NominalUnit.Id, unit.Id)) { throw new InvalidOperationException($"Jednotku '{unit.Symbol}' nelze použít pro materiál '{material.Name}'"); } }
public MaterialComponent(IMaterialUnit unit, IExtendedMaterialModel material, decimal amount, int?compositionId) { Unit = unit; Material = material; Amount = amount; CompositionId = compositionId; }
public CompositionViewModel(IExtendedMaterialModel material, decimal amount, IMaterialUnit unit, int depth) { Material = material; Amount = amount; Unit = unit; Depth = depth; }
private IMaterialThreshold CreateFakeThreshold(IExtendedMaterialModel material, Amount amount) { return(new DefaultThreshold() { Material = material.Adaptee, MaterialId = material.Id, Unit = amount.Unit, UnitId = amount.Unit.Id, ThresholdQuantity = amount.Value * 2m }); }
private MaterialSetupInfo MapMaterialInfo(IExtendedMaterialModel material, List <string> takenNames = null) { var model = new MaterialSetupInfo { MaterialId = material.Id, PreferredUnitSymbol = material.Adaptee.NominalUnit.Symbol, IsManufactured = material.IsManufactured, MaterialName = material.Name, RequiresInvoice = material.RequiresInvoice, RequiresPrice = material.RequiresInvoice, AutomaticBatches = material.AutomaticBatches, RequiresSupplierReference = material.RequiresSupplierReference, Autofinalization = material.Autofinalization, CanBeDigital = material.CanBeDigital }; if (material.AutomaticBatches) { var baseName = $"{StringUtil.ConvertToBaseText(material.Name, '_', '_', 3)}_{DateTime.Now:yyyyMMdd}"; var versionedName = baseName; if (takenNames != null && !takenNames.Contains(versionedName)) { model.AutoBatchNr = versionedName; } else { for (var i = 1;; i++) { var e = m_database.SelectFrom <IMaterialBatch>() .Where(b => b.BatchNumber == versionedName) .Take(1) .Execute() .FirstOrDefault(); if (e == null) { break; } versionedName = $"{baseName}.{i}"; } model.AutoBatchNr = versionedName; } takenNames?.Add(versionedName); } return(model); }
public MaterialInfo(IExtendedMaterialModel m) { Id = m.Id; Name = m.Name; }
public MaterialCompositionInfo(IExtendedMaterialModel m) : base(m) { }