예제 #1
0
 public ContainerData getOutstandingActionsCount(ContainerData.ReconciliationRequest Request)
 {
     _setContainersTree(Request);
     if (ContainersTree.getChildNodeCount() > 0)
     {
         for (int i = 0; i < ContainersTree.getChildNodeCount(); i++) //Location Nodes
         {
             ContainersTree.goToNthChild(i);
             if (ContainersTree.getChildNodeCount() > 0)
             {
                 for (int j = 0; j < ContainersTree.getChildNodeCount(); j++) //Container Nodes
                 {
                     ContainersTree.goToNthChild(j);
                     if (ContainersTree.getChildNodeCount() > 0) //ContainerLocation Nodes
                     {
                         CswNbtObjClassContainerLocation ContainerLocationNode = _getMostRelevantContainerLocation();
                         if (null != ContainerLocationNode &&
                             false == String.IsNullOrEmpty(ContainerLocationNode.Action.Value) &&
                             ContainerLocationNode.Action.Value != CswEnumNbtContainerLocationTypeOptions.Ignore.ToString() &&
                             ContainerLocationNode.ActionApplied.Checked != CswEnumTristate.True)
                         {
                             Data.OutstandingActionsCount++;
                         }
                     }
                     ContainersTree.goToParentNode();
                 }
             }
             ContainersTree.goToParentNode();
         }
     }
     return(Data);
 }
예제 #2
0
 public void saveContainerActions(ContainerData.ReconciliationRequest Request)
 {
     if (null != Request.ContainerActions)
     {
         foreach (ContainerData.ReconciliationActions Action in Request.ContainerActions)
         {
             if (Action.Action == CswEnumNbtContainerLocationActionOptions.MarkMissing.ToString())
             {
                 _createNotScannedContainerLocation(Action, CswEnumNbtContainerLocationTypeOptions.Missing);
             }
             else
             {
                 CswPrimaryKey ContLocNodeId = CswConvert.ToPrimaryKey(Action.ContainerLocationId);
                 if (CswTools.IsPrimaryKey(ContLocNodeId))
                 {
                     CswNbtObjClassContainerLocation ContLocNode = _CswNbtResources.Nodes.GetNode(ContLocNodeId);
                     ContLocNode.Action.Value = Action.Action;
                     ContLocNode.ActionByUser.RelatedNodeId = _CswNbtResources.CurrentNbtUser.UserId;
                     ContLocNode.postChanges(false);
                 }
                 else if (Action.Action == CswEnumNbtContainerLocationActionOptions.Ignore.ToString())
                 {
                     _createNotScannedContainerLocation(Action, CswEnumNbtContainerLocationTypeOptions.Ignore);
                 }
             }
         }
     }
 }
