Add README and monthly unaccounted data feature

This commit is contained in:
2025-12-29 01:03:54 +08:00
parent 3b60ae9ecf
commit 283a035ab1
7 changed files with 1363 additions and 17 deletions

View File

@@ -85,7 +85,7 @@ class HandoverLogParser:
shift_start = block.find(shift_pattern) + len(shift_pattern)
# 找到下一个班次注意事项
# 找到下一个班次作为边界,不限制"注意事项"
next_pos = len(block)
for next_shift in ['白班', '夜班']:
if next_shift != shift:
@@ -93,10 +93,6 @@ class HandoverLogParser:
if pos != -1 and pos < next_pos:
next_pos = pos
notes_pos = block.find('注意事项:', shift_start)
if notes_pos != -1 and notes_pos < next_pos:
next_pos = notes_pos
shift_content = block[shift_start:next_pos]
self._parse_ships(shift_content, date, shift, logs)
@@ -109,15 +105,17 @@ class HandoverLogParser:
continue
cleaned = part.replace('\xa0', ' ').strip()
ship_match = re.search(r'#\s+(\S+)', cleaned)
# 匹配 "xxx# 船名" 格式(船号和船名分开)
ship_match = re.search(r'(\d+)#\s*(\S+)', cleaned)
if not ship_match:
continue
ship_name = ship_match.group(1)
ship_name = f"{ship_match.group(1)}#{ship_match.group(2)}"
vehicles_match = re.search(r'上场车辆数:(\d+)', cleaned)
teu_eff_match = re.search(
r'作业量/效率:(\d+)TEU[,\s]+([\d.]+)循环/车/小时', cleaned
r'作业量/效率:(\d+)TEU[,\s]*', cleaned
)
log = ShipLog(
@@ -125,7 +123,7 @@ class HandoverLogParser:
shift=shift,
ship_name=ship_name,
teu=int(teu_eff_match.group(1)) if teu_eff_match else None,
efficiency=float(teu_eff_match.group(2)) if teu_eff_match else None,
efficiency=None,
vehicles=int(vehicles_match.group(1)) if vehicles_match else None
)
logs.append(log)