[refactor] 공급유형 기준을 상품-협력사 매핑으로 전환
This commit is contained in:
1 parent
9ac8fe6363
commit
d21e7c10b0
35 files changed
+157
-333
No files matched your search
@@ -34,7 +34,7 @@ _T_QUOTATIONS = table(
|
||||
"quotations",
|
||||
column("qt_id"), column("user_id"), column("qt_setting_id"), column("version_id"),
|
||||
column("name"), column("number"), column("type"), column("status"),
|
||||
column("start_time"), column("end_time"), column("supplier_type"),
|
||||
column("start_time"), column("end_time"),
|
||||
schema="quotation",
|
||||
)
|
||||
_T_ITEMS = table(
|
||||
@@ -80,7 +80,6 @@ async def test_context_loaded_from_db(db_engine):
|
||||
qt_id=qid, user_id=uuid.uuid4(), qt_setting_id=uuid.uuid4(), version_id=uuid.uuid4(),
|
||||
name="로더 테스트", number="QT-LOADER-TEST", type=3, status=2,
|
||||
start_time=now, end_time=now + timedelta(days=1),
|
||||
supplier_type=2, # manufacture(제조) → 유통 코드 "A"
|
||||
))
|
||||
|
||||
def _ins_sess(s, session_id, supplier_id):
|
||||
@@ -125,7 +124,7 @@ async def test_context_loaded_from_db(db_engine):
|
||||
assert c["distribution_code"] == "B" # supplier_items.supply_type=3(총판) → B (매핑 우선)
|
||||
assert c["partner_count"] == 2 # 매핑 기준 취급 협력사 2곳 → MULTIPLE
|
||||
|
||||
# 매핑 삭제 후 새 세션(sid2) → 폴백 경로: 유통코드=quotations.supplier_type, 파트너=세션 이력
|
||||
# 매핑 삭제 후 새 세션(sid2) → 유통코드는 ChatService 기본값, 파트너는 세션 이력 폴백
|
||||
err = await DB_SESSION_MNG.execute_lambda_run(
|
||||
[DBType.MAIN.value],
|
||||
[lambda s: DB_SESSION_MNG.add(s, delete(_T_SUPPLIER_ITEMS).where(_T_SUPPLIER_ITEMS.c.item_id == iid))],
|
||||
@@ -133,7 +132,7 @@ async def test_context_loaded_from_db(db_engine):
|
||||
assert err == ErrorType.SUCCESS
|
||||
await ChatService().chat(eng, Req_Chat(session_id=str(sid2)))
|
||||
c2 = (await ChatSessionRepository(eng.company_id).get(str(sid2))).context
|
||||
assert c2["distribution_code"] == "A" # 폴백: quotations.supplier_type=2(제조) → A
|
||||
assert c2["distribution_code"] == "A" # 매핑 없음 → ChatService 기본값
|
||||
assert c2["partner_count"] == 2 # 폴백: 세션 이력 distinct supplier 2곳
|
||||
finally:
|
||||
await DB_SESSION_MNG.execute_lambda_run(
|
||||
@@ -197,9 +196,6 @@ async def test_loader_with_crud_double(db_engine):
|
||||
return ErrorType.SUCCESS, 12_000_000.0
|
||||
|
||||
async def get_supply_type(self, cdb, supplier_id, item_id):
|
||||
return ErrorType.SUCCESS, None # 매핑 없음 → 견적 기록 폴백
|
||||
|
||||
async def get_quotation_supplier_type(self, cdb, quotation_id):
|
||||
return ErrorType.SUCCESS, 3 # sole_agency(총판) → "B"
|
||||
|
||||
async def count_item_suppliers(self, cdb, item_id):
|
||||
@@ -215,7 +211,7 @@ async def test_loader_with_crud_double(db_engine):
|
||||
assert ctx.anchor_price == 50000 # 미박제 → 무할인 폴백(anchor=target)
|
||||
assert ctx.item_price == 7000
|
||||
assert ctx.revenue_amount == 12_000_000.0
|
||||
assert ctx.distribution_code == "B" # supplier_type=3(총판) → B
|
||||
assert ctx.distribution_code == "B" # supply_type=3(총판) → B
|
||||
assert ctx.partner_type is PartnerType.NONE
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user