public bool ValidUpdateObject(RollerBuilder rollerBuilder, IRollerBuilderService _rollerBuilderService, IMachineService _machineService, IUoMService _uomService, IItemService _itemService, ICoreBuilderService _coreBuilderService, IRollerTypeService _rollerTypeService) { rollerBuilder.Errors.Clear(); VUpdateObject(rollerBuilder, _rollerBuilderService, _machineService, _uomService, _itemService, _coreBuilderService, _rollerTypeService); return(isValid(rollerBuilder)); }
public CoreIdentification VConfirmObject(CoreIdentification coreIdentification, ICoreIdentificationDetailService _coreIdentificationDetailService, ICoreBuilderService _coreBuilderService, IItemService _itemService, IWarehouseItemService _warehouseItemService) { VHasConfirmationDate(coreIdentification); if (!isValid(coreIdentification)) { return(coreIdentification); } VHasCoreIdentificationDetails(coreIdentification, _coreIdentificationDetailService); if (!isValid(coreIdentification)) { return(coreIdentification); } VQuantityEqualNumberOfDetails(coreIdentification, _coreIdentificationDetailService); if (!isValid(coreIdentification)) { return(coreIdentification); } VHasNotBeenConfirmed(coreIdentification); if (!isValid(coreIdentification)) { return(coreIdentification); } VQuantityIsInStock(coreIdentification, _coreIdentificationDetailService, _coreBuilderService, _itemService, _warehouseItemService); return(coreIdentification); }
public bool ValidConfirmObject(CoreIdentification coreIdentification, ICoreIdentificationDetailService _coreIdentificationDetailService, ICoreBuilderService _coreBuilderService, IItemService _itemService, IWarehouseItemService _warehouseItemService) { coreIdentification.Errors.Clear(); VConfirmObject(coreIdentification, _coreIdentificationDetailService, _coreBuilderService, _itemService, _warehouseItemService); return(isValid(coreIdentification)); }
public CoreIdentificationDetail CreateObject(CoreIdentificationDetail coreIdentificationDetail, ICoreIdentificationService _coreIdentificationService, ICoreBuilderService _coreBuilderService, IRollerTypeService _rollerTypeService, IMachineService _machineService) { coreIdentificationDetail.Errors = new Dictionary <String, String>(); return(_validator.ValidCreateObject(coreIdentificationDetail, _coreIdentificationService, this, _coreBuilderService, _rollerTypeService, _machineService) ? _repository.CreateObject(coreIdentificationDetail) : coreIdentificationDetail); }
public CoreIdentificationDetail UnfinishObject(CoreIdentificationDetail coreIdentificationDetail, ICoreIdentificationService _coreIdentificationService, ICoreBuilderService _coreBuilderService, IStockMutationService _stockMutationService, IItemService _itemService, IBarringService _barringService, IWarehouseItemService _warehouseItemService) { if (_validator.ValidUnfinishObject(coreIdentificationDetail, _coreIdentificationService, this, _coreBuilderService, _warehouseItemService)) { CoreIdentification coreIdentification = _coreIdentificationService.GetObjectById(coreIdentificationDetail.CoreIdentificationId); if (coreIdentification.ContactId != null) { // reduce contact core int MaterialCase = coreIdentificationDetail.MaterialCase; Item item = (MaterialCase == Core.Constants.Constant.MaterialCase.New ? _coreBuilderService.GetNewCore(coreIdentificationDetail.CoreBuilderId) : _coreBuilderService.GetUsedCore(coreIdentificationDetail.CoreBuilderId)); WarehouseItem warehouseItem = _warehouseItemService.FindOrCreateObject(coreIdentification.WarehouseId, item.Id); IList <StockMutation> stockMutations = _stockMutationService.SoftDeleteStockMutationForCoreIdentification(coreIdentificationDetail, warehouseItem); foreach (var stockMutation in stockMutations) { _stockMutationService.ReverseStockMutateObject(stockMutation, _itemService, _barringService, _warehouseItemService); } } _repository.UnfinishObject(coreIdentificationDetail); } return(coreIdentificationDetail); }
public RollerBuilder SoftDeleteObject(RollerBuilder rollerBuilder, IItemService _itemService, IRecoveryOrderDetailService _recoveryOrderDetailService, ICoreBuilderService _coreBuilderService, IWarehouseItemService _warehouseItemService, IStockMutationService _stockMutationService, IItemTypeService _itemTypeService) { Item RollerUsedCore = _itemService.GetObjectById(rollerBuilder.RollerUsedCoreItemId); Item RollerNewCore = _itemService.GetObjectById(rollerBuilder.RollerNewCoreItemId); if (_itemService.GetValidator().ValidDeleteLegacyObject(RollerUsedCore, _stockMutationService, _itemTypeService, _warehouseItemService) && _itemService.GetValidator().ValidDeleteLegacyObject(RollerUsedCore, _stockMutationService, _itemTypeService, _warehouseItemService)) { if (_validator.ValidDeleteObject(rollerBuilder, _recoveryOrderDetailService)) { _itemService.GetRepository().SoftDeleteObject(RollerUsedCore); _itemService.GetRepository().SoftDeleteObject(RollerNewCore); _repository.SoftDeleteObject(rollerBuilder); } } else { if (RollerUsedCore.Errors.Count() > 0) { rollerBuilder.Errors.Add(RollerUsedCore.Errors.First().Key, RollerUsedCore.Errors.First().Value); } else if (RollerNewCore.Errors.Count() > 0) { rollerBuilder.Errors.Add(RollerNewCore.Errors.First().Key, RollerNewCore.Errors.First().Value); } else { rollerBuilder.Errors.Add("Generic", "Item tidak dapat di hapus"); } } return(rollerBuilder); }
public Item GetCore(CoreIdentificationDetail coreIdentificationDetail, ICoreBuilderService _coreBuilderService) { Item core = (coreIdentificationDetail.MaterialCase == Core.Constants.Constant.MaterialCase.New) ? _coreBuilderService.GetNewCore(coreIdentificationDetail.CoreBuilderId) : _coreBuilderService.GetUsedCore(coreIdentificationDetail.CoreBuilderId); return(core); }
public Item GetCore(RecoveryOrderDetail recoveryOrderDetail, ICoreIdentificationDetailService _coreIdentificationDetailService, ICoreBuilderService _coreBuilderService, IItemService _itemService) { CoreIdentificationDetail coreIdentificationDetail = _coreIdentificationDetailService.GetObjectById(recoveryOrderDetail.CoreIdentificationDetailId); Item core = (coreIdentificationDetail.MaterialCase == Core.Constants.Constant.MaterialCase.New) ? _coreBuilderService.GetNewCore(coreIdentificationDetail.CoreBuilderId) : _coreBuilderService.GetUsedCore(coreIdentificationDetail.CoreBuilderId); return(core); }
public RollerBuilder VHasCoreBuilder(RollerBuilder rollerBuilder, ICoreBuilderService _coreBuilderService) { CoreBuilder coreBuilder = _coreBuilderService.GetObjectById(rollerBuilder.CoreBuilderId); if (coreBuilder == null) { rollerBuilder.Errors.Add("CoreBuilderId", "Tidak terasosiasi dengan coreBuilder"); } return(rollerBuilder); }
public CoreBuilder VHasUniqueBaseSku(CoreBuilder coreBuilder, ICoreBuilderService _coreBuilderService) { if (String.IsNullOrEmpty(coreBuilder.BaseSku) || coreBuilder.BaseSku.Trim() == "") { coreBuilder.Errors.Add("BaseSku", "Tidak boleh kosong"); } else if (_coreBuilderService.IsBaseSkuDuplicated(coreBuilder)) { coreBuilder.Errors.Add("BaseSku", "Tidak boleh diduplikasi"); } return(coreBuilder); }
public MstRollerBuilderController() { _coreBuilderService = new CoreBuilderService(new CoreBuilderRepository(), new CoreBuilderValidator()); _itemTypeService = new ItemTypeService(new ItemTypeRepository(), new ItemTypeValidator()); _rollerBuilderService = new RollerBuilderService(new RollerBuilderRepository(), new RollerBuilderValidator()); _recoveryOrderDetailService = new RecoveryOrderDetailService(new RecoveryOrderDetailRepository(), new RecoveryOrderDetailValidator()); _warehouseItemService = new WarehouseItemService(new WarehouseItemRepository(), new WarehouseItemValidator()); _stockMutationService = new StockMutationService(new StockMutationRepository(), new StockMutationValidator()); _itemService = new ItemService(new ItemRepository(), new ItemValidator()); _uomService = new UoMService(new UoMRepository(), new UoMValidator()); _warehouseService = new WarehouseService(new WarehouseRepository(), new WarehouseValidator()); _machineService = new MachineService(new MachineRepository(), new MachineValidator()); _rollerTypeService = new RollerTypeService(new RollerTypeRepository(), new RollerTypeValidator()); }
public CoreBuilder VCreateObject(CoreBuilder coreBuilder, ICoreBuilderService _coreBuilderService, IUoMService _uomService, IItemService _itemService) { VHasUniqueBaseSku(coreBuilder, _coreBuilderService); if (!isValid(coreBuilder)) { return(coreBuilder); } VNameNotEmpty(coreBuilder); if (!isValid(coreBuilder)) { return(coreBuilder); } VHasUoM(coreBuilder, _uomService); return(coreBuilder); }
public CoreBuilder VUpdateObject(CoreBuilder coreBuilder, ICoreBuilderService _coreBuilderService, IUoMService _uomService, IItemService _itemService) { VCreateObject(coreBuilder, _coreBuilderService, _uomService, _itemService); if (!isValid(coreBuilder)) { return(coreBuilder); } VHasUsedCoreItem(coreBuilder, _itemService); if (!isValid(coreBuilder)) { return(coreBuilder); } VHasNewCoreItem(coreBuilder, _itemService); return(coreBuilder); }
public RollerBuilder VUpdateObject(RollerBuilder rollerBuilder, IRollerBuilderService _rollerBuilderService, IMachineService _machineService, IUoMService _uomService, IItemService _itemService, ICoreBuilderService _coreBuilderService, IRollerTypeService _rollerTypeService) { VCreateObject(rollerBuilder, _rollerBuilderService, _machineService, _uomService, _itemService, _coreBuilderService, _rollerTypeService); if (!isValid(rollerBuilder)) { return(rollerBuilder); } VHasRollerUsedCoreItem(rollerBuilder, _itemService); if (!isValid(rollerBuilder)) { return(rollerBuilder); } VHasRollerNewCoreItem(rollerBuilder, _itemService); return(rollerBuilder); }
public RollerWarehouseMutationController() { _itemService = new ItemService(new ItemRepository(), new ItemValidator()); _warehouseItemService = new WarehouseItemService(new WarehouseItemRepository(), new WarehouseItemValidator()); _stockMutationService = new StockMutationService(new StockMutationRepository(), new StockMutationValidator()); _barringService = new BarringService(new BarringRepository(), new BarringValidator()); _rollerWarehouseMutationService = new RollerWarehouseMutationService(new RollerWarehouseMutationRepository(), new RollerWarehouseMutationValidator()); _rollerWarehouseMutationDetailService = new RollerWarehouseMutationDetailService(new RollerWarehouseMutationDetailRepository(), new RollerWarehouseMutationDetailValidator()); _contactService = new ContactService(new ContactRepository(), new ContactValidator()); _purchaseReceivalService = new PurchaseReceivalService(new PurchaseReceivalRepository(), new PurchaseReceivalValidator()); _purchaseReceivalDetailService = new PurchaseReceivalDetailService(new PurchaseReceivalDetailRepository(), new PurchaseReceivalDetailValidator()); _coreIdentificationService = new CoreIdentificationService(new CoreIdentificationRepository(), new CoreIdentificationValidator()); _coreIdentificationDetailService = new CoreIdentificationDetailService(new CoreIdentificationDetailRepository(), new CoreIdentificationDetailValidator()); _warehouseService = new WarehouseService(new WarehouseRepository(), new WarehouseValidator()); _coreBuilderService = new CoreBuilderService(new CoreBuilderRepository(), new CoreBuilderValidator()); }
public CoreIdentificationController() { _coreIdentificationService = new CoreIdentificationService(new CoreIdentificationRepository(), new CoreIdentificationValidator()); _coreIdentificationDetailService = new CoreIdentificationDetailService(new CoreIdentificationDetailRepository(), new CoreIdentificationDetailValidator()); _stockMutationService = new StockMutationService(new StockMutationRepository(), new StockMutationValidator()); _recoveryOrderService = new RecoveryOrderService(new RecoveryOrderRepository(), new RecoveryOrderValidator()); _coreBuilderService = new CoreBuilderService(new CoreBuilderRepository(), new CoreBuilderValidator()); _itemService = new ItemService(new ItemRepository(), new ItemValidator()); _warehouseItemService = new WarehouseItemService(new WarehouseItemRepository(), new WarehouseItemValidator()); _barringService = new BarringService(new BarringRepository(), new BarringValidator()); _contactService = new ContactService(new ContactRepository(), new ContactValidator()); _recoveryOrderDetailService = new RecoveryOrderDetailService(new RecoveryOrderDetailRepository(), new RecoveryOrderDetailValidator()); _rollerWarehouseMutationDetailService = new RollerWarehouseMutationDetailService(new RollerWarehouseMutationDetailRepository(), new RollerWarehouseMutationDetailValidator()); _rollerTypeService = new RollerTypeService(new RollerTypeRepository(), new RollerTypeValidator()); _machineService = new MachineService(new MachineRepository(), new MachineValidator()); _warehouseService = new WarehouseService(new WarehouseRepository(), new WarehouseValidator()); }
public RecoveryWorkOrderController() { _itemService = new ItemService(new ItemRepository(), new ItemValidator()); _warehouseItemService = new WarehouseItemService(new WarehouseItemRepository(), new WarehouseItemValidator()); _stockMutationService = new StockMutationService(new StockMutationRepository(), new StockMutationValidator()); _barringService = new BarringService(new BarringRepository(), new BarringValidator()); _contactService = new ContactService(new ContactRepository(), new ContactValidator()); _warehouseService = new WarehouseService(new WarehouseRepository(), new WarehouseValidator()); _barringOrderService = new BarringOrderService(new BarringOrderRepository(), new BarringOrderValidator()); _barringOrderDetailService = new BarringOrderDetailService(new BarringOrderDetailRepository(), new BarringOrderDetailValidator()); _recoveryOrderService = new RecoveryOrderService(new RecoveryOrderRepository(), new RecoveryOrderValidator()); _recoveryOrderDetailService = new RecoveryOrderDetailService(new RecoveryOrderDetailRepository(), new RecoveryOrderDetailValidator()); _recoveryAccessoryDetailService = new RecoveryAccessoryDetailService(new RecoveryAccessoryDetailRepository(), new RecoveryAccessoryDetailValidator()); _coreIdentificationService = new CoreIdentificationService(new CoreIdentificationRepository(), new CoreIdentificationValidator()); _coreIdentificationDetailService = new CoreIdentificationDetailService(new CoreIdentificationDetailRepository(), new CoreIdentificationDetailValidator()); _rollerBuilderService = new RollerBuilderService(new RollerBuilderRepository(), new RollerBuilderValidator()); _coreBuilderService = new CoreBuilderService(new CoreBuilderRepository(), new CoreBuilderValidator()); _itemTypeService = new ItemTypeService(new ItemTypeRepository(), new ItemTypeValidator()); }
public RollerBuilder VCreateObject(RollerBuilder rollerBuilder, IRollerBuilderService _rollerBuilderService, IMachineService _machineService, IUoMService _uomService, IItemService _itemService, ICoreBuilderService _coreBuilderService, IRollerTypeService _rollerTypeService) { VHasUniqueBaseSku(rollerBuilder, _rollerBuilderService); if (!isValid(rollerBuilder)) { return(rollerBuilder); } VNameNotEmpty(rollerBuilder); if (!isValid(rollerBuilder)) { return(rollerBuilder); } VHasCompound(rollerBuilder, _itemService); if (!isValid(rollerBuilder)) { return(rollerBuilder); } VHasCoreBuilder(rollerBuilder, _coreBuilderService); if (!isValid(rollerBuilder)) { return(rollerBuilder); } VHasRollerType(rollerBuilder, _rollerTypeService); if (!isValid(rollerBuilder)) { return(rollerBuilder); } VHasMachine(rollerBuilder, _machineService); if (!isValid(rollerBuilder)) { return(rollerBuilder); } VHasMeasurement(rollerBuilder); if (!isValid(rollerBuilder)) { return(rollerBuilder); } VHasUoM(rollerBuilder, _uomService); return(rollerBuilder); }
public CoreIdentificationDetail CreateObject(int CoreIdentificationId, int DetailId, int MaterialCase, int CoreBuilderId, int RollerTypeId, int MachineId, decimal RD, decimal CD, decimal RL, decimal WL, decimal TL, ICoreIdentificationService _coreIdentificationService, ICoreBuilderService _coreBuilderService, IRollerTypeService _rollerTypeService, IMachineService _machineService) { CoreIdentificationDetail coreIdentificationDetail = new CoreIdentificationDetail { CoreIdentificationId = CoreIdentificationId, DetailId = DetailId, MaterialCase = MaterialCase, CoreBuilderId = CoreBuilderId, RollerTypeId = RollerTypeId, MachineId = MachineId, RD = RD, CD = CD, RL = RL, WL = WL, TL = TL }; return(this.CreateObject(coreIdentificationDetail, _coreIdentificationService, _coreBuilderService, _rollerTypeService, _machineService)); }
public MstRollerBuilderController() { _coreBuilderService = new CoreBuilderService(new CoreBuilderRepository(), new CoreBuilderValidator()); _itemTypeService = new ItemTypeService(new ItemTypeRepository(), new ItemTypeValidator()); _rollerBuilderService = new RollerBuilderService(new RollerBuilderRepository(), new RollerBuilderValidator()); _recoveryOrderDetailService = new RecoveryOrderDetailService(new RecoveryOrderDetailRepository(), new RecoveryOrderDetailValidator()); _warehouseItemService = new WarehouseItemService(new WarehouseItemRepository(), new WarehouseItemValidator()); _stockMutationService = new StockMutationService(new StockMutationRepository(), new StockMutationValidator()); _itemService = new ItemService(new ItemRepository(), new ItemValidator()); _uomService = new UoMService(new UoMRepository(), new UoMValidator()); _warehouseService = new WarehouseService(new WarehouseRepository(), new WarehouseValidator()); _machineService = new MachineService(new MachineRepository(), new MachineValidator()); _rollerTypeService = new RollerTypeService(new RollerTypeRepository(), new RollerTypeValidator()); _barringService = new BarringService(new BarringRepository(), new BarringValidator()); _contactService = new ContactService(new ContactRepository(), new ContactValidator()); _priceMutationService = new PriceMutationService(new PriceMutationRepository(), new PriceMutationValidator()); _contactGroupService = new ContactGroupService(new ContactGroupRepository(), new ContactGroupValidator()); _purchaseOrderDetailService = new PurchaseOrderDetailService(new PurchaseOrderDetailRepository(), new PurchaseOrderDetailValidator()); _stockAdjustmentDetailService = new StockAdjustmentDetailService(new StockAdjustmentDetailRepository(), new StockAdjustmentDetailValidator()); _salesOrderDetailService = new SalesOrderDetailService(new SalesOrderDetailRepository(), new SalesOrderDetailValidator()); }
public RollerBuilder UpdateObject(RollerBuilder rollerBuilder, IMachineService _machineService, IUoMService _uomService, IItemService _itemService, IItemTypeService _itemTypeService, ICoreBuilderService _coreBuilderService, IRollerTypeService _rollerTypeService) { Item RollerUsedCore = _itemService.GetObjectById(rollerBuilder.RollerUsedCoreItemId); RollerUsedCore.Name = rollerBuilder.Name; RollerUsedCore.Category = rollerBuilder.Category; Item RollerNewCore = _itemService.GetObjectById(rollerBuilder.RollerNewCoreItemId); RollerNewCore.Name = rollerBuilder.Name; RollerNewCore.Category = rollerBuilder.Category; if (_itemService.GetValidator().ValidUpdateLegacyObject(RollerUsedCore, _uomService, _itemService, _itemTypeService) && _itemService.GetValidator().ValidUpdateLegacyObject(RollerNewCore, _uomService, _itemService, _itemTypeService)) { if (_validator.ValidUpdateObject(rollerBuilder, this, _machineService, _uomService, _itemService, _coreBuilderService, _rollerTypeService)) { _itemService.GetRepository().UpdateObject(RollerUsedCore); _itemService.GetRepository().UpdateObject(RollerNewCore); rollerBuilder = _repository.UpdateObject(rollerBuilder); } } else { if (RollerUsedCore.Errors.Count() > 0) { rollerBuilder.Errors.Add(RollerUsedCore.Errors.First().Key, RollerUsedCore.Errors.First().Value); } else if (RollerNewCore.Errors.Count() > 0) { rollerBuilder.Errors.Add(RollerNewCore.Errors.First().Key, RollerNewCore.Errors.First().Value); } else { rollerBuilder.Errors.Add("Generic", "Item tidak dapat di update"); } } return(rollerBuilder); }
// Hanya untuk InHouse Production public CoreIdentification VQuantityIsInStock(CoreIdentification coreIdentification, ICoreIdentificationDetailService _coreIdentificationDetailService, ICoreBuilderService _coreBuilderService, IItemService _itemService, IWarehouseItemService _warehouseItemService) { if (!coreIdentification.IsInHouse) { return(coreIdentification); } IList <CoreIdentificationDetail> details = _coreIdentificationDetailService.GetObjectsByCoreIdentificationId(coreIdentification.Id); IDictionary <int, int> ValuePairWarehouseItemIdQuantity = new Dictionary <int, int>(); foreach (var detail in details) { CoreBuilder coreBuilder = _coreBuilderService.GetObjectById(detail.CoreBuilderId); Item item = (detail.MaterialCase == Core.Constants.Constant.MaterialCase.New) ? _itemService.GetObjectById(coreBuilder.NewCoreItemId) : _itemService.GetObjectById(coreBuilder.UsedCoreItemId); WarehouseItem warehouseItem = _warehouseItemService.FindOrCreateObject(coreIdentification.WarehouseId, item.Id); if (ValuePairWarehouseItemIdQuantity.ContainsKey(warehouseItem.Id)) { ValuePairWarehouseItemIdQuantity[warehouseItem.Id] += 1; } else { ValuePairWarehouseItemIdQuantity.Add(warehouseItem.Id, 1); } } foreach (var ValuePair in ValuePairWarehouseItemIdQuantity) { WarehouseItem warehouseItem = _warehouseItemService.GetObjectById(ValuePair.Key); if (warehouseItem.Quantity < ValuePair.Value) { coreIdentification.Errors.Add("Generic", "Stock item tidak mencukupi untuk melakukan Core Identification"); return(coreIdentification); } } return(coreIdentification); }
public RollerBuilder CreateObject(string BaseSku, string SkuRollerNewCore, string SkuRollerUsedCore, string Name, string Category, int CD, int RD, int RL, int WL, int TL, IMachineService _machineService, IUoMService _uomService, IItemService _itemService, IItemTypeService _itemTypeService, ICoreBuilderService _coreBuilderService, IRollerTypeService _rollerTypeService, IWarehouseItemService _warehouseItemService, IWarehouseService _warehouseService) { RollerBuilder rollerBuilder = new RollerBuilder { BaseSku = BaseSku, SkuRollerNewCore = SkuRollerNewCore, SkuRollerUsedCore = SkuRollerUsedCore, Name = Name, Category = Category, CD = CD, RD = RD, RL = RL, WL = WL, TL = TL }; return(this.CreateObject(rollerBuilder, _machineService, _uomService, _itemService, _itemTypeService, _coreBuilderService, _rollerTypeService, _warehouseItemService, _warehouseService)); }
public CoreIdentificationDetail FinishObject(CoreIdentificationDetail coreIdentificationDetail, DateTime FinishedDate, ICoreIdentificationService _coreIdentificationService, ICoreBuilderService _coreBuilderService, IStockMutationService _stockMutationService, IItemService _itemService, IBarringService _barringService, IWarehouseItemService _warehouseItemService) { coreIdentificationDetail.FinishedDate = FinishedDate; if (_validator.ValidFinishObject(coreIdentificationDetail, _coreIdentificationService, this, _coreBuilderService, _warehouseItemService)) { CoreIdentification coreIdentification = _coreIdentificationService.GetObjectById(coreIdentificationDetail.CoreIdentificationId); if (coreIdentification.ContactId != null) { // add contact core int MaterialCase = coreIdentificationDetail.MaterialCase; Item item = (MaterialCase == Core.Constants.Constant.MaterialCase.New ? _coreBuilderService.GetNewCore(coreIdentificationDetail.CoreBuilderId) : _coreBuilderService.GetUsedCore(coreIdentificationDetail.CoreBuilderId)); WarehouseItem warehouseItem = _warehouseItemService.FindOrCreateObject(coreIdentification.WarehouseId, item.Id); StockMutation stockMutation = _stockMutationService.CreateStockMutationForCoreIdentification(coreIdentificationDetail, warehouseItem); _stockMutationService.StockMutateObject(stockMutation, _itemService, _barringService, _warehouseItemService); } _repository.FinishObject(coreIdentificationDetail); } return(coreIdentificationDetail); }
public bool ValidConfirmObject(RecoveryOrder recoveryOrder, ICoreIdentificationDetailService _coreIdentificationDetailService, IRecoveryOrderDetailService _recoveryOrderDetailService, ICoreBuilderService _coreBuilderService, IItemService _itemService, IWarehouseItemService _warehouseItemService) { recoveryOrder.Errors.Clear(); VConfirmObject(recoveryOrder, _coreIdentificationDetailService, _recoveryOrderDetailService, _coreBuilderService, _itemService, _warehouseItemService); return(isValid(recoveryOrder)); }
public RecoveryOrder VConfirmObject(RecoveryOrder recoveryOrder, ICoreIdentificationDetailService _coreIdentificationDetailService, IRecoveryOrderDetailService _recoveryOrderDetailService, ICoreBuilderService _coreBuilderService, IItemService _itemService, IWarehouseItemService _warehouseItemService) { VHasConfirmationDate(recoveryOrder); if (!isValid(recoveryOrder)) { return(recoveryOrder); } VHasNotBeenConfirmed(recoveryOrder); if (!isValid(recoveryOrder)) { return(recoveryOrder); } VHasRecoveryOrderDetails(recoveryOrder, _recoveryOrderDetailService); if (!isValid(recoveryOrder)) { return(recoveryOrder); } VQuantityReceivedEqualDetails(recoveryOrder, _recoveryOrderDetailService); if (!isValid(recoveryOrder)) { return(recoveryOrder); } VQuantityIsInStock(recoveryOrder, _coreIdentificationDetailService, _recoveryOrderDetailService, _coreBuilderService, _itemService, _warehouseItemService); return(recoveryOrder); }
public RecoveryOrder VQuantityIsInStock(RecoveryOrder recoveryOrder, ICoreIdentificationDetailService _coreIdentificationDetailService, IRecoveryOrderDetailService _recoveryOrderDetailService, ICoreBuilderService _coreBuilderService, IItemService _itemService, IWarehouseItemService _warehouseItemService) { IList <RecoveryOrderDetail> details = _recoveryOrderDetailService.GetObjectsByRecoveryOrderId(recoveryOrder.Id); IDictionary <int, int> ValuePairItemIdQuantity = new Dictionary <int, int>(); foreach (var detail in details) { CoreIdentificationDetail coreIdentificationDetail = _coreIdentificationDetailService.GetObjectById(detail.CoreIdentificationDetailId); CoreBuilder coreBuilder = _coreBuilderService.GetObjectById(coreIdentificationDetail.CoreBuilderId); Item item = (coreIdentificationDetail.MaterialCase == Core.Constants.Constant.MaterialCase.New) ? _coreBuilderService.GetNewCore(coreBuilder.Id) : _coreBuilderService.GetUsedCore(coreBuilder.Id); WarehouseItem warehouseItem = _warehouseItemService.FindOrCreateObject(recoveryOrder.WarehouseId, item.Id); if (ValuePairItemIdQuantity.ContainsKey(warehouseItem.Id)) { ValuePairItemIdQuantity[warehouseItem.Id] += 1; } else { ValuePairItemIdQuantity.Add(warehouseItem.Id, 1); } } foreach (var ValuePair in ValuePairItemIdQuantity) { WarehouseItem warehouseItem = _warehouseItemService.GetObjectById(ValuePair.Key); if (warehouseItem.Quantity < ValuePair.Value) { recoveryOrder.Errors.Add("Generic", "Stock quantity core item tidak boleh kurang dari jumlah di dalam recovery order"); return(recoveryOrder); } } return(recoveryOrder); }
public RecoveryOrder ConfirmObject(RecoveryOrder recoveryOrder, DateTime ConfirmationDate, ICoreIdentificationDetailService _coreIdentificationDetailService, IRecoveryOrderDetailService _recoveryOrderDetailService, IRecoveryAccessoryDetailService _recoveryAccessoryDetailService, ICoreBuilderService _coreBuilderService, IStockMutationService _stockMutationService, IItemService _itemService, IBarringService _barringService, IWarehouseItemService _warehouseItemService, IWarehouseService _warehouseService) { recoveryOrder.ConfirmationDate = ConfirmationDate; if (_validator.ValidConfirmObject(recoveryOrder, _coreIdentificationDetailService, _recoveryOrderDetailService, _coreBuilderService, _itemService, _warehouseItemService)) { IList <RecoveryOrderDetail> details = _recoveryOrderDetailService.GetObjectsByRecoveryOrderId(recoveryOrder.Id); IDictionary <int, int> ValuePairItemIdQuantity = new Dictionary <int, int>(); foreach (var detail in details) { CoreIdentificationDetail coreIdentificationDetail = _coreIdentificationDetailService.GetObjectById(detail.CoreIdentificationDetailId); _coreIdentificationDetailService.SetJobScheduled(coreIdentificationDetail, this, _recoveryOrderDetailService); } _repository.ConfirmObject(recoveryOrder); } return(recoveryOrder); }
public PurchaseBuilder() { _accountService = new AccountService(new AccountRepository(), new AccountValidator()); _barringService = new BarringService(new BarringRepository(), new BarringValidator()); _barringOrderService = new BarringOrderService(new BarringOrderRepository(), new BarringOrderValidator()); _barringOrderDetailService = new BarringOrderDetailService(new BarringOrderDetailRepository(), new BarringOrderDetailValidator()); _cashBankAdjustmentService = new CashBankAdjustmentService(new CashBankAdjustmentRepository(), new CashBankAdjustmentValidator()); _cashBankMutationService = new CashBankMutationService(new CashBankMutationRepository(), new CashBankMutationValidator()); _cashBankService = new CashBankService(new CashBankRepository(), new CashBankValidator()); _cashMutationService = new CashMutationService(new CashMutationRepository(), new CashMutationValidator()); _closingService = new ClosingService(new ClosingRepository(), new ClosingValidator()); _coreBuilderService = new CoreBuilderService(new CoreBuilderRepository(), new CoreBuilderValidator()); _coreIdentificationDetailService = new CoreIdentificationDetailService(new CoreIdentificationDetailRepository(), new CoreIdentificationDetailValidator()); _coreIdentificationService = new CoreIdentificationService(new CoreIdentificationRepository(), new CoreIdentificationValidator()); _contactService = new ContactService(new ContactRepository(), new ContactValidator()); _deliveryOrderService = new DeliveryOrderService(new DeliveryOrderRepository(), new DeliveryOrderValidator()); _deliveryOrderDetailService = new DeliveryOrderDetailService(new DeliveryOrderDetailRepository(), new DeliveryOrderDetailValidator()); _generalLedgerJournalService = new GeneralLedgerJournalService(new GeneralLedgerJournalRepository(), new GeneralLedgerJournalValidator()); _itemService = new ItemService(new ItemRepository(), new ItemValidator()); _itemTypeService = new ItemTypeService(new ItemTypeRepository(), new ItemTypeValidator()); _machineService = new MachineService(new MachineRepository(), new MachineValidator()); _payableService = new PayableService(new PayableRepository(), new PayableValidator()); _paymentVoucherDetailService = new PaymentVoucherDetailService(new PaymentVoucherDetailRepository(), new PaymentVoucherDetailValidator()); _paymentVoucherService = new PaymentVoucherService(new PaymentVoucherRepository(), new PaymentVoucherValidator()); _purchaseInvoiceDetailService = new PurchaseInvoiceDetailService(new PurchaseInvoiceDetailRepository(), new PurchaseInvoiceDetailValidator()); _purchaseInvoiceService = new PurchaseInvoiceService(new PurchaseInvoiceRepository(), new PurchaseInvoiceValidator()); _purchaseOrderService = new PurchaseOrderService(new PurchaseOrderRepository(), new PurchaseOrderValidator()); _purchaseOrderDetailService = new PurchaseOrderDetailService(new PurchaseOrderDetailRepository(), new PurchaseOrderDetailValidator()); _purchaseReceivalService = new PurchaseReceivalService(new PurchaseReceivalRepository(), new PurchaseReceivalValidator()); _purchaseReceivalDetailService = new PurchaseReceivalDetailService(new PurchaseReceivalDetailRepository(), new PurchaseReceivalDetailValidator()); _receivableService = new ReceivableService(new ReceivableRepository(), new ReceivableValidator()); _receiptVoucherDetailService = new ReceiptVoucherDetailService(new ReceiptVoucherDetailRepository(), new ReceiptVoucherDetailValidator()); _receiptVoucherService = new ReceiptVoucherService(new ReceiptVoucherRepository(), new ReceiptVoucherValidator()); _recoveryOrderDetailService = new RecoveryOrderDetailService(new RecoveryOrderDetailRepository(), new RecoveryOrderDetailValidator()); _recoveryOrderService = new RecoveryOrderService(new RecoveryOrderRepository(), new RecoveryOrderValidator()); _recoveryAccessoryDetailService = new RecoveryAccessoryDetailService(new RecoveryAccessoryDetailRepository(), new RecoveryAccessoryDetailValidator()); _rollerBuilderService = new RollerBuilderService(new RollerBuilderRepository(), new RollerBuilderValidator()); _rollerTypeService = new RollerTypeService(new RollerTypeRepository(), new RollerTypeValidator()); _rollerWarehouseMutationDetailService = new RollerWarehouseMutationDetailService(new RollerWarehouseMutationDetailRepository(), new RollerWarehouseMutationDetailValidator()); _rollerWarehouseMutationService = new RollerWarehouseMutationService(new RollerWarehouseMutationRepository(), new RollerWarehouseMutationValidator()); _salesInvoiceDetailService = new SalesInvoiceDetailService(new SalesInvoiceDetailRepository(), new SalesInvoiceDetailValidator()); _salesInvoiceService = new SalesInvoiceService(new SalesInvoiceRepository(), new SalesInvoiceValidator()); _salesOrderService = new SalesOrderService(new SalesOrderRepository(), new SalesOrderValidator()); _salesOrderDetailService = new SalesOrderDetailService(new SalesOrderDetailRepository(), new SalesOrderDetailValidator()); _stockAdjustmentDetailService = new StockAdjustmentDetailService(new StockAdjustmentDetailRepository(), new StockAdjustmentDetailValidator()); _stockAdjustmentService = new StockAdjustmentService(new StockAdjustmentRepository(), new StockAdjustmentValidator()); _stockMutationService = new StockMutationService(new StockMutationRepository(), new StockMutationValidator()); _uomService = new UoMService(new UoMRepository(), new UoMValidator()); _validCombService = new ValidCombService(new ValidCombRepository(), new ValidCombValidator()); _warehouseItemService = new WarehouseItemService(new WarehouseItemRepository(), new WarehouseItemValidator()); _warehouseService = new WarehouseService(new WarehouseRepository(), new WarehouseValidator()); _warehouseMutationOrderService = new WarehouseMutationOrderService(new WarehouseMutationOrderRepository(), new WarehouseMutationOrderValidator()); _warehouseMutationOrderDetailService = new WarehouseMutationOrderDetailService(new WarehouseMutationOrderDetailRepository(), new WarehouseMutationOrderDetailValidator()); _priceMutationService = new PriceMutationService(new PriceMutationRepository(), new PriceMutationValidator()); _contactGroupService = new ContactGroupService(new ContactGroupRepository(), new ContactGroupValidator()); typeAccessory = _itemTypeService.CreateObject("Accessory", "Accessory"); typeBar = _itemTypeService.CreateObject("Bar", "Bar"); typeBarring = _itemTypeService.CreateObject("Barring", "Barring", true); typeBearing = _itemTypeService.CreateObject("Bearing", "Bearing"); typeBlanket = _itemTypeService.CreateObject("Blanket", "Blanket"); typeChemical = _itemTypeService.CreateObject("Chemical", "Chemical"); typeCompound = _itemTypeService.CreateObject("Compound", "Compound"); typeConsumable = _itemTypeService.CreateObject("Consumable", "Consumable"); typeCore = _itemTypeService.CreateObject("Core", "Core", true); typeGlue = _itemTypeService.CreateObject("Glue", "Glue"); typeUnderpacking = _itemTypeService.CreateObject("Underpacking", "Underpacking"); typeRoller = _itemTypeService.CreateObject("Roller", "Roller", true); typeDamp = _rollerTypeService.CreateObject("Damp", "Damp"); typeFoundDT = _rollerTypeService.CreateObject("Found DT", "Found DT"); typeInkFormX = _rollerTypeService.CreateObject("Ink Form X", "Ink Form X"); typeInkDistD = _rollerTypeService.CreateObject("Ink Dist D", "Ink Dist D"); typeInkDistM = _rollerTypeService.CreateObject("Ink Dist M", "Ink Dist M"); typeInkDistE = _rollerTypeService.CreateObject("Ink Dist E", "Ink Dist E"); typeInkDuctB = _rollerTypeService.CreateObject("Ink Duct B", "Ink Duct B"); typeInkDistH = _rollerTypeService.CreateObject("Ink Dist H", "Ink Dist H"); typeInkFormW = _rollerTypeService.CreateObject("Ink Form W", "Ink Form W"); typeInkDistHQ = _rollerTypeService.CreateObject("Ink Dist HQ", "Ink Dist HQ"); typeDampFormDQ = _rollerTypeService.CreateObject("Damp Form DQ", "Damp Form DQ"); typeInkFormY = _rollerTypeService.CreateObject("Ink Form Y", "Ink Form Y"); baseGroup = _contactGroupService.CreateObject(Core.Constants.Constant.GroupType.Base, "Base Group", true); if (!_accountService.GetLegacyObjects().Any()) { Asset = _accountService.CreateLegacyObject(new Account() { Name = "Asset", Code = Constant.AccountCode.Asset, LegacyCode = Constant.AccountLegacyCode.Asset, Level = 1, Group = Constant.AccountGroup.Asset, IsLegacy = true }, _accountService); CashBank = _accountService.CreateLegacyObject(new Account() { Name = "CashBank", Code = Constant.AccountCode.CashBank, LegacyCode = Constant.AccountLegacyCode.CashBank, Level = 2, Group = Constant.AccountGroup.Asset, ParentId = Asset.Id, IsLegacy = true }, _accountService); AccountReceivable = _accountService.CreateLegacyObject(new Account() { Name = "Account Receivable", IsLeaf = true, Code = Constant.AccountCode.AccountReceivable, LegacyCode = Constant.AccountLegacyCode.AccountReceivable, Level = 2, Group = Constant.AccountGroup.Asset, ParentId = Asset.Id, IsLegacy = true }, _accountService); GBCHReceivable = _accountService.CreateLegacyObject(new Account() { Name = "GBCH Receivable", IsLeaf = true, Code = Constant.AccountCode.GBCHReceivable, LegacyCode = Constant.AccountLegacyCode.GBCHReceivable, Level = 2, Group = Constant.AccountGroup.Asset, ParentId = Asset.Id, IsLegacy = true }, _accountService); Inventory = _accountService.CreateLegacyObject(new Account() { Name = "Inventory", IsLeaf = true, Code = Constant.AccountCode.Inventory, LegacyCode = Constant.AccountLegacyCode.Inventory, Level = 2, Group = Constant.AccountGroup.Asset, ParentId = Asset.Id, IsLegacy = true }, _accountService); Expense = _accountService.CreateLegacyObject(new Account() { Name = "Expense", Code = Constant.AccountCode.Expense, LegacyCode = Constant.AccountLegacyCode.Expense, Level = 1, Group = Constant.AccountGroup.Expense, IsLegacy = true }, _accountService); CashBankAdjustmentExpense = _accountService.CreateLegacyObject(new Account() { Name = "CashBank Adjustment Expense", IsLeaf = true, Code = Constant.AccountCode.CashBankAdjustmentExpense, LegacyCode = Constant.AccountLegacyCode.CashBankAdjustmentExpense, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true }, _accountService); COGS = _accountService.CreateLegacyObject(new Account() { Name = "Cost Of Goods Sold", IsLeaf = true, Code = Constant.AccountCode.COGS, LegacyCode = Constant.AccountLegacyCode.COGS, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true }, _accountService); Discount = _accountService.CreateLegacyObject(new Account() { Name = "Discount", IsLeaf = true, Code = Constant.AccountCode.Discount, LegacyCode = Constant.AccountLegacyCode.Discount, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true }, _accountService); SalesAllowance = _accountService.CreateLegacyObject(new Account() { Name = "Sales Allowance", IsLeaf = true, Code = Constant.AccountCode.SalesAllowance, LegacyCode = Constant.AccountLegacyCode.SalesAllowance, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true }, _accountService); StockAdjustmentExpense = _accountService.CreateLegacyObject(new Account() { Name = "Stock Adjustment Expense", IsLeaf = true, Code = Constant.AccountCode.StockAdjustmentExpense, LegacyCode = Constant.AccountLegacyCode.StockAdjustmentExpense, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true }, _accountService); Liability = _accountService.CreateLegacyObject(new Account() { Name = "Liability", Code = Constant.AccountCode.Liability, LegacyCode = Constant.AccountLegacyCode.Liability, Level = 1, Group = Constant.AccountGroup.Liability, IsLegacy = true }, _accountService); AccountPayable = _accountService.CreateLegacyObject(new Account() { Name = "Account Payable", IsLeaf = true, Code = Constant.AccountCode.AccountPayable, LegacyCode = Constant.AccountLegacyCode.AccountPayable, Level = 2, Group = Constant.AccountGroup.Liability, ParentId = Liability.Id, IsLegacy = true }, _accountService); GBCHPayable = _accountService.CreateLegacyObject(new Account() { Name = "GBCH Payable", IsLeaf = true, Code = Constant.AccountCode.GBCHPayable, LegacyCode = Constant.AccountLegacyCode.GBCHPayable, Level = 2, Group = Constant.AccountGroup.Liability, ParentId = Liability.Id, IsLegacy = true }, _accountService); GoodsPendingClearance = _accountService.CreateLegacyObject(new Account() { Name = "Goods Pending Clearance", IsLeaf = true, Code = Constant.AccountCode.GoodsPendingClearance, LegacyCode = Constant.AccountLegacyCode.GoodsPendingClearance, Level = 2, Group = Constant.AccountGroup.Liability, ParentId = Liability.Id, IsLegacy = true }, _accountService); Equity = _accountService.CreateLegacyObject(new Account() { Name = "Equity", Code = Constant.AccountCode.Equity, LegacyCode = Constant.AccountLegacyCode.Equity, Level = 1, Group = Constant.AccountGroup.Equity, IsLegacy = true }, _accountService); OwnersEquity = _accountService.CreateLegacyObject(new Account() { Name = "Owners Equity", Code = Constant.AccountCode.OwnersEquity, LegacyCode = Constant.AccountLegacyCode.OwnersEquity, Level = 2, Group = Constant.AccountGroup.Equity, ParentId = Equity.Id, IsLegacy = true }, _accountService); EquityAdjustment = _accountService.CreateLegacyObject(new Account() { Name = "Equity Adjustment", IsLeaf = true, Code = Constant.AccountCode.EquityAdjustment, LegacyCode = Constant.AccountLegacyCode.EquityAdjustment, Level = 3, Group = Constant.AccountGroup.Equity, ParentId = OwnersEquity.Id, IsLegacy = true }, _accountService); Revenue = _accountService.CreateLegacyObject(new Account() { Name = "Revenue", IsLeaf = true, Code = Constant.AccountCode.Revenue, LegacyCode = Constant.AccountLegacyCode.Revenue, Level = 1, Group = Constant.AccountGroup.Revenue, IsLegacy = true }, _accountService); } }
public RollerBuilder CreateObject(RollerBuilder rollerBuilder, IMachineService _machineService, IUoMService _uomService, IItemService _itemService, IItemTypeService _itemTypeService, ICoreBuilderService _coreBuilderService, IRollerTypeService _rollerTypeService, IWarehouseItemService _warehouseItemService, IWarehouseService _warehouseService) { rollerBuilder.Errors = new Dictionary <String, String>(); ItemType typeRoller = _itemTypeService.GetObjectByName(Core.Constants.Constant.ItemTypeCase.Roller); if (typeRoller == null) { rollerBuilder.Errors.Add("Generic", "ItemType [Roller] Legacy harus dibuat terlebih dahulu"); } Item RollerUsedCore = new Item() { Name = rollerBuilder.Name, Category = rollerBuilder.Category, UoMId = rollerBuilder.UoMId, Quantity = 0, ItemTypeId = _itemTypeService.GetObjectByName(Core.Constants.Constant.ItemTypeCase.Roller).Id, Sku = rollerBuilder.SkuRollerUsedCore }; RollerUsedCore.Errors = new Dictionary <string, string>(); Item RollerNewCore = new Item() { Name = rollerBuilder.Name, Category = rollerBuilder.Category, UoMId = rollerBuilder.UoMId, Quantity = 0, ItemTypeId = _itemTypeService.GetObjectByName(Core.Constants.Constant.ItemTypeCase.Roller).Id, Sku = rollerBuilder.SkuRollerNewCore }; RollerNewCore.Errors = new Dictionary <string, string>(); if (_itemService.GetValidator().ValidCreateLegacyObject(RollerUsedCore, _uomService, _itemService, _itemTypeService) && _itemService.GetValidator().ValidCreateLegacyObject(RollerNewCore, _uomService, _itemService, _itemTypeService)) { if (_validator.ValidCreateObject(rollerBuilder, this, _machineService, _uomService, _itemService, _coreBuilderService, _rollerTypeService)) { RollerUsedCore = _itemService.CreateLegacyObject(RollerUsedCore, _uomService, _itemTypeService, _warehouseItemService, _warehouseService); RollerUsedCore.Id = RollerUsedCore.Id; RollerNewCore = _itemService.CreateLegacyObject(RollerNewCore, _uomService, _itemTypeService, _warehouseItemService, _warehouseService); RollerNewCore.Id = RollerNewCore.Id; rollerBuilder.RollerUsedCoreItemId = RollerUsedCore.Id; rollerBuilder.RollerNewCoreItemId = RollerNewCore.Id; rollerBuilder = _repository.CreateObject(rollerBuilder); } } else { if (RollerUsedCore.Errors.Count() > 0) { rollerBuilder.Errors.Add(RollerUsedCore.Errors.First().Key, RollerUsedCore.Errors.First().Value); } else if (RollerNewCore.Errors.Count() > 0) { rollerBuilder.Errors.Add(RollerNewCore.Errors.First().Key, RollerNewCore.Errors.First().Value); } else { rollerBuilder.Errors.Add("Generic", "Item tidak dapat di update"); } } return(rollerBuilder); }