public void SetMachine(WrapperForEntities.Resource resource) { if (_productionOrderOperation.IsReadOnly) { throw new MrpRunException("A readOnly entity cannot be changed anymore."); } _productionOrderOperation.ResourceId = resource.GetValue().Id; _productionOrderOperation.Resource = resource.GetValue(); }
private void EnsureMachineIsLoaded() { if (_productionOrderOperation.Resource == null) { if (_productionOrderOperation.ResourceId == null) { throw new MrpRunException( "Cannot load Machine, if this operation is not yet planned."); } Id resourceId = new Id(_productionOrderOperation.ResourceId.GetValueOrDefault()); IDbMasterDataCache dbMasterDataCache = ZppConfiguration.CacheManager.GetMasterDataCache(); WrapperForEntities.Resource resource = dbMasterDataCache.M_ResourceGetById(resourceId); _productionOrderOperation.Resource = resource.GetValue(); } }