public BarringOrderDetail VFinishObject(BarringOrderDetail barringOrderDetail, IBarringOrderService _barringOrderService)
 {
     VHasFinishedDate(barringOrderDetail);
     if (!isValid(barringOrderDetail))
     {
         return(barringOrderDetail);
     }
     VBarringOrderHasBeenConfirmed(barringOrderDetail, _barringOrderService);
     if (!isValid(barringOrderDetail))
     {
         return(barringOrderDetail);
     }
     VHasNotBeenFinished(barringOrderDetail);
     if (!isValid(barringOrderDetail))
     {
         return(barringOrderDetail);
     }
     VHasBeenPackaged(barringOrderDetail);
     if (!isValid(barringOrderDetail))
     {
         return(barringOrderDetail);
     }
     VHasNotBeenRejected(barringOrderDetail);
     return(barringOrderDetail);
 }
 public BarringOrderDetail VHasNoLeftBar(BarringOrderDetail barringOrderDetail)
 {
     if (barringOrderDetail.HasLeftBar)
     {
         barringOrderDetail.Errors.Add("Generic", "LeftBar tidak boleh ada");
     }
     return(barringOrderDetail);
 }
 public BarringOrderDetail VHasRejectedDate(BarringOrderDetail barringOrderDetail)
 {
     if (barringOrderDetail.RejectedDate == null)
     {
         barringOrderDetail.Errors.Add("RejectedDate", "Tidak boleh kosong");
     }
     return(barringOrderDetail);
 }
 public BarringOrderDetail VHasBeenRejected(BarringOrderDetail barringOrderDetail)
 {
     if (!barringOrderDetail.IsRejected)
     {
         barringOrderDetail.Errors.Add("Generic", "Belum di reject");
     }
     return(barringOrderDetail);
 }
 public BarringOrderDetail VHasBeenFinished(BarringOrderDetail barringOrderDetail)
 {
     if (!barringOrderDetail.IsFinished)
     {
         barringOrderDetail.Errors.Add("Generic", "Belum selesai");
     }
     return(barringOrderDetail);
 }
 public BarringOrderDetail VHasBeenPackaged(BarringOrderDetail barringOrderDetail)
 {
     if (!barringOrderDetail.IsPackaged)
     {
         barringOrderDetail.Errors.Add("Generic", "Belum di package");
     }
     return(barringOrderDetail);
 }
 public BarringOrderDetail VHasNotBeenCut(BarringOrderDetail barringOrderDetail)
 {
     if (barringOrderDetail.IsCut)
     {
         barringOrderDetail.Errors.Add("Generic", "Sudah di cut");
     }
     return(barringOrderDetail);
 }
 public BarringOrderDetail VHasNotBeenPackaged(BarringOrderDetail barringOrderDetail)
 {
     if (barringOrderDetail.IsPackaged)
     {
         barringOrderDetail.Errors.Add("Generic", "Sudah di package");
     }
     return(barringOrderDetail);
 }
 public BarringOrderDetail VHasBeenBarPrepared(BarringOrderDetail barringOrderDetail)
 {
     if (!barringOrderDetail.IsBarPrepared)
     {
         barringOrderDetail.Errors.Add("Generic", "Bar belum di prepare");
     }
     return(barringOrderDetail);
 }
 public BarringOrderDetail VHasNotBeenFinished(BarringOrderDetail barringOrderDetail)
 {
     if (barringOrderDetail.IsFinished)
     {
         barringOrderDetail.Errors.Add("Generic", "Sudah selesai");
     }
     return(barringOrderDetail);
 }
 public BarringOrderDetail VHasBeenAdhesiveTapeApplied(BarringOrderDetail barringOrderDetail)
 {
     if (!barringOrderDetail.IsAdhesiveTapeApplied)
     {
         barringOrderDetail.Errors.Add("Generic", "Belum di adhesive tape");
     }
     return(barringOrderDetail);
 }
 public BarringOrderDetail VHasNotBeenQCAndMarked(BarringOrderDetail barringOrderDetail)
 {
     if (barringOrderDetail.IsQCAndMarked)
     {
         barringOrderDetail.Errors.Add("Generic", "Sudah di QC dan mark");
     }
     return(barringOrderDetail);
 }
 public BarringOrderDetail VHasNotBeenBarPullOffTested(BarringOrderDetail barringOrderDetail)
 {
     if (barringOrderDetail.IsBarPullOffTested)
     {
         barringOrderDetail.Errors.Add("Generic", "Bar sudah di pull-off test");
     }
     return(barringOrderDetail);
 }
 public BarringOrderDetail VHasBeenBarMounted(BarringOrderDetail barringOrderDetail)
 {
     if (!barringOrderDetail.IsBarMounted)
     {
         barringOrderDetail.Errors.Add("Generic", "Bar belum di mount");
     }
     return(barringOrderDetail);
 }
 public BarringOrderDetail VIsBarRequiredMustBeTrue(BarringOrderDetail barringOrderDetail)
 {
     if (!barringOrderDetail.IsBarRequired)
     {
         barringOrderDetail.Errors.Add("Generic", "Tidak bisa menambahkan bar untuk Barring Order yang tidak memerlukan bar");
     }
     return(barringOrderDetail);
 }
 public BarringOrderDetail VHasNotBeenRejected(BarringOrderDetail barringOrderDetail)
 {
     if (barringOrderDetail.IsRejected)
     {
         barringOrderDetail.Errors.Add("Generic", "Sudah di reject");
     }
     return(barringOrderDetail);
 }
 public BarringOrderDetail VHasBeenSideSealed(BarringOrderDetail barringOrderDetail)
 {
     if (!barringOrderDetail.IsSideSealed)
     {
         barringOrderDetail.Errors.Add("Generic", "Belum di side seal");
     }
     return(barringOrderDetail);
 }
 public BarringOrderDetail VHasRightBar(BarringOrderDetail barringOrderDetail)
 {
     if (!barringOrderDetail.HasRightBar)
     {
         barringOrderDetail.Errors.Add("Generic", "RightBar tidak ada");
     }
     return(barringOrderDetail);
 }
 public BarringOrderDetail VHasBeenCut(BarringOrderDetail barringOrderDetail)
 {
     if (!barringOrderDetail.IsCut)
     {
         barringOrderDetail.Errors.Add("Generic", "Belum di cut");
     }
     return(barringOrderDetail);
 }
 public BarringOrderDetail VHasNotBeenBarHeatPressed(BarringOrderDetail barringOrderDetail)
 {
     if (barringOrderDetail.IsBarHeatPressed)
     {
         barringOrderDetail.Errors.Add("Generic", "Bar sudah di heat press");
     }
     return(barringOrderDetail);
 }
        public BarringOrderDetail VHasBarring(BarringOrderDetail barringOrderDetail, IBarringService _barringService)
        {
            Barring barring = _barringService.GetObjectById(barringOrderDetail.BarringId);

            if (barring == null)
            {
                barringOrderDetail.Errors.Add("BarringId", "Tidak terasosiasi dengan Barring");
            }
            return(barringOrderDetail);
        }
 public BarringOrderDetail VUndoRejectObject(BarringOrderDetail barringOrderDetail, IBarringOrderService _barringOrderService)
 {
     VHasBeenRejected(barringOrderDetail);
     if (!isValid(barringOrderDetail))
     {
         return(barringOrderDetail);
     }
     VBarringOrderHasNotBeenCompleted(barringOrderDetail, _barringOrderService);
     return(barringOrderDetail);
 }
        public BarringOrderDetail VBarringOrderHasBeenConfirmed(BarringOrderDetail barringOrderDetail, IBarringOrderService _barringOrderService)
        {
            BarringOrder barringOrder = _barringOrderService.GetObjectById(barringOrderDetail.BarringOrderId);

            if (!barringOrder.IsConfirmed)
            {
                barringOrderDetail.Errors.Add("Generic", "Barring Order belum dikonfirmasi");
            }
            return(barringOrderDetail);
        }
 public BarringOrderDetail VCutObject(BarringOrderDetail barringOrderDetail)
 {
     VHasNotBeenCut(barringOrderDetail);
     if (!isValid(barringOrderDetail))
     {
         return(barringOrderDetail);
     }
     VHasNotBeenRejected(barringOrderDetail);
     return(barringOrderDetail);
 }
 public BarringOrderDetail VAddRightBar(BarringOrderDetail barringOrderDetail)
 {
     VIsBarRequiredMustBeTrue(barringOrderDetail);
     if (!isValid(barringOrderDetail))
     {
         return(barringOrderDetail);
     }
     VHasNoRightBar(barringOrderDetail);
     return(barringOrderDetail);
 }
 public BarringOrderDetail VCreateObject(BarringOrderDetail barringOrderDetail, IBarringOrderService _barringOrderService, IBarringService _barringService)
 {
     VHasBarringOrder(barringOrderDetail, _barringOrderService);
     if (!isValid(barringOrderDetail))
     {
         return(barringOrderDetail);
     }
     VHasBarring(barringOrderDetail, _barringService);
     return(barringOrderDetail);
 }
        public BarringOrderDetail VBarringOrderHasNotBeenCompleted(BarringOrderDetail barringOrderDetail, IBarringOrderService _barringOrderService)
        {
            BarringOrder barringOrder = _barringOrderService.GetObjectById(barringOrderDetail.BarringOrderId);

            if (barringOrder.IsCompleted)
            {
                barringOrderDetail.Errors.Add("Generic", "Barring order sudah complete");
            }
            return(barringOrderDetail);
        }
        public IList <StockMutation> SoftDeleteStockMutationForBarringOrder(BarringOrderDetail barringOrderDetail, WarehouseItem warehouseItem)
        {
            IList <StockMutation> stockMutations = _repository.GetObjectsBySourceDocumentDetailForWarehouseItem(warehouseItem.Id, Constant.SourceDocumentDetailType.BarringOrderDetail, barringOrderDetail.Id);

            foreach (var stockMutation in stockMutations)
            {
                _repository.Delete(stockMutation);
            }
            return(stockMutations);
        }