예제 #3
0
        private CswNbtView _getReconciliationScansForOutOfScopeContainersView(ContainerData.ReconciliationRequest Request)
        {
            Collection <CswPrimaryKey> LocationIds = _getLocationIds(Request);

            CswNbtMetaDataObjectClass     LocationOC          = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.LocationClass);
            CswNbtMetaDataObjectClass     ContainerOC         = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ContainerClass);
            CswNbtMetaDataObjectClassProp CLocationOCP        = ContainerOC.getObjectClassProp(CswNbtObjClassContainer.PropertyName.Location);
            CswNbtMetaDataObjectClass     ContainerLocationOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ContainerLocationClass);
            CswNbtMetaDataObjectClassProp ContainerOCP        = ContainerLocationOC.getObjectClassProp(CswNbtObjClassContainerLocation.PropertyName.Container);
            CswNbtMetaDataObjectClassProp TypeOCP             = ContainerLocationOC.getObjectClassProp(CswNbtObjClassContainerLocation.PropertyName.Type);
            CswNbtMetaDataObjectClassProp LocationOCP         = ContainerLocationOC.getObjectClassProp(CswNbtObjClassContainerLocation.PropertyName.Location);
            CswNbtMetaDataObjectClassProp ScanDateOCP         = ContainerLocationOC.getObjectClassProp(CswNbtObjClassContainerLocation.PropertyName.ScanDate);

            CswNbtView ContainerLocationsView = new CswNbtView(_CswNbtResources);
            //Filter to selected location (and all child locations if applicable)
            CswNbtViewRelationship LocationVR = ContainerLocationsView.AddViewRelationship(LocationOC, false);

            LocationVR.NodeIdsToFilterIn = LocationIds;
            CswCommaDelimitedString LocIds = new CswCommaDelimitedString();

            foreach (CswPrimaryKey LocId in LocationIds)
            {
                LocIds.Add(LocId.PrimaryKey.ToString());
            }
            //Filter to Container Location records of type Reconcile Scans in the current time scope
            CswNbtViewRelationship ContainerLocationVR = ContainerLocationsView.AddViewRelationship(LocationVR, CswEnumNbtViewPropOwnerType.Second, LocationOCP, false);
            CswNbtViewProperty     TypeVP = ContainerLocationsView.AddViewProperty(ContainerLocationVR, TypeOCP);

            ContainerLocationsView.AddViewPropertyFilter(TypeVP, FilterMode: CswEnumNbtFilterMode.Equals, Value: CswEnumNbtContainerLocationTypeOptions.ReconcileScans.ToString());
            CswNbtViewProperty ScanDateVP = ContainerLocationsView.AddViewProperty(ContainerLocationVR, ScanDateOCP);

            if (CswConvert.ToDateTime(Request.StartDate) > CswConvert.ToDateTime(Request.EndDate))
            {
                Request.StartDate = Request.EndDate;
            }
            ContainerLocationsView.AddViewPropertyFilter(ScanDateVP, FilterMode: CswEnumNbtFilterMode.GreaterThanOrEquals, Value: Request.StartDate);
            ContainerLocationsView.AddViewPropertyFilter(ScanDateVP, FilterMode: CswEnumNbtFilterMode.LessThanOrEquals, Value: Request.EndDate);
            ContainerLocationsView.setSortProperty(ScanDateVP, CswEnumNbtViewPropertySortMethod.Descending);
            //Filter to Containers not matching current location scope
            CswNbtViewRelationship ContainerVR = ContainerLocationsView.AddViewRelationship(ContainerLocationVR, CswEnumNbtViewPropOwnerType.First, ContainerOCP, false);
            CswNbtViewProperty     CLocVP      = ContainerLocationsView.AddViewProperty(ContainerVR, CLocationOCP);

            ContainerLocationsView.AddViewPropertyFilter(CLocVP, CswEnumNbtSubFieldName.NodeID, CswEnumNbtFilterMode.In, LocIds.ToString());

            return(ContainerLocationsView);
        }
예제 #4
0
        private bool _isTypeEnabled(String Type, ContainerData.ReconciliationRequest Request)
        {
            bool Enabled = false;

            foreach (ContainerData.ReconciliationTypes ContainerLocationType in Request.ContainerLocationTypes)
            {
                if (Type == ContainerLocationType.Type ||
                    (ContainerLocationType.Type == CswEnumNbtContainerLocationTypeOptions.Touch.ToString() &&
                     (Type == CswEnumNbtContainerLocationTypeOptions.Move.ToString() ||
                      Type == CswEnumNbtContainerLocationTypeOptions.Dispense.ToString() ||
                      Type == CswEnumNbtContainerLocationTypeOptions.Dispose.ToString() ||
                      Type == CswEnumNbtContainerLocationTypeOptions.Undispose.ToString())))
                {
                    Enabled = ContainerLocationType.Enabled;
                }
            }
            return(Enabled);
        }
