Update routes/ds_pyc_cho_xu_ly.py
Browse files- routes/ds_pyc_cho_xu_ly.py +13 -4
routes/ds_pyc_cho_xu_ly.py
CHANGED
|
@@ -28,6 +28,19 @@ async def ds_pyc_cho_xu_ly():
|
|
| 28 |
|
| 29 |
for file in pyc_files:
|
| 30 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
local = hf_hub_download(
|
| 32 |
repo_id=REPO_ID,
|
| 33 |
repo_type="dataset",
|
|
@@ -38,9 +51,7 @@ async def ds_pyc_cho_xu_ly():
|
|
| 38 |
wb = load_workbook(local, data_only=True)
|
| 39 |
sheet = wb.active
|
| 40 |
|
| 41 |
-
ten_khach = file.split("/")[1]
|
| 42 |
ten_file = file.split("/")[-1]
|
| 43 |
-
|
| 44 |
nguoi_lap = sheet["AH51"].value
|
| 45 |
ngay = sheet["BM3"].value
|
| 46 |
thang = sheet["BS3"].value
|
|
@@ -51,12 +62,10 @@ async def ds_pyc_cho_xu_ly():
|
|
| 51 |
|
| 52 |
ngay_lap = f"{int(ngay):02}/{int(thang):02}/{nam}" if all([ngay, thang, nam]) else "Không rõ"
|
| 53 |
|
| 54 |
-
# Danh sách thiết bị thực sự từ D24 trở đi (tránh dòng tiêu đề)
|
| 55 |
thiet_bi_list = []
|
| 56 |
for row in range(24, 100):
|
| 57 |
ten_tb = sheet[f"D{row}"].value
|
| 58 |
so_luong = sheet[f"BM{row}"].value
|
| 59 |
-
|
| 60 |
if ten_tb and "tên loại dịch vụ" not in str(ten_tb).lower():
|
| 61 |
thiet_bi_list.append({
|
| 62 |
"Thiết bị": str(ten_tb).strip(),
|
|
|
|
| 28 |
|
| 29 |
for file in pyc_files:
|
| 30 |
try:
|
| 31 |
+
ten_khach = file.split("/")[1]
|
| 32 |
+
thu_muc_pyc = file.split("/")[2]
|
| 33 |
+
|
| 34 |
+
# === KIỂM TRA ĐÃ CÓ GCN HAY CHƯA ===
|
| 35 |
+
has_gcn = any(
|
| 36 |
+
f.startswith(f"Khach_hang/{ten_khach}/{thu_muc_pyc}/Giay_chung_nhan/")
|
| 37 |
+
and "GCN" in f.upper()
|
| 38 |
+
for f in all_files
|
| 39 |
+
)
|
| 40 |
+
if has_gcn:
|
| 41 |
+
continue # bỏ qua phiếu đã có GCN (đã hoàn thành)
|
| 42 |
+
|
| 43 |
+
# === ĐỌC THÔNG TIN PYC ===
|
| 44 |
local = hf_hub_download(
|
| 45 |
repo_id=REPO_ID,
|
| 46 |
repo_type="dataset",
|
|
|
|
| 51 |
wb = load_workbook(local, data_only=True)
|
| 52 |
sheet = wb.active
|
| 53 |
|
|
|
|
| 54 |
ten_file = file.split("/")[-1]
|
|
|
|
| 55 |
nguoi_lap = sheet["AH51"].value
|
| 56 |
ngay = sheet["BM3"].value
|
| 57 |
thang = sheet["BS3"].value
|
|
|
|
| 62 |
|
| 63 |
ngay_lap = f"{int(ngay):02}/{int(thang):02}/{nam}" if all([ngay, thang, nam]) else "Không rõ"
|
| 64 |
|
|
|
|
| 65 |
thiet_bi_list = []
|
| 66 |
for row in range(24, 100):
|
| 67 |
ten_tb = sheet[f"D{row}"].value
|
| 68 |
so_luong = sheet[f"BM{row}"].value
|
|
|
|
| 69 |
if ten_tb and "tên loại dịch vụ" not in str(ten_tb).lower():
|
| 70 |
thiet_bi_list.append({
|
| 71 |
"Thiết bị": str(ten_tb).strip(),
|