diff --git a/app/routes.py b/app/routes.py index b43f7f2cb012ffc3b22f785ccec27683b71a3763..ae9af9edb070281c56540562d8b431880e9979bf 100644 --- a/app/routes.py +++ b/app/routes.py @@ -267,6 +267,8 @@ def job_detail(job_id): product_units=product_units, transfer_requests=transfer_requests, ) + + @bp.route( "/admin/jobs//activate", methods=["POST"], @@ -294,6 +296,8 @@ def activate_job_route(job_id): return redirect( url_for("main.job_detail", job_id=job.id) ) + + @bp.route("/admin/photos", methods=["GET", "POST"]) def admin_photos(): if request.method == "POST": @@ -328,7 +332,6 @@ def admin_photos(): ) - @bp.route("/admin/inventory", methods=["GET", "POST"]) def admin_inventory(): if request.method == "POST": @@ -457,6 +460,7 @@ def admin_inventory(): inventory_rows=inventory_rows, ) + @bp.route("/warehouse/requests") def warehouse_requests(): transfer_requests = TransferRequest.query.order_by( @@ -497,11 +501,27 @@ def fulfill_request_route(request_id): return redirect( url_for("main.warehouse_requests") ) -@bp.route("/kiosk", methods=["GET", "POST"]) -def worker_kiosk(): + + +@bp.route("/kiosk") +def kiosk_index(): stations = Station.query.order_by(Station.id).all() - selected_station_id = "" + return render_template( + "kiosk_index.html", + stations=stations, + ) + + +@bp.route("/kiosk/", methods=["GET", "POST"]) +def worker_kiosk(station_id): + normalized_station_id = (station_id or "").strip().upper() + + station = db.session.get(Station, normalized_station_id) + + if station is None or not station.enabled: + abort(404, description="Unknown or disabled station.") + entered_barcode = "" step = None current_unit = None @@ -513,11 +533,6 @@ def worker_kiosk(): scan_message = None if request.method == "POST": - selected_station_id = request.form.get( - "station_id", - "", - ).strip() - entered_barcode = request.form.get( "barcode", "", @@ -537,7 +552,7 @@ def worker_kiosk(): else: result, error = complete_current_step( job, - selected_station_id, + normalized_station_id, ) if error is None: @@ -616,19 +631,18 @@ def worker_kiosk(): else: step, error = scan_job_barcode( entered_barcode, - selected_station_id, + normalized_station_id, ) if error is None: current_unit, step = get_current_unit_and_step( step.job, - selected_station_id, + normalized_station_id, ) return render_template( "worker_kiosk.html", - stations=stations, - selected_station_id=selected_station_id, + station=station, entered_barcode=entered_barcode, step=step, current_unit=current_unit, diff --git a/app/templates/admin_inventory.html b/app/templates/admin_inventory.html index fac218471c02d0c000f363c25c6c6ba38cdeaf91..bf604aa6513ecb1578171c4e03180c38226aac9c 100644 --- a/app/templates/admin_inventory.html +++ b/app/templates/admin_inventory.html @@ -13,25 +13,22 @@ > +

The Digital Factory Game

Production Jobs | - - Instruction Photos - - | - - Warehouse Requests + + Station Inventory | - - Worker Kiosk + + Instruction Photos

-

Station Inventory

+

Station Inventory

Add Part to Station Inventory

@@ -189,4 +186,4 @@

No station inventory entered yet.

{% endif %} - \ No newline at end of file + diff --git a/app/templates/admin_jobs.html b/app/templates/admin_jobs.html index 3db76c9183858f084cadde816b63ce1f0b635e5d..efc3b525c4683b260a6a631af01152659216f032 100644 --- a/app/templates/admin_jobs.html +++ b/app/templates/admin_jobs.html @@ -13,19 +13,16 @@ > +

The Digital Factory Game

Production Jobs | Station Inventory | Instruction Photos - | - Warehouse Requests - | - Worker Kiosk

-

Production Jobs

+

Production Jobs

Create Production Job

{% if error %} @@ -90,4 +87,4 @@

No production jobs created yet.

{% endif %} - \ No newline at end of file + diff --git a/app/templates/admin_photos.html b/app/templates/admin_photos.html index 14a232896f3cad3b8ca7804cbcfdfae7a03be09c..20f099d3789428e0d61df43329b0952807b56af5 100644 --- a/app/templates/admin_photos.html +++ b/app/templates/admin_photos.html @@ -13,6 +13,7 @@ > +

The Digital Factory Game

Production Jobs @@ -25,17 +26,9 @@ Instruction Photos - | - - Warehouse Requests - - | - - Worker Kiosk -

-

Instruction Photos

+

Instruction Photos

Upload Instruction Photo

@@ -111,4 +104,4 @@

No instruction photos uploaded yet.

{% endif %} - \ No newline at end of file + diff --git a/app/templates/job_detail.html b/app/templates/job_detail.html index 1337f13db0e5baa8e3c50e51cd5d5d85b02569d7..57dcbe88333a90301bc3aef0d92565ea0bf15522 100644 --- a/app/templates/job_detail.html +++ b/app/templates/job_detail.html @@ -13,19 +13,16 @@ > +

The Digital Factory Game

Production Jobs | Station Inventory | Instruction Photos - | - Warehouse Requests - | - Worker Kiosk

-

{{ job.name }}

+

{{ job.name }}

Status: {{ job.status }}

Production Quantity: {{ job.quantity }}

@@ -257,4 +254,4 @@

{% endif %} - \ No newline at end of file + diff --git a/app/templates/kiosk_index.html b/app/templates/kiosk_index.html new file mode 100644 index 0000000000000000000000000000000000000000..bdfd417f6f34453a171f3da6cf78f85b826da662 --- /dev/null +++ b/app/templates/kiosk_index.html @@ -0,0 +1,45 @@ + + + + + + MES - Kiosk Directory + + + +

+ Production Jobs + | + Station Inventory + | + Instruction Photos + | + Warehouse Requests + | + Kiosk Directory +

+ +

Kiosk Directory

+

+ Open each link below on its own device/tab and bookmark it. + Each link is a permanent address dedicated to one station. +

+ + + + \ No newline at end of file diff --git a/app/templates/transfer_requests.html b/app/templates/transfer_requests.html index 83c2f24f30fefdefb69e7f0673a2e28defcd98f5..c1f1b39ea2ffe484aadd78cf043962782ed49b61 100644 --- a/app/templates/transfer_requests.html +++ b/app/templates/transfer_requests.html @@ -13,21 +13,10 @@ > -

- Production Jobs - | - Station Inventory - | - Instruction Photos - | - Warehouse Requests - | - Worker Kiosk -

+

The Digital Factory Game

+

Warehouse Transfer Requests

-

Warehouse Transfer Requests

- -

Manage station replenishment requests.

+

Manage station replenishment requests.

{% if transfer_requests %} @@ -83,4 +72,4 @@

No transfer requests.

{% endif %} - \ No newline at end of file + diff --git a/app/templates/worker_kiosk.html b/app/templates/worker_kiosk.html index 6ea2ca14d97eb0e148e85aa3b2c37c96b6f95f95..4fc5adac061252fddfe0759d76d0f45160d5bd75 100644 --- a/app/templates/worker_kiosk.html +++ b/app/templates/worker_kiosk.html @@ -6,46 +6,19 @@ name="viewport" content="width=device-width, initial-scale=1" > - MES - Worker Kiosk + MES - Worker Kiosk {{ station.id }} -

- Production Jobs - | - Station Inventory - | - Instruction Photos - | - Warehouse Requests - | - Worker Kiosk -

- -

Worker Kiosk

+

The Digital Factory Game

+

{{ station.name }}

-

-
- -

-


{% if error %} -

- Error: {{ error }} -

+

Error: {{ error }}

{% endif %} {% if message %} -

- {{ message }} -

+

{{ message }}

{% endif %} {% if stock_message %} -

- Material Alert: - {{ stock_message }} -

+

Material Alert: {{ stock_message }}

{% endif %} {% if completion_message %} -

- {{ completion_message }} -

+

{{ completion_message }}

{% endif %} {% if transition_message %} -

- {{ transition_message }} -

+

{{ transition_message }}

{% endif %} {% if scan_message %} -

- {{ scan_message }} -

+

{{ scan_message }}

{% endif %} {% if step and current_unit %}
-

{{ step.job.name }}

- -

- Job Barcode: - {{ step.job.barcode }} -

- -

- Product Unit: - {{ current_unit.unit_number }} - of {{ step.job.quantity }} -

- -

- Station: - {{ step.station.name }} -

- +

Job Barcode: {{ step.job.barcode }}

+

Product Unit: {{ current_unit.unit_number }} of {{ step.job.quantity }}

+

Station: {{ step.station.name }}

Production Step {{ step.step_number }}

- -

- Instruction: - {{ step.instruction }} -

+

Instruction: {{ step.instruction }}

{% if step.photo_url %} - {% if step.photo_url.startswith( - 'uploads/step_photos/' - ) %} -

- Instruction Photo: -

- + {% if step.photo_url.startswith('uploads/step_photos/') %} +

Instruction Photo:

Instruction photo for step {{ step.step_number }} {% else %} -

- Legacy Photo Reference: - {{ step.photo_url }} -

+

Legacy Photo Reference: {{ step.photo_url }}

{% endif %} {% endif %}

Required Parts

- {% if step.parts %} {% else %} @@ -165,26 +92,10 @@ {% endif %} - - - - - + + + {% endif %} - \ No newline at end of file + diff --git a/tests/test_parallel_station_flow.py b/tests/test_parallel_station_flow.py index bbf5f81d4dc412850da0a4f603f695e3910ab2a2..c3209ad214f8140c3cd0814e7f85d8ab55edd16a 100644 --- a/tests/test_parallel_station_flow.py +++ b/tests/test_parallel_station_flow.py @@ -257,6 +257,8 @@ def test_tc16_upstream_station_can_start_next_unit( assert unavailable_error == ( "This job is not ready at this station." ) + + def test_tc17_kiosk_requires_new_scan_after_completion(app): with app.app_context(): ids = create_parallel_station_job( @@ -267,9 +269,8 @@ def test_tc17_kiosk_requires_new_scan_after_completion(app): client = app.test_client() completion_response = client.post( - "/kiosk", + "/kiosk/ST-03", data={ - "station_id": "ST-03", "barcode": "MES-PARALLEL-001", "action": "complete", }, @@ -302,9 +303,8 @@ def test_tc17_kiosk_requires_new_scan_after_completion(app): assert ready_step.id == ids["upstream_step_id"] scan_response = client.post( - "/kiosk", + "/kiosk/ST-03", data={ - "station_id": "ST-03", "barcode": "MES-PARALLEL-001", "action": "scan", }, @@ -318,6 +318,8 @@ def test_tc17_kiosk_requires_new_scan_after_completion(app): ) assert "Product Unit: 2 of 2" in normalized_page + + def test_tc18_finished_unit_returns_kiosk_to_waiting(app): with app.app_context(): ids = create_parallel_station_job( @@ -339,9 +341,8 @@ def test_tc18_finished_unit_returns_kiosk_to_waiting(app): client = app.test_client() first_finished_response = client.post( - "/kiosk", + "/kiosk/ST-05", data={ - "station_id": "ST-05", "barcode": "MES-PARALLEL-001", "action": "complete", }, @@ -359,9 +360,8 @@ def test_tc18_finished_unit_returns_kiosk_to_waiting(app): ) final_finished_response = client.post( - "/kiosk", + "/kiosk/ST-05", data={ - "station_id": "ST-05", "barcode": "MES-PARALLEL-001", "action": "complete", }, diff --git a/tests/test_photo_upload.py b/tests/test_photo_upload.py index 06309583e8dd2411327945538510f4ce0deac922..21d69da0209a5701f7d1e27fb1849995f1184fdb 100644 --- a/tests/test_photo_upload.py +++ b/tests/test_photo_upload.py @@ -356,9 +356,8 @@ def test_tc33_worker_kiosk_displays_uploaded_photo(app): assert ProductUnit.query.count() == 1 kiosk_response = client.post( - "/kiosk", + "/kiosk/ST-04", data={ - "station_id": "ST-04", "barcode": barcode, "action": "scan", },