예제 #5
0
 private void _setContainersTree(ContainerData.ReconciliationRequest Request)
 {
     if (null == ContainersTree)
     {
         try//TODO - remove try/catch block when Case 28194 is resolved
         {
             ContainersTree = _CswNbtResources.Trees.getTreeFromView(_getReconciliationView(Request), false, true, false);
         }
         catch (Exception ex)
         {
             String ErrorMessage = "Treeloader error occured.";
             if (ex.StackTrace.Contains("ORA-01795"))
             {
                 ErrorMessage += " Too many child locations.";
             }
             throw new CswDniException(CswEnumErrorType.Error, "Unable to get Reconciliation data.", ErrorMessage, ex);
         }
     }
 }
예제 #6
0
        private Collection <CswPrimaryKey> _getLocationIds(ContainerData.ReconciliationRequest Request)
        {
            Collection <CswPrimaryKey> LocationIds = new Collection <CswPrimaryKey>();
            CswPrimaryKey RootLocationId           = CswConvert.ToPrimaryKey(Request.LocationId);

            if (null != RootLocationId)
            {
                if (Request.IncludeChildLocations)
                {
                    CswNbtView  LocationTreeView = CswNbtNodePropLocation.LocationPropertyView(_CswNbtResources, null);
                    ICswNbtTree LocationTree     = _CswNbtResources.Trees.getTreeFromView(LocationTreeView, false, true, false);
                    _addChildLocationIds(RootLocationId, LocationTree, LocationIds);
                }
                else
                {
                    LocationIds.Add(RootLocationId);
                }
            }
            return(LocationIds);
        }
예제 #7
0
        private CswNbtView _getReconciliationView(ContainerData.ReconciliationRequest Request)
        {
            Collection <CswPrimaryKey> LocationIds = _getLocationIds(Request);

            CswNbtMetaDataObjectClass     LocationOC          = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.LocationClass);
            CswNbtMetaDataObjectClass     ContainerOC         = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ContainerClass);
            CswNbtMetaDataObjectClassProp LocationOCP         = ContainerOC.getObjectClassProp(CswNbtObjClassContainer.PropertyName.Location);
            CswNbtMetaDataObjectClassProp DateCreatedOCP      = ContainerOC.getObjectClassProp(CswNbtObjClassContainer.PropertyName.DateCreated);
            CswNbtMetaDataObjectClassProp DisposedOCP         = ContainerOC.getObjectClassProp(CswNbtObjClassContainer.PropertyName.Disposed);
            CswNbtMetaDataObjectClass     ContainerLocationOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ContainerLocationClass);
            CswNbtMetaDataObjectClassProp ContainerOCP        = ContainerLocationOC.getObjectClassProp(CswNbtObjClassContainerLocation.PropertyName.Container);
            CswNbtMetaDataObjectClassProp ScanDateOCP         = ContainerLocationOC.getObjectClassProp(CswNbtObjClassContainerLocation.PropertyName.ScanDate);

            CswNbtView ContainersView = new CswNbtView(_CswNbtResources);

            CswNbtViewRelationship LocationVR = ContainersView.AddViewRelationship(LocationOC, false);

            LocationVR.NodeIdsToFilterIn = LocationIds;
            CswNbtViewRelationship ContainerVR   = ContainersView.AddViewRelationship(LocationVR, CswEnumNbtViewPropOwnerType.Second, LocationOCP, false);
            CswNbtViewProperty     DateCreatedVP = ContainersView.AddViewProperty(ContainerVR, DateCreatedOCP);

            ContainersView.AddViewPropertyFilter(DateCreatedVP, FilterMode: CswEnumNbtFilterMode.LessThanOrEquals, Value: Request.EndDate);
            CswNbtViewProperty     DisposedVP          = ContainersView.AddViewProperty(ContainerVR, DisposedOCP);
            CswNbtViewRelationship ContainerLocationVR = ContainersView.AddViewRelationship(ContainerVR, CswEnumNbtViewPropOwnerType.Second, ContainerOCP, false);
            CswNbtViewProperty     ScanDateVP          = ContainersView.AddViewProperty(ContainerLocationVR, ScanDateOCP);

            if (CswConvert.ToDateTime(Request.StartDate) > CswConvert.ToDateTime(Request.EndDate))
            {
                Request.StartDate = Request.EndDate;
            }
            ContainersView.AddViewPropertyFilter(ScanDateVP, FilterMode: CswEnumNbtFilterMode.GreaterThanOrEquals, Value: Request.StartDate);
            ContainersView.AddViewPropertyFilter(ScanDateVP, FilterMode: CswEnumNbtFilterMode.LessThanOrEquals, Value: Request.EndDate);
            ContainersView.setSortProperty(ScanDateVP, CswEnumNbtViewPropertySortMethod.Descending);

            return(ContainersView);
        }
