Commit a21ddca9 by 黄南光

修改react形式

1 parent f7c609a4
......@@ -24,7 +24,8 @@
"po_max_page":5(采购单列表每页最多返回 5 条;0 = 不限),
"po_no_total":true(采购单列表不返回 total), "po_ignore_page":true(忽略页码,总是第 1 页),
"bulk_parts":60(造 60 个无上限配件 BULK0001…,测明细翻页),
"fail_submit":true(提交接口报错), "submit_check_fail":true(检查返回重复订货、不允许提交),
"fail_submit":true(提交接口报错), "submit_check_fail":true(检查返回停用件、不允许提交),
"submit_check_repeat":true(检查返回 repeatDetails 重复订货,但仍允许提交),
"submit_drop":true(提交已生效但响应 502,模拟断网),
"create_drop":true(建单已生效但响应 502 网关错误页),
"po_page_fail":2(接下来 2 次采购单列表查询返回 502),
......@@ -205,7 +206,7 @@ def reset():
S.update({"stock": _stock_rows(), "orders": orders, "details": {o["id"]: _details(o) for o in orders},
"po_max_page": None, "valid": set(), "codes": set(),
"sso": set(), "fail_create": False, "hide_warehouse": False, "sso_off": False, "captcha": False, "overlay": "",
"fail_submit": False, "submit_check_fail": False, "submit_drop": False, "create_drop": False,
"fail_submit": False, "submit_check_fail": False, "submit_check_repeat": False, "submit_drop": False, "create_drop": False,
"po_page_fail": 0,
"auth_base": None, "bulk_masters": {},
"po_no_total": False, "po_ignore_page": False, "po_filter": False, "po_filter_error": False,
......@@ -256,7 +257,7 @@ async def mock_set(request: Request):
if d.get("expire_tokens"):
S["valid"].clear()
for k in ("fail_create", "hide_warehouse", "sso_off", "po_no_total", "po_ignore_page", "captcha", "po_filter",
"po_filter_error", "fail_submit", "submit_check_fail", "submit_drop", "create_drop"):
"po_filter_error", "fail_submit", "submit_check_fail", "submit_check_repeat", "submit_drop", "create_drop"):
if k in d:
S[k] = bool(d[k])
if "po_page_fail" in d:
......@@ -564,12 +565,13 @@ async def po_check(oid: str, request: Request):
o = _order(oid)
if not o:
return _err(50000003, "单据不存在")
rep = [{"partNo": d["partNo"], "orderNo": "S20261101001"} for d in S["details"].get(o["id"], [])[:1]] \
if S["submit_check_fail"] else []
return _ok({"accountBalanceFlag": True, "inactiveDetails": [], "inactiveNum": 0, "limitNum": 0,
first = [{"partNo": d["partNo"], "orderNo": "S20261101001"} for d in S["details"].get(o["id"], [])[:1]]
bad = first if S["submit_check_fail"] else [] # 模拟停用件:不允许提交
rep = first if S["submit_check_repeat"] else [] # 模拟别人的单里订过同零件:仍允许提交(见 actions.CHECK_LISTS 备注)
return _ok({"accountBalanceFlag": True, "inactiveDetails": bad, "inactiveNum": len(bad), "limitNum": 0,
"limitedDetails": [], "noAuthPartNoList": None, "orderSource": o["orderSource"], "packageFlag": False,
"pakckageList": None, "repeatDetails": rep, "repeatNum": len(rep), "replaceDetails": [],
"submitFlag": not rep, "version": o["version"]})
"submitFlag": not bad, "version": o["version"]})
@app.post(P + "/bff/parts-po/submit-parts-po/{oid}")
......
......@@ -1054,8 +1054,16 @@ def po_status(cfg, sess, order_id, order_no, since, supplier_code=None, steps=No
# check-parts-po 只抓到过「完全干净」的成功样本:submitFlag=true、accountBalanceFlag=true、各 *Details 为 []、
# *Num 为 0、noAuthPartNoList=null、packageFlag=false。失败时这些字段的含义只能按字段名推断(标「疑似」),
# 所以只要和干净样本有任何不同就不提交,原字段名 + 原始内容照搬给人看。
#
# 【2026-11-06 去掉「疑似重复订货」检查(repeatDetails / repeatNum)】
# 原因:repeatDetails 命中的是 DMS 里「别人」建的单(如 S20261106007,未提交的草稿,同零件同数量),
# 不是我们自己重复建的单;这种重复不属于我们的问题,却会把正常提交一直挡住(报 repeatDetails(疑似重复订货))。
# 所以 check_problems 不再看这两个字段:repeatDetails 非空也照常提交。其余检查项(submitFlag / 余额 / 停用 / 限购 /
# 替代件 / 无权限 / 包装数)保持不变。若以后要恢复,把下面这一行加回 CHECK_LISTS 即可:
# ("repeatDetails", "repeatNum", "疑似重复订货"),
# 注意:提交前核对 _verify_for_submit 仍会确认 DMS 里这张单的明细和云端建单时完全一致,不受影响。
CHECK_LISTS = (("inactiveDetails", "inactiveNum", "疑似停用件"), ("limitedDetails", "limitNum", "疑似限购"),
("repeatDetails", "repeatNum", "疑似重复订货"), ("replaceDetails", None, "疑似有替代件"),
("replaceDetails", None, "疑似有替代件"),
("noAuthPartNoList", None, "疑似无订货权限"), ("pakckageList", None, "疑似包装数问题"))
......
......@@ -461,10 +461,18 @@ class EdgeTests(unittest.TestCase):
with self.assertRaises(actions.ActionError) as cm:
actions.submit_po(c, DmsSession(c), r["order_id"], r["order_no"], exp, "single")
self.assertEqual(cm.exception.code, "check_failed")
self.assertIn("repeatDetails(疑似重复订货)", str(cm.exception))
self.assertIn("inactiveDetails(疑似停用件)", str(cm.exception))
self.assertIn("submitFlag=false", str(cm.exception))
self.assertEqual(mock_state()["count"]["submit"], 0)
def test_check_repeat_details_not_blocking(self):
"""repeatDetails 命中的是别人的单(如 S20261106007),不再拦截提交(见 actions.CHECK_LISTS 备注)。"""
c = self.cfg()
r, exp = self._created(c)
mock(submit_check_repeat=True)
actions.submit_po(c, DmsSession(c), r["order_id"], r["order_no"], exp, "single")
self.assertEqual(mock_state()["count"]["submit"], 1)
def test_check_problems_clean_sample(self):
clean = {"accountBalanceFlag": True, "inactiveDetails": [], "inactiveNum": 0, "limitNum": 0,
"limitedDetails": [], "noAuthPartNoList": None, "orderSource": "1", "packageFlag": False,
......@@ -475,6 +483,8 @@ class EdgeTests(unittest.TestCase):
actions.check_problems(dict(clean, accountBalanceFlag=False))[0])
self.assertTrue(actions.check_problems(dict(clean, noAuthPartNoList=["019990A115"])))
self.assertTrue(actions.check_problems(dict(clean, inactiveNum=1)))
self.assertEqual(actions.check_problems(dict(clean, repeatDetails=[{"applyedOrderNumber": "S20261106007"}],
repeatNum=1)), []) # 重复订货不拦截
def test_submit_verify_mismatch_refuses(self):
c = self.cfg()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!