ExpectedInventorySynchronize URL
This command updates expected inventory records to synchronize with a backend system. It works by attempting to find the RADETAIL and RA records based on the primary key or unique index for each (see RA and RADETAIL table definitions). If a record can be found, it is updated with the values specified in the parameters. If a record cannot be found, the command attempts to create a new record using the values specified in the parameters. This command cannot be used to update or insert into the RA table only. It must be used to update both the RA and RADETAIL tables or only the RADETAIL table.
This command can be invoked programmatically or by using a URL. The parameters are formatted in an EC_XMLOBJECT. The syntax allows you to specify multiple RA and RADETAIL pairs.
URL structure
- http:// host_name/path/
- The fully qualified name of your Transaction server and the configuration path.
Parameter values
- radetailid
- Specifies the ID of an RADETAIL to locate an existing record for update.
- raid
- Specifies the ID of an RA to locate an existing record for update.
- createtime
- Specifies the date when the record was created.
- vendor
- Specifies the vendor name that will be supplying the inventory.
- ffmcenter
- Specifies the fulfillment center ID. This parameter is required if you specify an RA ID and multiple fulfillment centers exist for that one ID.
- originalexpecteddate
- Used to locate an existing RADETAIL when updating an existing record.
- partnumber
- Specifies the part number of the inventory record; used with MEMBERID to locate an itemspc_id.
- externalid
- Specifies an external identifier, typically supplied by the vendor.
- openindicator
- Specifies if expected inventory may still be received and allocated to backorders (Y), or if no further inventory will be received and expected inventory may not be allocated to backorders (N).
- orderdate
- Specifies the date that the order was created with the vendor.
- dateclosed
- Specifies the date that this record was closed.
- radetailcomment
- Specifies a comment.
- qtyremaining
- Specifies the quantity still expected from vendor for this expected inventory record. Typically, this quantity is equal to the quantity ordered minus the quantity received, but could be different if the vendor is unable to ship the total quantity. If this parameter is not specified when creating a new record, it defaults to 0.
- qtyreceived
- Specifies the quantity received to date from the vendor for this expected inventory record. If this parameter is not specified when creating a new record, it defaults to 0.
- qtyordered
- Specifies the quantity ordered from vendor in this expected inventory record. If this parameter is not specified when creating a new record, it defaults to 0.
- deleteflag
- Specifies whether to delete the corresponding RA. A value of "1" indicates that the matching RA and RADETAIL entries should be deleted.
- expecteddate
- Specifies the date that the inventory is now expected to arrive. This parameter is required if inserting records.
- delimiter
- Specifies the delimiter character; used for delimiting values when passing values to the stored procedure.
- counter
- Specifies the number of records passed to StoredProcedure. The maximum value is 10000. This parameter is required if passing XML.
- memberid
- Specifies the member ID used to get catentry information (itemspc_id). If this parameter is not passed in, the command tries to retrieve it from the command context. This parameter is required if the member ID is different from the store owner.
Output parameters
- ExpRecsRejected
- The number of records from the input that were rejected.
- ExpRecsProcessed
- The number of records from the input that were processed.
- ExpRecsInserted
- Of the number of records processed, the number of records that were inserted.
- ExpRecsUpdated
- Of the number of records processed, the number of records that were updated.
- ExpRecsReturnCodes
- A return code for each record that was included the input. A value of less than 0 indicates that the error was found before sending it for update or add. Other values are possible; for a list of the other return codes that can result from an update or add, see Stored Procedure error codes.
- ExpRecsWarnMsgs
- Error message information.
- getRejectedRecords()
- The number of records rejected because of missing store IDs,
expecteddate
,vendor
,partnumber
, missing vendors in vendor table, andpartnumbers
withoutitemspec
. - getProcessedRecords()
- The number of successfully processed records.
- getExpectedRecordInserted()
- The number of records inserted into the RADETAIL table.
- getExpectedRecordUpdated()
- The number of records updated in the RADETAIL table.
- getCommandStatus()
- Specifies whether the command was successful or if it failed.
- getWarningMessages()
- Lists warning messages for all the records that are rejected in Vector.
Required variables
The following variables must be set. If they are not available in instance XML, the commit is performed after processing all the records passed to the stored procedure.
Since the new command is running on the servlet thread, performance can be affected, depending on the number of updates. To alleviate this problem, you can use the ExpRecCounter and ExpCommitFlag instance parameters to release the table locks.
- ExpRecCounter
- Controls the number of records processed before a commit occurs.
- ExpCommitFlag
- Controls whether the stored procedure performs a commit after the number of updates specified.
Example
http://myhostname/webapp/wcs/stores/servlet/ExpectedInventorySynchronize? <XML> <delimiter>|</delimiter> <counter>100</counter> <synchronizeraitem> <vendor>Store 201 Vendor</vendor> <createtime>2004-01-01-00:00:00.0</createtime> <externalid>VPN1234 567 G</externalid> <orderdate>2004-01-01-00:00:00.0</orderdate> <openindicator>Y</openindicator> <dateclosed></dateclosed> <expecteddate>2004-02-12-00:00:00.0</expecteddate> <originalexpecteddate>2004-01-29-00:00:00.0</originalexpecteddate> <ffmcenter>300</ffmcenter> <partnumber>420X101</partnumber> <qtyordered>50</qtyordered> <qtyreceived>20</qtyreceived> <qtyremaining>28</qtyremaining> <deleteflag>0</deleteflag> <radetailComment>Comment for item 4</radetailComment> </synchronizeraitem> <synchronizeraitem> <radetailid>105670</radetailid> <dateclosed>2004-01-01-00:00:00.0</dateclosed> <qtyremaining>0</qtyremaining> </synchronizeraitem> </XML>Behavior
- This command inserts records into and updates the RA and RADETAIL tables. It accepts parameters either in XMLOBJECT or by using request properties. ExpectedInventorySynchronizeCmd will call SQL StoredProcedure (EXPECTEDINV) to perform inserts and updates on the RA and RADETAIL tables. To improve performance results, parameters for the new SQL stored procedure are passed in batch, separating them by a delimiter. Stored Procedure parses the parameters and inserts records into or updates records in the RA and RADETAIL tables.
- Counter is the number of the items that are to be updated in a single database request. In other words, it is the batch size that can be used to control the number of records that will be updated in the database at once. The larger the number (up to a maximum of 10000), the faster the command will run, but this might have an adverse affect on shopping, since this update is done in real time. So, for instance, if you sent 10000 records and counter=500, then the request would update the 10000 records in batches of 500 at a time. The value needs to be empirically determined. Although it is possible to send 100,000 records, the counter must be no greater than 10000. This is because a maximum of 10000 records can be sent to the database in one call.
Exception conditions
- Exceptions will be thrown if any required parameters are missing.
- Any other exceptions or problems encountered will be communicated via the failure-output parameters.