예제 #8
0
 public ContainerData getContainerStatistics(ContainerData.ReconciliationRequest Request)
 {
     for (int i = 0; i < CswEnumNbtContainerLocationStatusOptions._All.Count(); i++)
     {
         Data.ContainerStatistics.Add(new ContainerData.ReconciliationStatistics());
         Data.ContainerStatistics[i].ContainerCount = 0;
         Data.ContainerStatistics[i].AmountScanned  = 0;
         Data.ContainerStatistics[i].Status         = CswEnumNbtContainerLocationStatusOptions._All.ToArray()[i].ToString();
     }
     _setContainersTree(Request);
     if (ContainersTree.getChildNodeCount() > 0)
     {
         Collection <CswPrimaryKey> AllLocationIds     = new Collection <CswPrimaryKey>();
         Collection <CswPrimaryKey> ScannedLocationIds = new Collection <CswPrimaryKey>();
         for (int i = 0; i < ContainersTree.getChildNodeCount(); i++) //Location Nodes
         {
             ContainersTree.goToNthChild(i);
             AllLocationIds.Add(ContainersTree.getNodeIdForCurrentPosition());
             if (ContainersTree.getChildNodeCount() > 0)
             {
                 for (int j = 0; j < ContainersTree.getChildNodeCount(); j++) //Container Nodes
                 {
                     ContainersTree.goToNthChild(j);
                     CswNbtTreeNodeProp DisposedProp = ContainersTree.getChildNodePropsOfNode().FirstOrDefault(p => p.ObjectClassPropName == CswNbtObjClassContainer.PropertyName.Disposed);
                     if (ContainersTree.getChildNodeCount() > 0) //ContainerLocation Nodes
                     {
                         CswNbtObjClassContainerLocation ContainerLocationNode = _getMostRelevantContainerLocation();
                         if (null != ContainerLocationNode && _isTypeEnabled(ContainerLocationNode.Type.Value, Request))
                         {
                             _incrementContainerCount(Data.ContainerStatistics,
                                                      ContainerLocationNode.Status.Value,
                                                      ContainerLocationNode.Type.Value);
                             if (ContainerLocationNode.Type.Value == CswEnumNbtContainerLocationTypeOptions.ReconcileScans.ToString())
                             {
                                 ScannedLocationIds.Add(ContainerLocationNode.Location.SelectedNodeId);
                             }
                         }
                         else if (null != DisposedProp && false == CswConvert.ToBoolean(DisposedProp.Field1))
                         {
                             _incrementContainerCount(Data.ContainerStatistics, CswEnumNbtContainerLocationStatusOptions.NotScanned.ToString());
                         }
                     }
                     else
                     {
                         _incrementContainerCount(Data.ContainerStatistics, CswEnumNbtContainerLocationStatusOptions.NotScanned.ToString());
                     }
                     ContainersTree.goToParentNode();
                 }
             }
             ContainersTree.goToParentNode();
         }
         if (_isTypeEnabled(CswEnumNbtContainerLocationTypeOptions.ReconcileScans.ToString(), Request))
         {
             foreach (CswPrimaryKey LocationId in AllLocationIds)
             {
                 if (false == ScannedLocationIds.Contains(LocationId))
                 {
                     Data.UnscannedLocations.Add(_makeUnscannedLocation(LocationId));
                 }
             }
         }
     }
     foreach (CswNbtObjClassContainerLocation OutOfScopeScan in _getRelevantScansOutsideLocationScope(Request).Values)
     {
         _incrementContainerCount(Data.ContainerStatistics, CswEnumNbtContainerLocationStatusOptions.WrongLocation.ToString());
     }
     foreach (ContainerData.ReconciliationStatistics Stat in Data.ContainerStatistics)
     {
         if (Stat.ContainerCount > 0)
         {
             Stat.PercentScanned = CswConvert.ToDouble(Stat.AmountScanned) / CswConvert.ToDouble(Stat.ContainerCount) * 100.0;
         }
         else
         {
             Stat.PercentScanned = 0.0;
         }
     }
     return(Data);
 }
