|
220
|
+
|
|
164
|
221
|
def merge_sheet_data_with_data(sheet_data, data):
|
|
165
|
222
|
"""
|
|
166
|
223
|
Merge `sheet_data` with `data`.
|
|
|
@@ -180,6 +237,13 @@ def create_coi_file(lot_no, sheets, user, md):
|
|
180
|
237
|
qa1 = User.objects.get(pk=md['qa1'])
|
|
181
|
238
|
qa2 = User.objects.get(pk=md['qa2'])
|
|
182
|
239
|
|
|
|
240
|
+ accept = specialAccept = False
|
|
|
241
|
+ if md['acceptStatus'] == "accepted":
|
|
|
242
|
+ accept = True
|
|
|
243
|
+ if md['acceptStatus'] == "special_accepted":
|
|
|
244
|
+ specialAccept = True
|
|
|
245
|
+
|
|
|
246
|
+
|
|
183
|
247
|
pprint(qa1)
|
|
184
|
248
|
pprint(qa2)
|
|
185
|
249
|
|
|
|
@@ -190,25 +254,38 @@ def create_coi_file(lot_no, sheets, user, md):
|
|
190
|
254
|
sheet_data[sheet_name] = generate_hardness_out_values(lot_no)
|
|
191
|
255
|
case 'hardness_out_in':
|
|
192
|
256
|
sheet_data[sheet_name] = generate_hardness_out_in_values(lot_no)
|
|
|
257
|
+ case 'dimension':
|
|
|
258
|
+ sheet_data[sheet_name] = generate_dimension_values(lot_no)
|
|
193
|
259
|
|
|
194
|
260
|
converted_data = convert_sheet_data(sheet_data)
|
|
195
|
261
|
|
|
196
|
262
|
print(f"sheet_data \n {sheet_data}")
|
|
197
|
263
|
print(f"converted_data \n {converted_data}")
|
|
198
|
264
|
|
|
|
265
|
+ results = queryFromMaster(lot_no)
|
|
|
266
|
+ first_result = results[0] if results else None
|
|
|
267
|
+ try:
|
|
|
268
|
+ pcs = int(first_result.PRO5) - int(first_result.PRO27)
|
|
|
269
|
+ except:
|
|
|
270
|
+ pcs = 0
|
|
|
271
|
+ if first_result:
|
|
|
272
|
+ size_str = f"{first_result.PRO10}x{first_result.PRO11}x{first_result.PRO12}";
|
|
|
273
|
+ spec = f"{first_result.PRO13} {first_result.PRO14} {first_result.PRO15} {first_result.PRO16} {first_result.PRO17} {first_result.PRO18}"
|
|
|
274
|
+ else:
|
|
|
275
|
+ size_str = ""
|
|
|
276
|
+ spec = ""
|
|
|
277
|
+
|
|
199
|
278
|
data = {
|
|
200
|
|
- "customer": "Tum Coder",
|
|
|
279
|
+ "customer": first_result.PRO1C,
|
|
201
|
280
|
"inspect_date": "2025-01-15",
|
|
202
|
|
- "lot_no": "12345",
|
|
203
|
|
- "staff_name": "Tum 8888",
|
|
204
|
|
- "man_name": "Tum 999",
|
|
205
|
|
- "size": "Large",
|
|
206
|
|
- "pcs": "10 pcs",
|
|
207
|
|
- "spec": "Spec-A",
|
|
208
|
|
- "hardness_out.acc": True, # Hide rows 24 to 28 if the prefix is "0"
|
|
209
|
|
- "hardness_out.spe_acc": False, # Hide rows 24 to 28 if the prefix is "0"
|
|
210
|
|
- "acc": True, # Hide rows 24 to 28 if the prefix is "0"
|
|
211
|
|
- "spe_acc": True, # Hide rows 24 to 28 if the prefix is "0"
|
|
|
281
|
+ "lot_no": lot_no,
|
|
|
282
|
+ "size": size_str,
|
|
|
283
|
+ "pcs": pcs,
|
|
|
284
|
+ "spec": spec,
|
|
|
285
|
+ # "hardness_out.acc": True, # Hide rows 24 to 28 if the prefix is "0"
|
|
|
286
|
+ # "hardness_out.spe_acc": False, # Hide rows 24 to 28 if the prefix is "0"
|
|
|
287
|
+ "acc": accept, # Hide rows 24 to 28 if the prefix is "0"
|
|
|
288
|
+ "spe_acc": specialAccept, # Hide rows 24 to 28 if the prefix is "0"
|
|
212
|
289
|
# "hardness_out.qa1": f"{qa1.first_name} {qa1.last_name}",
|
|
213
|
290
|
# "hardness_out.qa2": f"{qa2.first_name} {qa2.last_name}",
|
|
214
|
291
|
"qa1": f"{qa1.first_name} {qa1.last_name}",
|
|
|
@@ -385,7 +462,8 @@ def gen_report_view(request):
|
|
385
|
462
|
return HttpResponseBadRequest("Missing 'lot_no' in request data")
|
|
386
|
463
|
|
|
387
|
464
|
# Call the `create_coi_file` function with the provided lot_no
|
|
388
|
|
- report = create_coi_file(lot_no, exports, request.user, {'qa1': qa1, 'qa2': qa2})
|
|
|
465
|
+ report = create_coi_file(lot_no, exports, request.user, {'qa1': qa1, 'qa2': qa2, \
|
|
|
466
|
+ 'acceptStatus': data.get('acceptStatus')})
|
|
389
|
467
|
|
|
390
|
468
|
# Return a success response with the report details
|
|
391
|
469
|
return JsonResponse({
|
|
|
@@ -94,6 +94,9 @@
|
|
94
|
94
|
<a href="{% url "legacy:datams-list" %}" class="flex items-center w-full p-2 text-gray-900 transition duration-75 rounded-lg pl-11 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700">Measurement</a>
|
|
95
|
95
|
</li>
|
|
96
|
96
|
<li>
|
|
|
97
|
+ <a href="{% url "legacy:rotate-list" %}" class="flex items-center w-full p-2 text-gray-900 transition duration-75 rounded-lg pl-11 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700">Rotate Data</a>
|
|
|
98
|
+ </li>
|
|
|
99
|
+ <li>
|
|
97
|
100
|
<a href="{% url "legacy:fg-list" %}" class="flex items-center w-full p-2 text-gray-900 transition duration-75 rounded-lg pl-11 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700">Fg Press Info</a>
|
|
98
|
101
|
</li>
|
|
99
|
102
|
<li>
|