fix: require manual reply for constrained LF inquiries

This commit is contained in:
ZE-TH5-AR516 committed 2026-11-27 13:53:53 +08:00
1 parent 127d88e84e
commit 22b99eb53e
6 files changed
+94 -7

No files matched your search

+50
View File
@@ -651,6 +651,56 @@ class LfStockGateTests(unittest.TestCase):
self.assertIn("整机可用库存3台(部分覆盖,仍需补齐7台)", report)
self.assertNotIn("减速器实际可用量", report)
def test_original_lf_with_reducer_shortage_uses_manual_reply(self) -> None:
request = bridge.RequestInput(self.LF_MODEL, 10)
def query(query_request: bridge.RequestInput) -> dict[str, object]:
payload = successful_payload()
if query_request.model == request.model:
set_stock(payload, 3, query_request.quantity)
payload["data"]["采购信息"]["缺料明细"] = [
{"缺料物料": "20.30.00999", "物料名称": "来福减速器"}
]
return payload
with (
mock.patch.object(bridge, "run_controlled_query", side_effect=query),
mock.patch.object(bridge, "write_record") as record,
):
report = bridge.build_report(request)
original_section = report.split(f"1. {request.model}", 1)[1].split("\n\n", 1)[0]
self.assertIn(
"原型号分析:来福减速器后续需求需AR516核实,交期以人工答复为准",
original_section,
)
self.assertNotIn("AM516预测交期", original_section)
recorded_candidates = record.call_args.args[1]
self.assertTrue(recorded_candidates[0]["manual_lf_review"])
def test_original_lf_with_full_stock_keeps_api_lead_time(self) -> None:
payload = successful_payload()
set_stock(payload, 10, 10)
payload["data"]["采购信息"]["缺料明细"] = [
{"缺料物料": "20.30.00999", "物料名称": "来福减速器"}
]
details = bridge.lead_time_details(payload, 10)
candidate = {
"index": 1,
"model": self.LF_MODEL,
"type": "原型号,LF",
"details": details,
"manual_lf_review": bridge.lf_reducer_shortage_detected(self.LF_MODEL, details),
"reason": "原始需求基准",
"difference": "无",
"confirmation": "无",
}
report = "\n".join(bridge.candidate_report_lines(candidate, 10))
self.assertIn("AM516预测交期", report)
self.assertNotIn(bridge.LF_MANUAL_REVIEW_MESSAGE, report)
class CandidateBatchTests(unittest.TestCase):
def setUp(self) -> None:
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.