예제 #9
0
        private Dictionary <CswPrimaryKey, CswNbtObjClassContainerLocation> _getRelevantScansOutsideLocationScope(ContainerData.ReconciliationRequest Request)
        {
            Dictionary <CswPrimaryKey, CswNbtObjClassContainerLocation> OutOfScopeScans = new Dictionary <CswPrimaryKey, CswNbtObjClassContainerLocation>();
            ICswNbtTree OutOfScopeScansTree = _CswNbtResources.Trees.getTreeFromView(_getReconciliationScansForOutOfScopeContainersView(Request), false, true, false);

            if (OutOfScopeScansTree.getChildNodeCount() > 0)
            {
                for (int i = 0; i < OutOfScopeScansTree.getChildNodeCount(); i++) //Location Nodes
                {
                    OutOfScopeScansTree.goToNthChild(i);
                    if (OutOfScopeScansTree.getChildNodeCount() > 0)
                    {
                        for (int j = 0; j < OutOfScopeScansTree.getChildNodeCount(); j++) //ContainerLocation Nodes
                        {
                            OutOfScopeScansTree.goToNthChild(j);
                            if (OutOfScopeScansTree.getChildNodeCount() == 0) //Container Nodes
                            {
                                //No container means it's out of scope - only add the most recent scan record
                                CswNbtObjClassContainerLocation OutOfScopeScan = OutOfScopeScansTree.getNodeForCurrentPosition();
                                if (false == OutOfScopeScans.ContainsKey(OutOfScopeScan.Container.RelatedNodeId))
                                {
                                    OutOfScopeScans.Add(OutOfScopeScan.Container.RelatedNodeId, OutOfScopeScan);
                                }
                            }
                            OutOfScopeScansTree.goToParentNode();
                        }
                    }
                    OutOfScopeScansTree.goToParentNode();
                }
            }
            return(OutOfScopeScans);
        }
예제 #10
0
 public ContainerData getReconciliationData(ContainerData.ReconciliationRequest Request)
 {
     getContainerStatistics(Request);
     getContainerStatuses(Request);
     return(Data);
 }
