Implement inventory activation workflow

Summary

This merge request implements the station inventory, replenishment, and production job activation workflow.

Changes include:

  • Added station inventory tracking
  • Added station transfer requests
  • Added product unit tracking
  • Added production job activation logic
  • Added default 20% low-stock threshold
  • Added duplicate transfer request prevention
  • Added transfer request fulfilment and inventory recheck
  • Added one unique barcode per production job
  • Added Admin station inventory interface
  • Added Warehouse Manager transfer request interface
  • Added automated tests for TC-02 through TC-06

Test Case Definitions

TC-01 - Create a Production Job

The Admin creates a production job with a name, production quantity, steps, station assignments, instruction photos, required parts, and low-stock threshold.

Expected result:

  • Job is saved successfully
  • Initial job status is Draft
  • Entered production details are stored and displayed correctly

TC-02 - Activate a Job with Sufficient Station Stock

The required station already has sufficient stock when the Admin activates the job.

Expected result:

  • Job status changes from Draft to Active
  • One unique barcode is generated for the production job
  • Product units are created according to the production quantity
  • No station transfer request is created

TC-03 - Use the Default Low-Stock Threshold

The Admin does not specify a low-stock threshold when creating the production job.

Expected result:

  • The system automatically uses a default threshold of 20%
  • The threshold is used during the station inventory check
  • The job can activate when station stock satisfies the calculated threshold

TC-04 - Prevent Duplicate Transfer Requests

A station part is below the required threshold and an open transfer request already exists for the same job, station, and part.

The activation/inventory check is performed again.

Expected result:

  • The existing transfer request remains
  • The system does not create a duplicate request for the same job, station, and part

TC-05 - Insufficient Station Stock During Activation

The Admin attempts to activate a production job while a required station part is below its calculated threshold.

Expected result:

  • The job remains in Draft
  • A station transfer request is automatically created
  • Transfer request status is Pending
  • Requested quantity is calculated from the remaining required quantity and current station stock

TC-06 - Fulfil a Station Transfer Request

A station transfer request is waiting for Warehouse Manager action.

The Warehouse Manager confirms the quantity transferred to the station.

Expected result:

  • Transferred quantity is added to station inventory
  • Transfer request is marked Fulfilled once the requested quantity has been supplied
  • Completion time is recorded
  • Station inventory is checked again
  • If the required threshold is now satisfied, the production job becomes Active
  • The production job receives its unique barcode

Verification

Automated test command:

python -m pytest -v

Current result:

  • TC-01: PASSED
  • TC-02: PASSED
  • TC-03: PASSED
  • TC-04: PASSED
  • TC-05: PASSED
  • TC-06: PASSED

6 tests passed.

Manual verification was also completed for production job activation, default threshold handling, station inventory updates, transfer request creation and fulfilment, and the single production-job barcode workflow.

Merge request reports

Loading