fix(query-tool): show hold lot id via containername and align export

This commit is contained in:
egg
2026-02-22 18:32:07 +08:00
parent bfec6b2293
commit 3dc7886c90
6 changed files with 146 additions and 26 deletions

View File

@@ -749,6 +749,48 @@ class TestExportCsvEndpoint:
decoded = response.data.decode('utf-8-sig')
assert 'LOT ID' in decoded
assert 'GA25010001-A01' in decoded
@patch('mes_dashboard.routes.query_tool_routes.get_lot_holds')
def test_export_lot_holds_uses_container_name_as_lot_id(
self,
mock_get_holds,
client,
):
mock_get_holds.return_value = {
'data': [
{
'CONTAINERID': '488103800029578b',
'CONTAINERNAME': 'GA25010001-A01',
'WORKCENTERNAME': '成型',
'HOLDTXNDATE': '2026-02-22 16:53:27',
'RELEASETXNDATE': None,
'HOLD_STATUS': 'HOLD',
'HOLD_HOURS': 1.46,
'HOLDREASONNAME': 'Q-Time Fail',
'HOLDCOMMENTS': '',
'HOLDEMP': 'U001',
'HOLDEMPDEPTNAME': '成型(D)',
'RELEASEEMP': '',
'RELEASECOMMENTS': '',
'NCRID': '',
}
],
'total': 1,
}
response = client.post(
'/api/query-tool/export-csv',
json={
'export_type': 'lot_holds',
'params': {'container_id': '488103800029578b'}
}
)
assert response.status_code == 200
assert 'lot_holds_488103800029578b.csv' in response.headers.get('Content-Disposition', '')
decoded = response.data.decode('utf-8-sig')
assert 'LOT ID' in decoded
assert 'GA25010001-A01' in decoded
class TestEquipmentListEndpoint: