_gen_mock_263.py 4.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. """Generate minimal Mock samples for 1.0.263 API endpoints."""
  2. import json
  3. from pathlib import Path
  4. OUT = Path(__file__).resolve().parents[1] / "mock_api" / "samples"
  5. SAMPLES = {
  6. "contract_review_flow.json": [{"bizKey": "CR-CT-0001#1#1", "ReviewBillNo": "CR-CT-0001", "StageNo": "1", "RecID": 1, "updateTime": "2026-07-20T10:00:00"}],
  7. "linkage_plan.json": [{"bizKey": "SO-CT-0001#91C0D2C#1", "bill_no": "SO-CT-0001", "item_number": "91C0D2C", "id": 1, "updateTime": "2026-07-20T10:00:00"}],
  8. "product_design.json": [{"bizKey": "PD-CT-0001", "BillNo": "PD-CT-0001", "updateTime": "2026-07-20T10:00:00"}],
  9. "product_design_bom.json": [{"bizKey": "100#1", "ProductDesignId": 100, "Id": 1, "updateTime": "2026-07-20T10:00:00"}],
  10. "product_design_routing.json": [{"bizKey": "100#1", "ProductDesignId": 100, "Id": 1, "updateTime": "2026-07-20T10:00:00"}],
  11. "requirement_examine_detail.json": [{"bizKey": "10#91C0D2C#1", "examine_id": 10, "item_number": "91C0D2C", "Id": 1, "updateTime": "2026-07-20T10:00:00"}],
  12. "requirement_examine_result.json": [{"bizKey": "SO-CT-0001#WO-CT-0001#1", "bill_no": "SO-CT-0001", "morder_no": "WO-CT-0001", "Id": 1, "updateTime": "2026-07-20T10:00:00"}],
  13. "sales_order_change.json": [{"bizKey": "SO-CT-0001#1", "bill_no": "SO-CT-0001", "Id": 1, "updateTime": "2026-07-20T10:00:00"}],
  14. "shipping_plan_detail.json": [{"bizKey": "1#SO-CT-0001#1", "plan_id": 1, "OrdNbr": "SO-CT-0001", "RecID": 1, "updateTime": "2026-07-20T10:00:00"}],
  15. "period_sequence.json": [{"bizKey": "100#WO-CT-0001#10#1", "Domain": "100", "WorkOrds": "WO-CT-0001", "Op": "10", "Sequence": 1, "updateTime": "2026-07-20T10:00:00"}],
  16. "consignee.json": [{"bizKey": "100#ADDR-01", "Domain": "100", "Address": "ADDR-01", "updateTime": "2026-07-20T10:00:00"}],
  17. "inventory.json": [{"bizKey": "100#91C0D2C#A01", "Domain": "100", "ItemNum": "91C0D2C", "Location": "A01", "updateTime": "2026-07-20T10:00:00"}],
  18. "item_new.json": [{"bizKey": "0#ITEM-NEW-01", "tenant_id": 0, "number": "ITEM-NEW-01", "updateTime": "2026-07-20T10:00:00"}],
  19. "s3_receipt_detail.json": [{"bizKey": "100#RC-S3-CT-0001#1", "Domain": "100", "Receiver": "RC-S3-CT-0001", "Line": 1, "updateTime": "2026-07-20T10:00:00"}],
  20. "routing_outsource.json": [{"bizKey": "100#R01#10#S001", "Domain": "100", "RoutingCode": "R01", "Op": "10", "SupplierCode": "S001", "updateTime": "2026-07-20T10:00:00"}],
  21. "shipper_detail.json": [{"bizKey": "1#10", "glid": "1", "id": "10", "updateTime": "2026-07-20T10:00:00"}],
  22. "source_list.json": [{"bizKey": "91C0D2C#S001", "number": "91C0D2C", "supplier_number": "S001", "updateTime": "2026-07-20T10:00:00"}],
  23. "s3_work_order.json": [{"bizKey": "100#WO-CT-0001", "Domain": "100", "WorkOrd": "WO-CT-0001", "updateTime": "2026-07-20T10:00:00"}],
  24. "s3_work_order_detail.json": [{"bizKey": "100#WO-CT-0001#10#91C0D2C", "Domain": "100", "WorkOrd": "WO-CT-0001", "Op": "10", "ItemNum": "91C0D2C", "updateTime": "2026-07-20T10:00:00"}],
  25. "s3_work_order_routing.json": [{"bizKey": "100#WO-CT-0001#10", "Domain": "100", "WorkOrd": "WO-CT-0001", "OP": "10", "updateTime": "2026-07-20T10:00:00"}],
  26. }
  27. ENDPOINTS = {
  28. "/api/contract-review-flow": "samples/contract_review_flow.json",
  29. "/api/linkage-plan": "samples/linkage_plan.json",
  30. "/api/product-design": "samples/product_design.json",
  31. "/api/product-design-bom": "samples/product_design_bom.json",
  32. "/api/product-design-routing": "samples/product_design_routing.json",
  33. "/api/requirement-examine-detail": "samples/requirement_examine_detail.json",
  34. "/api/requirement-examine-result": "samples/requirement_examine_result.json",
  35. "/api/sales-order-change": "samples/sales_order_change.json",
  36. "/api/shipping-plan-detail": "samples/shipping_plan_detail.json",
  37. "/api/period-sequence": "samples/period_sequence.json",
  38. "/api/consignee": "samples/consignee.json",
  39. "/api/inventory": "samples/inventory.json",
  40. "/api/item-new": "samples/item-new.json",
  41. "/api/s3-receipt-detail": "samples/s3_receipt_detail.json",
  42. "/api/routing-outsource": "samples/routing_outsource.json",
  43. "/api/shipper-detail": "samples/shipper_detail.json",
  44. "/api/source-list": "samples/source_list.json",
  45. "/api/s3-work-order": "samples/s3_work_order.json",
  46. "/api/s3-work-order-detail": "samples/s3_work_order_detail.json",
  47. "/api/s3-work-order-routing": "samples/s3_work_order_routing.json",
  48. }
  49. def main():
  50. OUT.mkdir(parents=True, exist_ok=True)
  51. for name, rows in SAMPLES.items():
  52. (OUT / name).write_text(json.dumps(rows, ensure_ascii=False, indent=2), encoding="utf-8")
  53. print("wrote", name)
  54. ep_path = OUT.parent / "endpoints.json"
  55. ep = json.loads(ep_path.read_text(encoding="utf-8"))
  56. ep.update(ENDPOINTS)
  57. ep_path.write_text(json.dumps(ep, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
  58. print("endpoints", len(ep))
  59. if __name__ == "__main__":
  60. main()