22 lines
904 B
Python
22 lines
904 B
Python
from app.models import get_db, init_db
|
|
from app.models.order import OrderRecord
|
|
from app.models.sample import SampleRecord
|
|
from app.services.fuzzy_matcher import normalize_pn_for_matching, normalize_customer_name
|
|
|
|
init_db()
|
|
db = next(get_db())
|
|
|
|
pn = "PSMQC098N10LS2-AU_R2_002A1"
|
|
normalized_pn = normalize_pn_for_matching(pn)
|
|
customer_keyword = "SEMI"
|
|
|
|
orders = db.query(OrderRecord).filter(OrderRecord.pn.like(f"%{pn}%")).all()
|
|
print(f"--- Querying Orders for PN: {pn} ---")
|
|
for o in orders:
|
|
print(f"ID: {o.id}, OrderNo: {o.order_no}, CustID: {o.cust_id}, Customer: {o.customer}, PN: {o.pn}, Qty: {o.qty}, Date: {o.date}")
|
|
|
|
print(f"\n--- Checking Parsed Samples ---")
|
|
samples = db.query(SampleRecord).filter(SampleRecord.pn.like(f"%{pn}%")).all()
|
|
for s in samples:
|
|
print(f"ID: {s.id}, OrderNo: {s.order_no}, CustID: {s.cust_id}, Customer: {s.customer}, PN: {s.pn}, Qty: {s.qty}, Date: {s.date}")
|