예제 #1
0
        private bool DeductBalanceForCancellingGRN(Guid UnloadingId, SqlTransaction tran)
        {
            bool isSaved = false;
            // get stacks unloaded.
            List <StackUnloadedBLL> list = null;
            StackUnloadedBLL        o    = new StackUnloadedBLL();

            o.UnloadingId = UnLoadingId;
            list          = o.GetStackInformationByUnloadingId();
            if (list != null)
            {
                if (list.Count > 0)
                {
                    foreach (StackUnloadedBLL i in list)
                    {
                        InventoryServices.GetInventoryService().LoadFromStack(i.StackId, i.NumberOfbags, 0, tran);
                    }
                }
            }
            else
            {
                isSaved = false;
            }
            return(isSaved);
        }
예제 #2
0
 private void UpdateInventory(Guid StackId, int noBags, float Weight, SqlTransaction tran)
 {
     if (noBags > 0)
     {
         InventoryServices.GetInventoryService().UnloadToStack(StackId, noBags, Weight, tran);
     }
     else
     {
         InventoryServices.GetInventoryService().LoadFromStack(StackId, noBags, Weight, tran);
     }
 }
예제 #3
0
        public static void CompleteLoading(Guid truckId)
        {
            //check if page being processed outside a workflow context
            PageDataTransfer transferedData = new PageDataTransfer(HttpContext.Current.Request.Path);

            IGINProcess    ginProcess  = GetGINProcess(true);
            SqlTransaction transaction = null;

            try
            {
                AuditTrailWrapper auditTrail = new AuditTrailWrapper(AuditTrailWrapper.TruckLoading, "GIN Process");
                //GINInfo originalGIN = new GINInfo();
                //originalGIN.Copy(ginProcess.GINProcessInformation.Trucks[0].GIN);
                transaction = ginProcess.CompleteLoading(truckId);
                GINTruckInfo theTruck = ginProcess.GINProcessInformation.Trucks.Find(trk => trk.TruckId == truckId);
                foreach (var loadedStack in theTruck.Load.Stacks)
                {
                    InventoryServices.GetInventoryService().LoadFromStack(loadedStack.StackId, loadedStack.Bags, 0, transaction);
                    auditTrail.AddChange(
                        new TruckLoadInfo(),
                        new TruckLoadInfo(loadedStack.TruckId, theTruck.Load.DateLoaded, theTruck.Load.BagType, string.Empty),
                        AuditTrailWrapper.NewRecord);
                    if (!auditTrail.Save())
                    {
                        throw new Exception("Unable to log audit trail");
                    }
                }
                //auditTrail.AddChange(originalGIN, ginProcess.GINProcessInformation.Trucks[0].GIN);
                //if (!auditTrail.Save())
                //    throw new Exception("Failed to save audit trail!");
                CompleteWorkflowTask(ginProcess.GINProcessInformation.Trucks[0].TransactionId);
                //CompleteWorkflowTask(ginProcess.GINProcessInformation.Trucks[0].TransactionId);
                transaction.Commit();
            }
            catch (Exception ex)
            {
                try
                {
                    if (transaction != null)
                    {
                        transaction.Rollback();
                    }
                }
                catch (Exception ex2)
                {
                    throw ex2;
                }
                throw ex;
            }
        }
예제 #4
0
 public static PhysicalCountInfo GetPhysicalCountInformation(bool isPostBack)
 {
     if (!isPostBack)
     {
         PageDataTransfer   transferedData           = new PageDataTransfer(HttpContext.Current.Request.Path);
         Guid               physicalCountId          = (Guid)transferedData.GetTransferedData("PhysicalCountId");
         IInventoryServices invertoryServices        = InventoryServices.GetInventoryService();
         PhysicalCountInfo  physicalCountInformation = invertoryServices.OpenPhysicalCount(physicalCountId);
         HttpContext.Current.Session["Physical-Count-Information"] = physicalCountInformation;
         return(physicalCountInformation);
     }
     else
     {
         return((PhysicalCountInfo)HttpContext.Current.Session["Physical-Count-Information"]);
     }
 }
예제 #5
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            PhysicalCountInfo pc = new PhysicalCountInfo()
            {
                Id                = Guid.NewGuid(),
                WarehouseId       = new Guid(SystemLookup.LookupSource.GetLookup("CurrentWarehouse")["Id"]),
                IsBeginingCount   = false,
                PhysicalCountDate = DateTime.Now
            };

            InventoryServices.GetInventoryService().CreatePhysicalCount(pc);
            PageDataTransfer physicalCountTransfer = new PageDataTransfer(Request.ApplicationPath + "/TakePhysicalCount.aspx");

            physicalCountTransfer.RemoveAllData();
            physicalCountTransfer.TransferData["PhysicalCountId"] = pc.Id;
            physicalCountTransfer.TransferData["ReturnPage"]      = HttpContext.Current.Request.Path;
            physicalCountTransfer.Navigate();
        }
예제 #6
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            errorDisplayer = new ErrorMessageDisplayer(lblMessage);
            errorDisplayer.ClearErrorMessage();

            transferedData              = new PageDataTransfer(Request.Path);
            PhysicalCountEditor.Driver  = GINViewConfigurationReader.GetViewConfiguration("TakePhysicalCount", "PhysicalCount");
            InspectorDataEditor.Driver  = GINViewConfigurationReader.GetViewConfiguration("TakePhysicalCount", "Inspector");
            StackCountDataEditor.Driver = GINViewConfigurationReader.GetViewConfiguration("TakePhysicalCount", "StackCount");
            InspectorGridViewer.Driver  = GINViewConfigurationReader.GetViewConfiguration("TakePhysicalCount", "InspectorGrid");
            PhysicalCountEditor.IsNew   = false;

            InspectorDataEditor.Ok     += new EventHandler(InspectorDataEditor_Ok);
            InspectorDataEditor.Cancel += new EventHandler(InspectorDataEditor_Cancel);

            StackCountDataEditor.Ok     += new EventHandler(StackCountDataEditor_Ok);
            StackCountDataEditor.Cancel += new EventHandler(StackCountDataEditor_Cancel);
            try
            {
                inventoryService         = InventoryServices.GetInventoryService();
                physicalCountInformation = InventoryServiceWrapper.GetPhysicalCountInformation(IsPostBack);

                PhysicalCountEditor.Lookup  = inventoryService.LookupSource;
                InspectorDataEditor.Lookup  = inventoryService.LookupSource;
                StackCountDataEditor.Lookup = inventoryService.LookupSource;
                InspectorGridViewer.Lookup  = inventoryService.LookupSource;

                PhysicalCountEditor.Setup();
                InspectorDataEditor.Setup();
                StackCountDataEditor.Setup();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }