22 lines
920 B
Python
22 lines
920 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 瀚碩 ---")
|
|
dits = db.query(DitRecord).filter(DitRecord.customer.like('%瀚碩%')).all()
|
|
print(f"Total DITs for 瀚碩: {len(dits)}")
|
|
for d in dits:
|
|
print(f" ID: {d.id}, Op: {d.op_id}, ERP: {d.erp_account}, PN: {d.pn}, Cust: {d.customer}")
|
|
|
|
print("\n--- Searching Orders for 184100 or 瀚碩 ---")
|
|
orders = db.query(OrderRecord).filter((OrderRecord.cust_id == '184100') | (OrderRecord.customer.like('%瀚碩%'))).all()
|
|
print(f"Total Orders for 184100 or 瀚碩: {len(orders)}")
|
|
for o in orders:
|
|
print(f" ID: {o.id}, OrderNo: {o.order_no}, CustID: {o.cust_id}, PN: {o.pn}, Cust: {o.customer}")
|
|
|
|
except Exception as e:
|
|
print(f"Error: {e}")
|
|
finally:
|
|
db.close()
|