23 lines
836 B
Python
23 lines
836 B
Python
from app.models import SessionLocal, DitRecord, OrderRecord
|
|
from app.services.fuzzy_matcher import normalize_pn_for_matching, normalize_id
|
|
|
|
db = SessionLocal()
|
|
try:
|
|
print("--- Searching DITs for Op: OP0000022509 ---")
|
|
dit = db.query(DitRecord).filter(DitRecord.op_id == 'OP0000022509').first()
|
|
if dit:
|
|
print(f"DIT Found: ID={dit.id}, Op={dit.op_id}, ERP={dit.erp_account}, PN={dit.pn}, Cust={dit.customer}")
|
|
print(f" Normalized ERP: {normalize_id(dit.erp_account)}")
|
|
else:
|
|
print("DIT OP0000022509 not found!")
|
|
# List first 10 DITs
|
|
print("\nFirst 10 DITs in DB:")
|
|
dits = db.query(DitRecord).limit(10).all()
|
|
for d in dits:
|
|
print(f" Op={d.op_id}, ERP={d.erp_account}, PN={d.pn}")
|
|
|
|
except Exception as e:
|
|
print(f"Error: {e}")
|
|
finally:
|
|
db.close()
|