예제 #11
0
 public ContainerData getContainerStatuses(ContainerData.ReconciliationRequest Request)
 {
     _setContainersTree(Request);
     if (ContainersTree.getChildNodeCount() > 0)
     {
         for (int i = 0; i < ContainersTree.getChildNodeCount(); i++) //Location Nodes
         {
             ContainersTree.goToNthChild(i);
             CswPrimaryKey LocationId = ContainersTree.getNodeIdForCurrentPosition();
             if (ContainersTree.getChildNodeCount() > 0)
             {
                 for (int j = 0; j < ContainersTree.getChildNodeCount(); j++) //Container Nodes
                 {
                     bool IncludeContainer = true;
                     ContainerData.ReconciliationStatuses ContainerStatus = new ContainerData.ReconciliationStatuses();
                     ContainersTree.goToNthChild(j);
                     CswNbtNode ContainerNode = ContainersTree.getNodeForCurrentPosition();//In this case, instancing the base node is faster
                     ContainerStatus.ContainerId      = ContainerNode.NodeId.ToString();
                     ContainerStatus.ContainerBarcode = ContainerNode.Properties[CswNbtObjClassContainer.PropertyName.Barcode].AsBarcode.Barcode;
                     ContainerStatus.LocationId       = LocationId.ToString();
                     ContainerStatus.ExpectedLocation = ContainerNode.Properties[CswNbtObjClassContainer.PropertyName.Location].AsLocation.CachedFullPath;
                     ContainerStatus.ContainerStatus  = CswEnumNbtContainerLocationStatusOptions.NotScanned.ToString();
                     CswPrimaryKey ScannedLocationId = null;
                     if (ContainersTree.getChildNodeCount() > 0) //ContainerLocation Nodes
                     {
                         CswNbtObjClassContainerLocation ContainerLocationNode = _getMostRelevantContainerLocation();
                         if (null != ContainerLocationNode)
                         {
                             ContainerStatus.ContainerLocationId = ContainerLocationNode.NodeId.ToString();
                             ScannedLocationId         = ContainerLocationNode.Location.SelectedNodeId;
                             ContainerStatus.ScanDate  = ContainerLocationNode.ScanDate.DateTimeValue.Date.ToShortDateString();
                             ContainerStatus.Action    = ContainerLocationNode.Action.Value;
                             ContainerStatus.Completed = ContainerLocationNode.ActionApplied.Checked.ToString();
                             if (_isTypeEnabled(ContainerLocationNode.Type.Value, Request))
                             {
                                 ContainerStatus.ContainerStatus = ContainerLocationNode.Status.Value;
                                 if (ContainerLocationNode.Type.Value == CswEnumNbtContainerLocationTypeOptions.ReconcileScans.ToString())
                                 {
                                     ContainerStatus.ScannedLocation = ContainerLocationNode.Location.CachedFullPath;
                                 }
                             }
                             else if (ContainerNode.Properties[CswNbtObjClassContainer.PropertyName.Disposed].AsLogical.Checked == CswEnumTristate.True)
                             {
                                 IncludeContainer = false;
                             }
                         }
                     }
                     ContainerStatus.ActionOptions = _getActionOptions(ContainerStatus.ContainerStatus, ScannedLocationId);
                     if (IncludeContainer)
                     {
                         Data.ContainerStatuses.Add(ContainerStatus);
                     }
                     ContainersTree.goToParentNode();
                 }
             }
             ContainersTree.goToParentNode();
         }
     }
     foreach (CswNbtObjClassContainerLocation OutOfScopeScan in _getRelevantScansOutsideLocationScope(Request).Values)
     {
         CswNbtNode ContainerNode = _CswNbtResources.Nodes[OutOfScopeScan.Container.RelatedNodeId];
         Data.ContainerStatuses.Add(new ContainerData.ReconciliationStatuses
         {
             ContainerId         = OutOfScopeScan.Container.RelatedNodeId.ToString(),
             ContainerBarcode    = OutOfScopeScan.ContainerScan.Text,
             LocationId          = OutOfScopeScan.Location.SelectedNodeId.ToString(),
             ExpectedLocation    = ContainerNode.Properties[CswNbtObjClassContainer.PropertyName.Location].AsLocation.CachedFullPath,
             ScannedLocation     = OutOfScopeScan.Location.CachedFullPath,
             ContainerStatus     = CswEnumNbtContainerLocationStatusOptions.WrongLocation.ToString(),
             ContainerLocationId = OutOfScopeScan.NodeId.ToString(),
             ScanDate            = OutOfScopeScan.ScanDate.DateTimeValue.Date.ToShortDateString(),
             Action        = OutOfScopeScan.Action.Value,
             Completed     = OutOfScopeScan.ActionApplied.Checked.ToString(),
             ActionOptions = _getActionOptions(CswEnumNbtContainerLocationStatusOptions.WrongLocation.ToString(), OutOfScopeScan.Location.SelectedNodeId)
         });
     }
     return(Data);
 }