Beispiel #29
0
        public dynamic ProgressDetail(int Id, string Progress)
        {
            var model = new BarringOrderDetail();

            try
            {
                var data = _barringOrderDetailService.GetObjectById(Id);
                if (Progress == "IsCut")
                {
                    model = _barringOrderDetailService.CutObject(data);
                }
                else if (Progress == "IsSideSealed")
                {
                    model = _barringOrderDetailService.SideSealObject(data);
                }
                else if (Progress == "IsBarPrepared")
                {
                    model = _barringOrderDetailService.PrepareObject(data);
                }
                else if (Progress == "IsAdhesiveTapeApplied")
                {
                    model = _barringOrderDetailService.ApplyTapeAdhesiveToObject(data);
                }
                else if (Progress == "IsBarMounted")
                {
                    model = _barringOrderDetailService.MountObject(data);
                }
                else if (Progress == "IsBarHeatPressed")
                {
                    model = _barringOrderDetailService.HeatPressObject(data);
                }
                else if (Progress == "IsBarPullOffTested")
                {
                    model = _barringOrderDetailService.PullOffTestObject(data);
                }
                else if (Progress == "IsQCAndMarked")
                {
                    model = _barringOrderDetailService.QCAndMarkObject(data);
                }
                else if (Progress == "IsPackaged")
                {
                    model = _barringOrderDetailService.PackageObject(data);
                }
            }
            catch (Exception ex)
            {
                LOG.Error("Update Failed", ex);
                model.Errors.Add("Generic", "Error : " + ex);
            }

            return(Json(new
            {
                model.Errors
            }));
        }
        public BarringOrderDetail UnfinishObject(BarringOrderDetail barringOrderDetail, IBarringOrderService _barringOrderService, IStockMutationService _stockMutationService,
                                                 IBarringService _barringService, IItemService _itemService, IWarehouseItemService _warehouseItemService)
        {
            if (_validator.ValidUnfinishObject(barringOrderDetail, _barringOrderService))
            {
                _repository.UnfinishObject(barringOrderDetail);
                // deduce barring order quantity final
                BarringOrder barringOrder = _barringOrderService.GetObjectById(barringOrderDetail.BarringOrderId);
                barringOrder.QuantityFinal -= 1;
                _barringOrderService.AdjustQuantity(barringOrder);

                // reverse stock mutation
                Barring               barring          = _barringService.GetObjectById(barringOrderDetail.BarringId);
                WarehouseItem         warehouseBarring = _warehouseItemService.FindOrCreateObject(barringOrder.WarehouseId, barring.Id);
                IList <StockMutation> stockMutations   = _stockMutationService.SoftDeleteStockMutationForBarringOrder(barringOrderDetail, warehouseBarring);
                foreach (var stockMutation in stockMutations)
                {
                    _stockMutationService.ReverseStockMutateObject(stockMutation, _itemService, _barringService, _warehouseItemService);
                }

                if (barringOrderDetail.IsBarRequired)
                {
                    Item leftbar  = (barringOrderDetail.HasLeftBar && barring.LeftBarItemId != null) ? _itemService.GetObjectById((int)barring.LeftBarItemId) : null;
                    Item rightbar = (barringOrderDetail.HasRightBar && barring.RightBarItemId != null) ? _itemService.GetObjectById((int)barring.RightBarItemId) : null;
                    if (leftbar != null)
                    {
                        WarehouseItem         warehouseLeftBar      = _warehouseItemService.FindOrCreateObject(barringOrder.WarehouseId, leftbar.Id);
                        IList <StockMutation> stockMutationLeftBars = _stockMutationService.SoftDeleteStockMutationForBarringOrder(barringOrderDetail, warehouseLeftBar);
                        foreach (var stockMutationLeftBar in stockMutationLeftBars)
                        {
                            _stockMutationService.ReverseStockMutateObject(stockMutationLeftBar, _itemService, _barringService, _warehouseItemService);
                        }
                    }
                    if (rightbar != null)
                    {
                        WarehouseItem         warehouseRightBar      = _warehouseItemService.FindOrCreateObject(barringOrder.WarehouseId, rightbar.Id);
                        IList <StockMutation> stockMutationRightBars = _stockMutationService.SoftDeleteStockMutationForBarringOrder(barringOrderDetail, warehouseRightBar);
                        foreach (var stockMutationRightBar in stockMutationRightBars)
                        {
                            _stockMutationService.ReverseStockMutateObject(stockMutationRightBar, _itemService, _barringService, _warehouseItemService);
                        }
                    }
                }

                WarehouseItem         warehouseBlanket      = _warehouseItemService.FindOrCreateObject(barringOrder.WarehouseId, barring.BlanketItemId);
                IList <StockMutation> stockMutationBlankets = _stockMutationService.SoftDeleteStockMutationForBarringOrder(barringOrderDetail, warehouseBlanket);
                foreach (var stockMutationBlanket in stockMutationBlankets)
                {
                    _stockMutationService.ReverseStockMutateObject(stockMutationBlanket, _itemService, _barringService, _warehouseItemService);
                }
            }
            return(barringOrderDetail);
        }