public void processReconciliationActionsTestUndisposeAndMove()
        {
            CswPrimaryKey ContainerLocId, ContainerLocationLocId;

            TestData.getTwoDifferentLocationIds(out ContainerLocId, out ContainerLocationLocId);

            CswNbtObjClassContainer ContainerNode = TestData.Nodes.createContainerNode(LocationId: ContainerLocId);

            ContainerNode.DisposeContainer();
            Assert.AreEqual(CswEnumTristate.True, ContainerNode.Disposed.Checked.ToString());
            CswNbtObjClassContainerLocation ContainerLocationNode = TestData.Nodes.createContainerLocationNode(
                ContainerNode.Node,
                CswEnumNbtContainerLocationActionOptions.UndisposeAndMove.ToString(),
                LocationId: ContainerLocationLocId,
                Type: CswEnumNbtContainerLocationTypeOptions.ReconcileScans.ToString());

            Assert.AreNotEqual(ContainerLocationNode.Location.SelectedNodeId, ContainerNode.Location.SelectedNodeId);
            Assert.AreEqual(CswEnumNbtContainerLocationStatusOptions.DisposedAtWrongLocation.ToString(), ContainerLocationNode.Status.Value);

            CswScheduleLogicNbtContainerReconciliationActions Sched = _getReconciliationActionSched();

            Sched.processReconciliationActions(TestData.CswNbtResources);
            Assert.AreEqual(CswEnumTristate.True, ContainerLocationNode.ActionApplied.Checked.ToString());
            Assert.AreEqual(ContainerLocationNode.Location.SelectedNodeId, ContainerNode.Location.SelectedNodeId);
            Assert.AreEqual(CswEnumTristate.False, ContainerNode.Missing.Checked.ToString());
            Assert.AreEqual(CswEnumTristate.False, ContainerNode.Disposed.Checked.ToString());
        }
        public override void CommitOperation(ref OperationData OpData)
        {
            CswNbtObjClassContainer containerToDispose = _CswNbtResources.Nodes[OpData.Field1.NodeId];

            if (_CswNbtResources.Permit.canNodeType(CswEnumNbtNodeTypePermission.Edit, containerToDispose.NodeType) && _CswNbtResources.Permit.can(CswEnumNbtActionName.DisposeContainer))
            {
                if (CswEnumTristate.True == containerToDispose.Disposed.Checked)
                {
                    OpData.Field1.StatusMsg = "Container " + OpData.Field1.Value + " is already disposed";
                    OpData.Log.Add(DateTime.Now + " - ERROR: Attempted to dispose already disposed container " + OpData.Field1.Value);
                }
                else
                {
                    containerToDispose.DisposeContainer();
                    containerToDispose.postChanges(false);
                    OpData.Log.Add(DateTime.Now + " - Disposed container " + OpData.Field1.Value);
                    OpData.Field1.Value = string.Empty;
                }
                OpData.Field1.ServerValidated = false;
            }
            else
            {
                string statusMsg = "You do not have permission to dispose Container (" + OpData.Field1.Value + ")";
                OpData.Field1.StatusMsg       = statusMsg;
                OpData.Field1.ServerValidated = false;
                OpData.Log.Add(DateTime.Now + " - ERROR: " + statusMsg);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Abstract override to be called on onButtonClick
        /// </summary>
        public override bool onPropertySetButtonClick(NbtButtonData ButtonData)
        {
            if (null != ButtonData.NodeTypeProp)
            {
                //Remember: Save is an OCP too
                switch (ButtonData.NodeTypeProp.getObjectClassPropName())
                {
                case PropertyName.Fulfill:
                    CswNbtObjClassContainer NodeAsContainer = null;
                    switch (ButtonData.SelectedText)
                    {
                    case FulfillMenu.Dispose:
                        NodeAsContainer = _CswNbtResources.Nodes.GetNode(Container.RelatedNodeId);
                        if (null != NodeAsContainer)
                        {
                            NodeAsContainer.DisposeContainer();
                            NodeAsContainer.postChanges(true);
                            Status.Value = Statuses.Completed;
                        }
                        ButtonData.Action = CswEnumNbtButtonAction.refresh;
                        break;

                    case FulfillMenu.Move:
                        if (null != Container.RelatedNodeId)
                        {
                            NodeAsContainer = _CswNbtResources.Nodes.GetNode(Container.RelatedNodeId);
                            if (null != NodeAsContainer)
                            {
                                NodeAsContainer.Location.SelectedNodeId = Location.SelectedNodeId;
                                NodeAsContainer.Location.CachedNodeName = Location.CachedNodeName;
                                NodeAsContainer.Location.CachedPath     = Location.CachedPath;
                                NodeAsContainer.postChanges(false);
                                Status.Value      = Statuses.Completed;
                                ButtonData.Action = CswEnumNbtButtonAction.refresh;
                            }
                        }
                        break;
                    }     //switch( ButtonData.SelectedText )

                    _getNextStatus(ButtonData.SelectedText);

                    ButtonData.Data["requestitem"] = ButtonData.Data["requestitem"] ?? new JObject();
                    ButtonData.Data["requestitem"]["requestitemid"] = NodeId.ToString();
                    ButtonData.Data["requestitem"]["containerid"]   = (Container.RelatedNodeId ?? new CswPrimaryKey()).ToString();
                    ButtonData.Data["requestitem"]["locationid"]    = (Location.SelectedNodeId ?? new CswPrimaryKey()).ToString();
                    break;
                }//case PropertyName.Fulfill:
            }
            return(true);
        }
        public void processReconciliationActionsTestUndispose()
        {
            CswNbtObjClassContainer ContainerNode = TestData.Nodes.createContainerNode();

            ContainerNode.DisposeContainer();
            Assert.AreEqual(CswEnumTristate.True, ContainerNode.Disposed.Checked.ToString());
            CswNbtObjClassContainerLocation ContainerLocationNode = TestData.Nodes.createContainerLocationNode(ContainerNode.Node, CswEnumNbtContainerLocationActionOptions.Undispose.ToString());

            CswScheduleLogicNbtContainerReconciliationActions Sched = _getReconciliationActionSched();

            Sched.processReconciliationActions(TestData.CswNbtResources);
            Assert.AreEqual(CswEnumTristate.True, ContainerLocationNode.ActionApplied.Checked.ToString());
            Assert.AreEqual(CswEnumTristate.False, ContainerNode.Disposed.Checked.ToString());
            Assert.AreEqual(CswEnumTristate.False, ContainerNode.Missing.Checked.ToString());
        }
        public void setStatusTestDisposedAtWrongLocation()
        {
            CswPrimaryKey ContainerLocId, ContainerLocationLocId;

            TestData.getTwoDifferentLocationIds(out ContainerLocId, out ContainerLocationLocId);
            CswNbtObjClassContainer ContainerNode = TestData.Nodes.createContainerNode(LocationId: ContainerLocId);

            ContainerNode.DisposeContainer();
            Assert.AreEqual(CswEnumTristate.True, ContainerNode.Disposed.Checked.ToString());
            CswNbtObjClassContainerLocation ContainerLocationNode = TestData.Nodes.createContainerLocationNode(
                ContainerNode.Node,
                CswEnumNbtContainerLocationActionOptions.Ignore.ToString(),
                LocationId: ContainerLocationLocId,
                Type: CswEnumNbtContainerLocationTypeOptions.ReconcileScans.ToString());

            Assert.AreNotEqual(ContainerLocationNode.Location.SelectedNodeId, ContainerNode.Location.SelectedNodeId);
            Assert.AreEqual(CswEnumNbtContainerLocationStatusOptions.DisposedAtWrongLocation.ToString(), ContainerLocationNode.Status.Value);
        }
Ejemplo n.º 6
0
        public void TierII_3Days_ContainerDispose()
        {
            CswPrimaryKey           LocationId    = TestData.Nodes.createLocationNode().NodeId;
            CswNbtNode              ChemicalNode  = TestData.Nodes.createMaterialNode(State: "Solid");
            CswNbtNode              PoundsUnit    = TestData.Nodes.createUnitOfMeasureNode("Weight", "lb", 4.53592, -1, CswEnumTristate.True);
            CswNbtObjClassContainer ContainerNode = TestData.Nodes.createContainerWithRecords("Container", 1, PoundsUnit, ChemicalNode, LocationId, DateTime.Today.AddDays(-1), CswEnumNbtContainerUseTypes.Closed);

            ContainerNode.DisposeContainer(true);
            ContainerNode.postChanges(false);
            TierIIData.TierIIDataRequest Request = new TierIIData.TierIIDataRequest
            {
                LocationId = LocationId.ToString(),
                StartDate  = DateTime.Today.AddDays(-1).ToString(),
                EndDate    = DateTime.Today.AddDays(1).ToString()
            };
            TierIIData Data = TierIIAction.getTierIIData(Request);

            Assert.AreEqual(1, Data.Materials[0].MaxQty);
            Assert.AreEqual(1, Data.Materials[0].AverageQty);
            Assert.AreEqual(2, Data.Materials[0].DaysOnSite);
        }
Ejemplo n.º 7
0
 private void _dispose(string operation, string barcode, CswNbtObjClassBatchOp BatchNode)
 {
     try
     {
         CswNbtObjClassContainer ContainerNode = _getNodeFromBarcode(barcode, CswEnumNbtObjectClass.ContainerClass, CswNbtObjClassContainer.PropertyName.Barcode);
         if (null != ContainerNode)
         {
             ContainerNode.DisposeContainer();
             ContainerNode.postChanges(false);
         }
         else
         {
             string msg = _generateErrorMessage(operation, barcode, null, "A container with barcode " + barcode + " does not exist.");
             _storeError(BatchNode, msg);
         }
     }
     catch (Exception e)
     {
         string msg = "The dispose operation failed for the container barcode " + barcode + "with exception: " + e;
         _storeError(BatchNode, msg);
     }
 }//_dispose()