2007/06/02

Luggage simulation: program

IDE: MS Access 2003



Each event corresponds to one form in MS Access. To run VBA code at intervals specified by the "TimerInterval" property of one form, and put the code in the form's Timer event.

Event 1: one luggage checks in (Checkpoint 1)
This is done by employees in another application.
Trigger: When one luggage checks in the counter, insert into table Luggage one luggage record, and one trigger is fired. This trigger inserts one or more records into table LuggageCheckpoint, according to the destination of this luggage.

Event 2: one luggage checks out Checkpoint 1
Update:
* CheckResult = true or false
* CheckoutTime = CheckinTime of CheckPoint 1 + the checking time of Checkpoint 1
Criteria:
* the luggage which checked in Checkpoint 1
* and not checks out Checkpoint 1 yet
* and since the luggage checked in Checkpoint 1, now >= the checking time of Checkpoint 1

Event 3: one luggage checks in Checkpoint 2
Update: CheckinTime = CheckoutTime of CheckPoint 1 + the time from Checkpoint 1 to Checkpoint 2
Criteria:
* the luggage which checked out Checkpoint 1
* and needs to pass Checkpoint 2
* and not checks in Checkpoint 2 yet
* and since the luggage checked out Checkpoint 1, now >= the time from Checkpoint 1 to Checkpoint 2

Event 4: one luggage checks out Checkpoint 2
* CheckResult = true or false
* CheckoutTime = CheckinTime of CheckPoint 2 + the checking time of Checkpoint 2
Criteria:
* the luggage which checked in Checkpoint 2
* and not checks out Checkpoint 2 yet
* and since the luggage checked in Checkpoint 2, now >= the checking time of Checkpoint 2

Event 5: one luggage checks in Checkpoint 3
Update: CheckinTime = CheckoutTime of CheckPoint 1 + the time from Checkpoint 1 to Checkpoint 3
Criteria:
If the luggage comes from Checkpoint 1
* the luggage which checked out Checkpoint 1
* and not needs pass Checkpoint 2
* and needs pass Checkpoint 3
* and not passes Checkpoint 3 yet
* and since the luggage checked out Checkpoint 1, now >= the time from Checkpoint 1 to Checkpoint 3

Else if it comes from Checkpoint 2
Update: CheckinTime = CheckoutTime of CheckPoint 2 + the time from Checkpoint 2 to Checkpoint 3
Criteria:
* the luggage which checked out Checkpoint 2
* and needs pass Checkpoint 3
* and not passes Checkpoint 3 yet
* and since the luggage checked out Checkpoint 2, now >= the time from Checkpoint 2 to Checkpoint 3

Event 6: one luggage checks out Checkpoint 3
* CheckResult = true or false
* CheckoutTime = CheckinTime of CheckPoint 3 + the checking time of Checkpoint 3
Criteria:
* the luggage which checked in Checkpoint 3
* and not checks out Checkpoint 3 yet
* and since the luggage checked in Checkpoint 3, now >= the checking time of Checkpoint 3

Trigger:
When one luggage passes all needed checks, its checkout time in the table Luggage is updated as its last checkout time.

No comments: