|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+# COI Project
|
|
|
2
|
+
|
|
|
3
|
+This project runs Django and SQL Server with Docker Compose.
|
|
|
4
|
+
|
|
|
5
|
+## Start The Stack
|
|
|
6
|
+
|
|
|
7
|
+```bash
|
|
|
8
|
+docker compose build
|
|
|
9
|
+docker compose up -d
|
|
|
10
|
+docker compose ps
|
|
|
11
|
+```
|
|
|
12
|
+
|
|
|
13
|
+Web app:
|
|
|
14
|
+
|
|
|
15
|
+```text
|
|
|
16
|
+http://localhost:8039
|
|
|
17
|
+```
|
|
|
18
|
+
|
|
|
19
|
+## Import Customer Template Data
|
|
|
20
|
+
|
|
|
21
|
+The project includes a tab-separated import file:
|
|
|
22
|
+
|
|
|
23
|
+```text
|
|
|
24
|
+app/customer_template_mapping_import.tsv
|
|
|
25
|
+```
|
|
|
26
|
+
|
|
|
27
|
+Import it into `CustomerTemplateMapping`:
|
|
|
28
|
+
|
|
|
29
|
+```bash
|
|
|
30
|
+docker exec coi-web-1 python manage.py import_customer_templates /app/customer_template_mapping_import.tsv
|
|
|
31
|
+```
|
|
|
32
|
+
|
|
|
33
|
+Set `created_by`:
|
|
|
34
|
+
|
|
|
35
|
+```bash
|
|
|
36
|
+docker exec coi-web-1 python manage.py import_customer_templates /app/customer_template_mapping_import.tsv --created_by 1
|
|
|
37
|
+```
|
|
|
38
|
+
|
|
|
39
|
+Override export template:
|
|
|
40
|
+
|
|
|
41
|
+```bash
|
|
|
42
|
+docker exec coi-web-1 python manage.py import_customer_templates /app/customer_template_mapping_import.tsv --export-template japanese
|
|
|
43
|
+```
|
|
|
44
|
+
|
|
|
45
|
+### Import Command Behavior
|
|
|
46
|
+
|
|
|
47
|
+- Merges duplicate rows by `customer_name`
|
|
|
48
|
+- Uses the numeric template column from the TSV as the sheet selector
|
|
|
49
|
+- Maps template indexes to `SHEET_NAMES` using 1-based order
|
|
|
50
|
+- Skips `hardness_out_in_4` from the numeric index mapping
|
|
|
51
|
+- Defaults imported `export_template` to `asean`
|
|
|
52
|
+
|
|
|
53
|
+Adjusted numeric mapping:
|
|
|
54
|
+
|
|
|
55
|
+```text
|
|
|
56
|
+1 -> hardness_out
|
|
|
57
|
+2 -> hardness_out_in
|
|
|
58
|
+3 -> hardness_both_size
|
|
|
59
|
+4 -> dimension
|
|
|
60
|
+5 -> dimension_weight_warp
|
|
|
61
|
+6 -> dimension_app
|
|
|
62
|
+7 -> dimension_app_drawing
|
|
|
63
|
+8 -> dimension_bal_weight
|
|
|
64
|
+9 -> dim_bal_app_hard
|
|
|
65
|
+10 -> dim_bal_app_hard_stamp
|
|
|
66
|
+11 -> dim_bal_app_rot_hard
|
|
|
67
|
+12 -> thickness_8_point
|
|
|
68
|
+13 -> centering
|
|
|
69
|
+```
|
|
|
70
|
+
|
|
|
71
|
+The command also still supports the older CSV format with `customer_name` and JSON `template_names`.
|
|
|
72
|
+
|
|
|
73
|
+## Other Management Commands
|
|
|
74
|
+
|
|
|
75
|
+Seed or top up project data models:
|
|
|
76
|
+
|
|
|
77
|
+```bash
|
|
|
78
|
+docker exec coi-web-1 python manage.py seed_all_mock_models
|
|
|
79
|
+docker exec coi-web-1 python manage.py seed_all_mock_models --target-count 100
|
|
|
80
|
+```
|
|
|
81
|
+
|
|
|
82
|
+Create missing user profiles:
|
|
|
83
|
+
|
|
|
84
|
+```bash
|
|
|
85
|
+docker exec coi-web-1 python manage.py create_profile
|
|
|
86
|
+```
|
|
|
87
|
+
|
|
|
88
|
+Run migrations:
|
|
|
89
|
+
|
|
|
90
|
+```bash
|
|
|
91
|
+docker exec coi-web-1 python manage.py migrate
|
|
|
92
|
+```
|
|
|
93
|
+
|
|
|
94
|
+Open a Django shell:
|
|
|
95
|
+
|
|
|
96
|
+```bash
|
|
|
97
|
+docker exec -it coi-web-1 python manage.py shell
|
|
|
98
|
+```
|
|
|
99
|
+
|
|
|
100
|
+## Useful Docker Commands
|
|
|
101
|
+
|
|
|
102
|
+Show running containers:
|
|
|
103
|
+
|
|
|
104
|
+```bash
|
|
|
105
|
+docker compose ps
|
|
|
106
|
+```
|
|
|
107
|
+
|
|
|
108
|
+View web logs:
|
|
|
109
|
+
|
|
|
110
|
+```bash
|
|
|
111
|
+docker compose logs web --tail 200
|
|
|
112
|
+```
|
|
|
113
|
+
|
|
|
114
|
+View database logs:
|
|
|
115
|
+
|
|
|
116
|
+```bash
|
|
|
117
|
+docker compose logs db --tail 200
|
|
|
118
|
+```
|
|
|
119
|
+
|
|
|
120
|
+Restart services:
|
|
|
121
|
+
|
|
|
122
|
+```bash
|
|
|
123
|
+docker compose restart web
|
|
|
124
|
+docker compose restart db
|
|
|
125
|
+```
|
|
|
126
|
+
|
|
|
127
|
+Stop the stack:
|
|
|
128
|
+
|
|
|
129
|
+```bash
|
|
|
130
|
+docker compose down
|
|
|
131
|
+```
|
|
|
132
|
+
|
|
|
133
|
+## COI Test Lots
|
|
|
134
|
+
|
|
|
135
|
+Lots for `/report/coi/`:
|
|
|
136
|
+
|
|
|
137
|
+- `260218548-019` -> customer `NOGUCHI SEIKI` -> auto-selects `asean`
|
|
|
138
|
+- `260218549-022` -> customer `NOGUCHI SEIKI` -> auto-selects `asean`
|
|
|
139
|
+- `CEN-TEST-008` -> customer `CENTERING TEST` -> auto-selects `asean`
|
|
|
140
|
+- `CEN-TEST-012` -> customer `CENTERING TEST` -> auto-selects `asean`
|
|
|
141
|
+- `CEN-JP-001` -> customer `CENTERING JAPAN TEST` -> auto-selects `japanese`
|
|
|
142
|
+
|
|
|
143
|
+## Notes
|
|
|
144
|
+
|
|
|
145
|
+- The web container name in Compose is `coi-web-1`
|
|
|
146
|
+- The database container name in Compose is `coi-db-1`
|
|
|
147
|
+- SQL Server credentials are defined in `docker-compose.yml`
|
|
|
148
|
+- The app code is mounted into the container from `./app`
|