} // getPercentDone() /// <summary> /// Run the next iteration of this batch operation /// </summary> public void runBatchOp(CswNbtObjClassBatchOp BatchNode) { try { if (BatchNode.OpNameValue == CswEnumNbtBatchOpName.Receiving) { _CswNbtSdTabsAndProps = new CswNbtSdTabsAndProps(_CswNbtResources); BatchNode.start(); ReceivingBatchData BatchData = new ReceivingBatchData(BatchNode.BatchData.Text); CswNbtActReceiving ActReceiving = new CswNbtActReceiving(_CswNbtResources); CswNbtReceivingDefinition UpdatedReceiptDef = ActReceiving.receiveContainers(BatchData.ReceiptDef, ref _NodesProcessed, _MaxNodeProcessed); ReceivingBatchData UpdatedBatchData = new ReceivingBatchData(UpdatedReceiptDef); BatchNode.BatchData.Text = UpdatedBatchData.ToString(); if (0 == BatchData.CountNumberContainersToCreate() || 0 == _NodesProcessed) { BatchNode.finish(); } _NodesProcessed = 0; //reset this for Unit Test purposes BatchNode.PercentDone.Value = getPercentDone(BatchNode); BatchNode.BatchData.Text = BatchData.ToString(); BatchNode.postChanges(false); } } catch (Exception ex) { BatchNode.error(ex); } } // runBatchOp()
/// <summary> /// Simulates clicking "Finish" on the Receiving Wizard /// </summary> private CswNbtReceivingDefinition FinishWizard() { CswNbtMetaDataNodeType ContainerNT = TestData.CswNbtResources.MetaData.getNodeType("Container"); CswNbtObjClassContainer InitialContainer = _ReceivingAction.makeContainer(null); JObject ContainerAddProps = _ReceivingAction.getContainerAddProps(InitialContainer); CswNbtObjClassUnitOfMeasure GramNode = TestData.CswNbtResources.Nodes.GetNode(new CswPrimaryKey("nodes", 26745)); //TODO: don't hardcode this Gram //CREATES 16 CONTAINERS CswNbtReceivingDefinition ReceiptDef = new CswNbtReceivingDefinition() { ContainerNodeId = InitialContainer.NodeId, ContainerNodeTypeId = ContainerNT.NodeTypeId, ContainerProps = ContainerAddProps, MaterialNodeId = _FirstChemicalNode.NodeId, Quantities = new Collection <CswNbtAmountsGridQuantity>() { new CswNbtAmountsGridQuantity() { NumContainers = 11, Quantity = 10, SizeName = _SizeOne.NodeName, SizeNodeId = _SizeOne.NodeId, UnitNodeId = GramNode.NodeId, ContainerIds = new Collection <string>() { InitialContainer.NodeId.ToString() } }, new CswNbtAmountsGridQuantity() { NumContainers = 5, Quantity = 100, SizeName = _SizeTwo.NodeName, SizeNodeId = _SizeTwo.NodeId, UnitNodeId = GramNode.NodeId } } }; //This should create out receipt lot and finalize the initial container int nodesProcessed = 0; _ReceivingAction.receiveContainers(ReceiptDef, ref nodesProcessed, 1); return(ReceiptDef); }