The PIBatch object represents a set of activities used in production of a batch.
Where the PIUnitBatch is equipment oriented, the PIBatch is used for tracking the production of a batch or material that is being produced. Often a PIBatch is comprised of activities that are not equipment oriented and activities that are equipment oriented. The equipment orientated activities, are represented by a PIUnitBatch. References to PIUnitBatch objects can stored in the PIUnitBatches property of a PIBatch object.
This object supports the IRefresh interface.
This object supports the IPIServers interface. It returns the Server for the PIBatch itself as well as any additional Server's for objects in the Product and Recipe properties. If you want to check for servers in the PIProperties and PIUnitBatches collections within the PIBatch, you need to get the IPIServers interface from those collections.
This object supports the IPIPersist interface. The persistence string only contains enough information to ask the database for the object. It doesn't contain a copy of the data within the object.
This object supports the IPITransaction interface. This is a simpler and more efficient way to modify a PIBatch than using the ModifyAttributes method. In addition you can delete PIProperty's which you can't do with ModifyAttributes. Being in transaction mode has no effect on changes to the PIUnitBatches collection of the PIBatch.
Refreshing PI 2.x PIUnitBatches
When PI 2.x PIUnitBatch's are closed (the EndTime is set), they can't be found by searching for some seconds depending on how fast and how busy the PI 2.x Server is. To work around this, the PI-SDK will retry for up to ten seconds to find a PI 2.x PIUnitBatch when it is refreshed. If your application can't tolerate this delay, you can perform the search yourself (using PIModule.PIUnitBatchSearch) and decide what to do if you can't find the PIUnitBatch when it is being closed. This search is the same search used by the PI-SDK when it refreshes a PI2.x PIUnitBatch.