public CswNbtReceivingDefinition receiveContainers(CswNbtReceivingDefinition ReceiptDef, ref int NodesProcessed, int MaxProcessed) { CswNbtMetaDataNodeType ContainerNt = _CswNbtResources.MetaData.getNodeType(ReceiptDef.ContainerNodeTypeId); foreach (CswNbtAmountsGridQuantity QuantityDef in ReceiptDef.Quantities) { CswNbtObjClassSize AsSize = _CswNbtResources.Nodes.GetNode(QuantityDef.SizeNodeId); string Barcode = string.Empty; Action <CswNbtNode> After = delegate(CswNbtNode NewNode) { CswNbtObjClassContainer thisContainer = NewNode; if (QuantityDef.getNumBarcodes() <= QuantityDef.NumContainers && false == string.IsNullOrEmpty(Barcode)) { thisContainer.Barcode.setBarcodeValueOverride(Barcode, false); } thisContainer.Size.RelatedNodeId = QuantityDef.SizeNodeId; thisContainer.Material.RelatedNodeId = ReceiptDef.MaterialNodeId; if (AsSize.QuantityEditable.Checked != CswEnumTristate.True) { QuantityDef.Quantity = AsSize.InitialQuantity.Quantity; QuantityDef.UnitNodeId = AsSize.InitialQuantity.UnitId; } if (null == thisContainer.Quantity.UnitId || Int32.MinValue == thisContainer.Quantity.UnitId.PrimaryKey) { thisContainer.Quantity.UnitId = QuantityDef.UnitNodeId; } thisContainer.DispenseIn(CswEnumNbtContainerDispenseType.Receive, QuantityDef.Quantity, QuantityDef.UnitNodeId, ReceiptDef.RequestItemtNodeId); thisContainer.Disposed.Checked = CswEnumTristate.False; thisContainer.ReceiptLot.RelatedNodeId = ReceiptDef.ReceiptLotNodeId; }; for (Int32 C = 0; C < QuantityDef.NumContainers; C += 1) { if (NodesProcessed < MaxProcessed) { //we promote the first container before the batch op starts, so there should always be at least one container id in the first set of quantities CswPrimaryKey ContainerId = null; if (C < QuantityDef.ContainerIds.Count) { ContainerId = CswConvert.ToPrimaryKey(QuantityDef.ContainerIds[C]); } CswCommaDelimitedString Barcodes = QuantityDef.getBarcodes(); Barcode = (QuantityDef.getNumBarcodes() > C ? Barcodes[C] : string.Empty); if (null == ContainerId) //only create a container if we haven't already { CswNbtNodeKey ContainerNodeKey; CswNbtObjClassContainer Container = _CswNbtSdTabsAndProps.addNode(ContainerNt, ReceiptDef.ContainerProps, out ContainerNodeKey, After); QuantityDef.ContainerIds.Add(Container.NodeId.ToString()); NodesProcessed++; } else { CswNbtNode InitialContainerNode = _CswNbtResources.Nodes.GetNode(ContainerId); if (null != InitialContainerNode && InitialContainerNode.IsTemp) { _CswNbtSdTabsAndProps.saveNodeProps(InitialContainerNode, ReceiptDef.ContainerProps); After(InitialContainerNode); InitialContainerNode.PromoteTempToReal(); NodesProcessed++; } } } } //for( Int32 C = 0; C < NoContainers; C += 1 ) } return(ReceiptDef); }
} // removeProp() public CswNbtNode addNode(CswNbtMetaDataNodeType NodeType, JObject PropsObj, out CswNbtNodeKey RetNbtNodeKey, Action <CswNbtNode> After, CswNbtView View = null, CswNbtMetaDataNodeTypeTab NodeTypeTab = null) { return(_TabsPropsSd.addNode(NodeType, PropsObj, out RetNbtNodeKey, After, View, NodeTypeTab)); }