563 lines
32 KiB
Python
563 lines
32 KiB
Python
# -*- coding: utf-8 -*-
|
||
# 修改人:Ld 修改时间:2026-09-29 09:58:57; 生成 JY1.0 系统使用说明书及配套说明图片。
|
||
from __future__ import annotations
|
||
|
||
import os
|
||
import shutil
|
||
from datetime import datetime
|
||
from pathlib import Path
|
||
|
||
from PIL import Image, ImageDraw, ImageFont
|
||
from docx import Document
|
||
from docx.enum.section import WD_SECTION
|
||
from docx.enum.table import WD_ALIGN_VERTICAL
|
||
from docx.enum.text import WD_ALIGN_PARAGRAPH
|
||
from docx.oxml import OxmlElement
|
||
from docx.oxml.ns import qn
|
||
from docx.shared import Cm, Inches, Pt, RGBColor
|
||
|
||
|
||
ROOT = Path(r"D:\景耀\JY1.0")
|
||
OUT_DIR = ROOT / "outputs" / "system_user_manual"
|
||
ASSET_DIR = OUT_DIR / "assets"
|
||
DOCX_PATH = OUT_DIR / "JY1.0系统使用说明书.docx"
|
||
NOW = "2026-09-29 09:58:57"
|
||
|
||
|
||
# 修改人:Ld 修改时间:2026-09-29 09:58:57; 统一字体加载,保证中文示意图在 Windows 环境正常显示。
|
||
def font(size: int, bold: bool = False) -> ImageFont.FreeTypeFont:
|
||
candidates = [
|
||
r"C:\Windows\Fonts\msyhbd.ttc" if bold else r"C:\Windows\Fonts\msyh.ttc",
|
||
r"C:\Windows\Fonts\simhei.ttf",
|
||
r"C:\Windows\Fonts\simsun.ttc",
|
||
]
|
||
for item in candidates:
|
||
if item and Path(item).exists():
|
||
return ImageFont.truetype(item, size=size)
|
||
return ImageFont.load_default()
|
||
|
||
|
||
def text_size(draw: ImageDraw.ImageDraw, text: str, fnt: ImageFont.ImageFont):
|
||
box = draw.textbbox((0, 0), text, font=fnt)
|
||
return box[2] - box[0], box[3] - box[1]
|
||
|
||
|
||
def rounded(draw, box, radius, fill, outline=None, width=1):
|
||
draw.rounded_rectangle(box, radius=radius, fill=fill, outline=outline, width=width)
|
||
|
||
|
||
def center_text(draw, box, text, fnt, fill="#1F2937"):
|
||
w, h = text_size(draw, text, fnt)
|
||
x = box[0] + (box[2] - box[0] - w) / 2
|
||
y = box[1] + (box[3] - box[1] - h) / 2 - 1
|
||
draw.text((x, y), text, font=fnt, fill=fill)
|
||
|
||
|
||
def wrap_text(draw, text, fnt, max_width):
|
||
lines = []
|
||
current = ""
|
||
for ch in text:
|
||
trial = current + ch
|
||
if text_size(draw, trial, fnt)[0] <= max_width:
|
||
current = trial
|
||
else:
|
||
if current:
|
||
lines.append(current)
|
||
current = ch
|
||
if current:
|
||
lines.append(current)
|
||
return lines
|
||
|
||
|
||
# 修改人:Ld 修改时间:2026-09-29 09:58:57; 生成手册中使用的登录、工作台、列表、流程和移动端示意图。
|
||
def create_manual_images():
|
||
ASSET_DIR.mkdir(parents=True, exist_ok=True)
|
||
create_login_image(ASSET_DIR / "01_login.png")
|
||
create_workspace_image(ASSET_DIR / "02_workspace.png")
|
||
create_table_image(ASSET_DIR / "03_table_query.png")
|
||
create_flow_image(ASSET_DIR / "04_business_flow.png")
|
||
create_mobile_image(ASSET_DIR / "05_mobile_pda.png")
|
||
|
||
source_assets = [
|
||
ROOT / "docs" / "assets" / "warehouse-visualization" / "main.png",
|
||
ROOT / "docs" / "assets" / "warehouse-visualization" / "filter.png",
|
||
ROOT / "docs" / "assets" / "warehouse-visualization" / "detail.png",
|
||
ROOT / "docs" / "assets" / "warehouse-management-doc" / "flow_inbound.png",
|
||
ROOT / "docs" / "assets" / "warehouse-management-doc" / "flow_outbound.png",
|
||
ROOT / "docs" / "assets" / "warehouse-management-doc" / "flow_count.png",
|
||
]
|
||
for item in source_assets:
|
||
if item.exists():
|
||
shutil.copy2(item, ASSET_DIR / item.name)
|
||
|
||
|
||
def create_login_image(path: Path):
|
||
img = Image.new("RGB", (1280, 720), "#E9EEF7")
|
||
draw = ImageDraw.Draw(img)
|
||
for i in range(0, 720, 16):
|
||
color = (232 - i // 40, 238 - i // 60, 247)
|
||
draw.rectangle((0, i, 1280, i + 16), fill=color)
|
||
draw.rectangle((0, 0, 1280, 720), outline="#D7E0EE", width=2)
|
||
draw.text((96, 110), "景耀 JY1.0 MES", font=font(44, True), fill="#111827")
|
||
draw.text((98, 172), "制造执行与业务协同系统", font=font(24), fill="#4B5563")
|
||
rounded(draw, (760, 92, 1138, 548), 18, "#FFFFFF", "#D9E2EF", 2)
|
||
draw.text((808, 140), "用户登录", font=font(30, True), fill="#111827")
|
||
draw.text((808, 196), "输入账号和密码后进入系统", font=font(17), fill="#6B7280")
|
||
for idx, label in enumerate(["用户名", "密码"]):
|
||
y = 252 + idx * 86
|
||
draw.text((808, y - 30), label, font=font(16), fill="#374151")
|
||
rounded(draw, (808, y, 1090, y + 44), 8, "#F9FAFB", "#CAD5E3", 1)
|
||
draw.text((828, y + 10), "请输入" + label, font=font(15), fill="#9CA3AF")
|
||
rounded(draw, (808, 442, 1090, 492), 8, "#2563EB", "#2563EB", 1)
|
||
center_text(draw, (808, 442, 1090, 492), "登录", font(18, True), "#FFFFFF")
|
||
draw.text((808, 512), "需要修改密码时,点击登录框中的“修改密码”。", font=font(15), fill="#4B5563")
|
||
img.save(path)
|
||
|
||
|
||
def create_workspace_image(path: Path):
|
||
img = Image.new("RGB", (1280, 720), "#F3F4F6")
|
||
draw = ImageDraw.Draw(img)
|
||
draw.rectangle((0, 0, 230, 720), fill="#263445")
|
||
draw.rectangle((230, 0, 1280, 64), fill="#FFFFFF")
|
||
draw.text((28, 24), "JY1.0", font=font(28, True), fill="#FFFFFF")
|
||
modules = ["基础数据", "销售管理", "技术中心", "采购管理", "制造中心", "精工车间", "装配管理", "仓储管理", "设备管理"]
|
||
y = 92
|
||
for i, m in enumerate(modules):
|
||
fill = "#3B82F6" if i == 7 else "#263445"
|
||
draw.rectangle((0, y - 8, 230, y + 34), fill=fill)
|
||
draw.text((36, y), m, font=font(17, i == 7), fill="#FFFFFF")
|
||
y += 54
|
||
draw.text((270, 22), "首页 / 仓储管理 / 库存查询", font=font(18), fill="#374151")
|
||
draw.text((1130, 22), "当前用户", font=font(16), fill="#6B7280")
|
||
rounded(draw, (270, 102, 1218, 652), 8, "#FFFFFF", "#E5E7EB", 2)
|
||
draw.text((306, 138), "工作台区域", font=font(28, True), fill="#111827")
|
||
draw.text((306, 186), "左侧为菜单导航,上方为当前位置和用户信息,中间为具体业务页面。", font=font(18), fill="#4B5563")
|
||
for i, title in enumerate(["待处理任务", "今日入库", "库存预警"]):
|
||
x = 306 + i * 292
|
||
rounded(draw, (x, 246, x + 250, 360), 10, "#EFF6FF" if i == 0 else "#F8FAFC", "#D7DEE8", 1)
|
||
draw.text((x + 24, 270), title, font=font(18, True), fill="#1F2937")
|
||
draw.text((x + 24, 310), str([18, 42, 6][i]), font=font(34, True), fill="#2563EB")
|
||
rounded(draw, (306, 408, 1130, 594), 8, "#FFFFFF", "#D1D5DB", 1)
|
||
for yy in [452, 496, 540]:
|
||
draw.line((326, yy, 1110, yy), fill="#E5E7EB", width=1)
|
||
draw.text((330, 424), "常用业务列表", font=font(18, True), fill="#111827")
|
||
headers = ["单据编号", "业务类型", "状态", "经办人", "更新时间"]
|
||
xs = [330, 520, 690, 820, 970]
|
||
for x, h in zip(xs, headers):
|
||
draw.text((x, 466), h, font=font(15, True), fill="#374151")
|
||
img.save(path)
|
||
|
||
|
||
def create_table_image(path: Path):
|
||
img = Image.new("RGB", (1280, 720), "#F8FAFC")
|
||
draw = ImageDraw.Draw(img)
|
||
rounded(draw, (48, 44, 1232, 666), 10, "#FFFFFF", "#E5E7EB", 2)
|
||
draw.text((84, 78), "通用列表页面操作示意", font=font(30, True), fill="#111827")
|
||
labels = ["物料编码", "物料名称", "状态", "日期范围"]
|
||
x = 84
|
||
for label in labels:
|
||
draw.text((x, 140), label, font=font(15), fill="#374151")
|
||
rounded(draw, (x, 166, x + 190, 206), 6, "#F9FAFB", "#D1D5DB", 1)
|
||
x += 220
|
||
for i, (txt, fill) in enumerate([("查询", "#16A34A"), ("新增", "#2563EB"), ("导出", "#6B7280")]):
|
||
bx = 976 + i * 74
|
||
rounded(draw, (bx, 166, bx + 64, 206), 6, fill, fill, 1)
|
||
center_text(draw, (bx, 166, bx + 64, 206), txt, font(15, True), "#FFFFFF")
|
||
top = 252
|
||
headers = ["序号", "物料编码", "物料名称", "图号型号", "库存", "状态", "操作"]
|
||
widths = [70, 170, 220, 220, 100, 130, 180]
|
||
x0 = 84
|
||
y = top
|
||
draw.rectangle((x0, y, x0 + sum(widths), y + 46), fill="#1F4E79")
|
||
pos = x0
|
||
for h, w in zip(headers, widths):
|
||
center_text(draw, (pos, y, pos + w, y + 46), h, font(15, True), "#FFFFFF")
|
||
pos += w
|
||
rows = [
|
||
["1", "WL-001", "轴承座", "ZCZ-01", "128", "正常", "编辑 删除"],
|
||
["2", "WL-002", "导轨", "DG-35", "16", "预警", "编辑 删除"],
|
||
["3", "WL-003", "联轴器", "LZQ-10", "0", "缺料", "编辑 删除"],
|
||
["4", "WL-004", "密封圈", "MF-08", "300", "正常", "编辑 删除"],
|
||
]
|
||
y += 46
|
||
for r, row in enumerate(rows):
|
||
fill = "#FFFFFF" if r % 2 == 0 else "#F3F7FC"
|
||
draw.rectangle((x0, y, x0 + sum(widths), y + 44), fill=fill, outline="#D9D9D9")
|
||
pos = x0
|
||
for val, w in zip(row, widths):
|
||
color = "#DC2626" if val in ["预警", "缺料"] else "#1F2937"
|
||
center_text(draw, (pos, y, pos + w, y + 44), val, font(14), color)
|
||
draw.line((pos, y, pos, y + 44), fill="#D9D9D9")
|
||
pos += w
|
||
y += 44
|
||
draw.text((84, 514), "操作顺序:输入筛选条件 → 点击查询 → 勾选或定位记录 → 执行编辑、删除、导出等操作。", font=font(18), fill="#374151")
|
||
img.save(path)
|
||
|
||
|
||
def create_flow_image(path: Path):
|
||
img = Image.new("RGB", (1280, 720), "#FFFFFF")
|
||
draw = ImageDraw.Draw(img)
|
||
draw.text((78, 56), "典型业务流转示意", font=font(32, True), fill="#111827")
|
||
steps = [
|
||
("销售下单", "合同、订单、交期"),
|
||
("技术确认", "BOM、图纸、改制"),
|
||
("采购与生产", "采购入库、派工执行"),
|
||
("质检与入库", "审核、扫码、库存更新"),
|
||
("领料与装配", "领料单、装配任务"),
|
||
("发货追溯", "出库、发货、订单追溯"),
|
||
]
|
||
x, y = 88, 190
|
||
for i, (title, desc) in enumerate(steps):
|
||
bx = x + i * 190
|
||
rounded(draw, (bx, y, bx + 150, y + 116), 14, "#EFF6FF", "#93C5FD", 2)
|
||
center_text(draw, (bx, y + 16, bx + 150, y + 52), title, font(18, True), "#1F2937")
|
||
for j, line in enumerate(wrap_text(draw, desc, font(14), 118)):
|
||
draw.text((bx + 18, y + 66 + j * 22), line, font=font(14), fill="#4B5563")
|
||
if i < len(steps) - 1:
|
||
draw.line((bx + 154, y + 58, bx + 184, y + 58), fill="#2563EB", width=4)
|
||
draw.polygon([(bx + 184, y + 58), (bx + 174, y + 50), (bx + 174, y + 66)], fill="#2563EB")
|
||
draw.text((88, 384), "系统以订单为主线串联销售、技术、采购、制造、装配、仓储和设备等模块。实际页面会根据用户权限显示相应菜单。", font=font(19), fill="#374151")
|
||
rounded(draw, (88, 450, 1190, 600), 12, "#F9FAFB", "#E5E7EB", 1)
|
||
notes = [
|
||
"1. 查询类页面用于查看进度、库存、记录和追溯信息。",
|
||
"2. 业务提交类页面会写入后端数据库,提交前应核对编号、数量、日期和经办人。",
|
||
"3. 审核类页面通常改变业务状态,审核后再进入下一环节。",
|
||
]
|
||
for i, note in enumerate(notes):
|
||
draw.text((124, 486 + i * 34), note, font=font(18), fill="#374151")
|
||
img.save(path)
|
||
|
||
|
||
def create_mobile_image(path: Path):
|
||
img = Image.new("RGB", (900, 720), "#F3F4F6")
|
||
draw = ImageDraw.Draw(img)
|
||
rounded(draw, (300, 36, 600, 684), 34, "#111827", "#111827", 1)
|
||
rounded(draw, (318, 70, 582, 650), 20, "#FFFFFF", "#FFFFFF", 1)
|
||
draw.text((354, 102), "PDA采购扫码入库", font=font(20, True), fill="#111827")
|
||
draw.text((354, 138), "扫描条码后核对明细", font=font(14), fill="#6B7280")
|
||
for i, label in enumerate(["采购合同", "物料编码", "入库数量", "库位"]):
|
||
y = 190 + i * 78
|
||
draw.text((342, y), label, font=font(15), fill="#374151")
|
||
rounded(draw, (342, y + 24, 558, y + 58), 6, "#F9FAFB", "#D1D5DB", 1)
|
||
rounded(draw, (342, 528, 558, 578), 8, "#2563EB", "#2563EB", 1)
|
||
center_text(draw, (342, 528, 558, 578), "提交入库", font(16, True), "#FFFFFF")
|
||
draw.text((66, 130), "移动端页面适合扫码、入库、派工等现场操作。", font=font(22, True), fill="#111827")
|
||
draw.text((66, 180), "操作要点:", font=font(18, True), fill="#374151")
|
||
tips = ["保持网络连接", "扫码后核对物料和数量", "异常时先取消提交", "提交成功后刷新列表确认"]
|
||
for i, tip in enumerate(tips):
|
||
draw.ellipse((78, 228 + i * 50, 92, 242 + i * 50), fill="#2563EB")
|
||
draw.text((108, 220 + i * 50), tip, font=font(18), fill="#374151")
|
||
img.save(path)
|
||
|
||
|
||
def set_cell_shading(cell, fill):
|
||
tc_pr = cell._tc.get_or_add_tcPr()
|
||
shd = OxmlElement("w:shd")
|
||
shd.set(qn("w:fill"), fill)
|
||
tc_pr.append(shd)
|
||
|
||
|
||
def set_cell_border(cell, color="D9D9D9"):
|
||
tc = cell._tc
|
||
tc_pr = tc.get_or_add_tcPr()
|
||
borders = tc_pr.first_child_found_in("w:tcBorders")
|
||
if borders is None:
|
||
borders = OxmlElement("w:tcBorders")
|
||
tc_pr.append(borders)
|
||
for edge in ("top", "left", "bottom", "right", "insideH", "insideV"):
|
||
tag = "w:{}".format(edge)
|
||
element = borders.find(qn(tag))
|
||
if element is None:
|
||
element = OxmlElement(tag)
|
||
borders.append(element)
|
||
element.set(qn("w:val"), "single")
|
||
element.set(qn("w:sz"), "6")
|
||
element.set(qn("w:space"), "0")
|
||
element.set(qn("w:color"), color)
|
||
|
||
|
||
def set_repeat_table_header(row):
|
||
tr_pr = row._tr.get_or_add_trPr()
|
||
tbl_header = OxmlElement("w:tblHeader")
|
||
tbl_header.set(qn("w:val"), "true")
|
||
tr_pr.append(tbl_header)
|
||
|
||
|
||
def set_run_font(run, size=None, bold=None, color=None, name="Microsoft YaHei"):
|
||
run.font.name = name
|
||
run._element.rPr.rFonts.set(qn("w:eastAsia"), name)
|
||
run._element.rPr.rFonts.set(qn("w:ascii"), name)
|
||
run._element.rPr.rFonts.set(qn("w:hAnsi"), name)
|
||
if size:
|
||
run.font.size = Pt(size)
|
||
if bold is not None:
|
||
run.bold = bold
|
||
if color:
|
||
run.font.color.rgb = RGBColor.from_string(color)
|
||
|
||
|
||
def paragraph(doc, text="", style=None, bold=False, size=None, color=None, align=None, space_after=6):
|
||
p = doc.add_paragraph(style=style)
|
||
if align is not None:
|
||
p.alignment = align
|
||
p.paragraph_format.space_after = Pt(space_after)
|
||
p.paragraph_format.line_spacing = 1.2
|
||
if text:
|
||
run = p.add_run(text)
|
||
set_run_font(run, size=size, bold=bold, color=color)
|
||
return p
|
||
|
||
|
||
def heading(doc, text, level=1):
|
||
p = doc.add_heading(level=level)
|
||
run = p.add_run(text)
|
||
set_run_font(run, bold=True, color="000000", size=18 if level == 1 else 14)
|
||
p.paragraph_format.space_before = Pt(10 if level == 1 else 6)
|
||
p.paragraph_format.space_after = Pt(6)
|
||
return p
|
||
|
||
|
||
def add_image(doc, image_path, caption, width=6.3):
|
||
p = doc.add_paragraph()
|
||
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
|
||
p.add_run().add_picture(str(image_path), width=Inches(width))
|
||
cap = paragraph(doc, caption, size=9, color="4B5563", align=WD_ALIGN_PARAGRAPH.CENTER, space_after=10)
|
||
cap.paragraph_format.keep_with_next = False
|
||
|
||
|
||
def add_table(doc, headers, rows, widths=None):
|
||
table = doc.add_table(rows=1, cols=len(headers))
|
||
table.style = "Table Grid"
|
||
hdr = table.rows[0]
|
||
set_repeat_table_header(hdr)
|
||
for i, cell in enumerate(hdr.cells):
|
||
cell.text = headers[i]
|
||
cell.vertical_alignment = WD_ALIGN_VERTICAL.CENTER
|
||
set_cell_shading(cell, "1F4E79")
|
||
set_cell_border(cell)
|
||
for p in cell.paragraphs:
|
||
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
|
||
for run in p.runs:
|
||
set_run_font(run, size=9, bold=True, color="FFFFFF")
|
||
for r, row in enumerate(rows):
|
||
cells = table.add_row().cells
|
||
for i, val in enumerate(row):
|
||
cells[i].text = val
|
||
cells[i].vertical_alignment = WD_ALIGN_VERTICAL.CENTER
|
||
set_cell_border(cells[i])
|
||
if r % 2 == 1:
|
||
set_cell_shading(cells[i], "F3F7FC")
|
||
for p in cells[i].paragraphs:
|
||
p.alignment = WD_ALIGN_PARAGRAPH.LEFT if i == len(row) - 1 else WD_ALIGN_PARAGRAPH.CENTER
|
||
p.paragraph_format.space_after = Pt(0)
|
||
for run in p.runs:
|
||
set_run_font(run, size=8.5)
|
||
if widths:
|
||
for row in table.rows:
|
||
for idx, width in enumerate(widths):
|
||
row.cells[idx].width = Cm(width)
|
||
doc.add_paragraph().paragraph_format.space_after = Pt(2)
|
||
return table
|
||
|
||
|
||
# 修改人:Ld 修改时间:2026-09-29 09:58:57; 按业务用户阅读顺序组织 Word 手册章节和图文说明。
|
||
def build_docx():
|
||
OUT_DIR.mkdir(parents=True, exist_ok=True)
|
||
create_manual_images()
|
||
doc = Document()
|
||
section = doc.sections[0]
|
||
section.top_margin = Cm(2.0)
|
||
section.bottom_margin = Cm(1.8)
|
||
section.left_margin = Cm(2.0)
|
||
section.right_margin = Cm(2.0)
|
||
|
||
styles = doc.styles
|
||
for style_name in ["Normal", "Title", "Heading 1", "Heading 2", "Heading 3"]:
|
||
style = styles[style_name]
|
||
style.font.name = "Microsoft YaHei"
|
||
style._element.rPr.rFonts.set(qn("w:eastAsia"), "Microsoft YaHei")
|
||
style.font.color.rgb = RGBColor(0, 0, 0)
|
||
styles["Normal"].font.size = Pt(10.5)
|
||
|
||
title = doc.add_paragraph(style="Title")
|
||
title.alignment = WD_ALIGN_PARAGRAPH.CENTER
|
||
run = title.add_run("JY1.0 系统使用说明书")
|
||
set_run_font(run, size=24, bold=True, color="000000")
|
||
paragraph(doc, "适用对象:业务操作人员、仓库人员、车间人员、采购人员、销售人员、技术人员、系统管理员", size=11, align=WD_ALIGN_PARAGRAPH.CENTER, color="4B5563")
|
||
paragraph(doc, "版本日期:2026-09-29", size=10, align=WD_ALIGN_PARAGRAPH.CENTER, color="4B5563")
|
||
add_image(doc, ASSET_DIR / "02_workspace.png", "图 1 系统工作台与菜单结构示意", width=6.2)
|
||
|
||
paragraph(doc, "本文档用于指导用户完成 JY1.0 制造执行系统的日常操作。系统围绕订单、物料、BOM、采购、生产、装配、仓储、设备等业务数据进行管理,用户登录后根据角色权限进入对应菜单。阅读时可先掌握通用页面操作,再按照所在岗位查看对应模块说明。", size=10.5)
|
||
|
||
doc.add_page_break()
|
||
heading(doc, "目录", 1)
|
||
toc_items = [
|
||
"1 使用前准备",
|
||
"2 登录和首页",
|
||
"3 通用页面操作",
|
||
"4 业务流程总览",
|
||
"5 主要模块使用说明",
|
||
"6 仓储可视化与库房操作",
|
||
"7 移动端和现场扫码操作",
|
||
"8 常见问题处理",
|
||
"9 操作注意事项",
|
||
]
|
||
for item in toc_items:
|
||
paragraph(doc, item, size=10.5, space_after=3)
|
||
|
||
doc.add_page_break()
|
||
heading(doc, "1 使用前准备", 1)
|
||
paragraph(doc, "建议使用公司内网环境访问系统。首次使用前,请确认已取得账号、密码和岗位权限;如菜单为空或按钮不可见,应联系系统管理员检查角色、菜单和页面权限配置。")
|
||
add_table(
|
||
doc,
|
||
["准备项", "说明", "处理建议"],
|
||
[
|
||
["账号密码", "登录系统的基础凭据,由管理员分配。", "忘记密码或账号停用时联系管理员处理。"],
|
||
["浏览器", "系统为 Web 前端页面,适合在常用桌面浏览器访问。", "页面显示异常时可刷新或清理浏览器缓存。"],
|
||
["网络", "系统调用内网后端服务和数据库。", "无法登录或查询超时时,先确认网络和服务器连接。"],
|
||
["权限", "菜单、页面、按钮由角色权限控制。", "缺少功能时记录页面名称和所需操作后反馈管理员。"],
|
||
],
|
||
widths=[3.2, 6.0, 6.0],
|
||
)
|
||
|
||
heading(doc, "2 登录和首页", 1)
|
||
add_image(doc, ASSET_DIR / "01_login.png", "图 2 登录页面操作说明", width=6.2)
|
||
paragraph(doc, "在登录页面输入用户名和密码,点击登录进入系统。登录成功后,系统会加载用户信息、角色菜单和可访问页面。需要修改密码时,在登录框中进入修改密码窗口,填写旧密码和新密码后确认。")
|
||
paragraph(doc, "首页通常展示待办、通知或常用业务入口。左侧菜单用于切换模块,顶部面包屑用于确认当前位置,多标签页用于在多个页面之间快速切换。")
|
||
|
||
heading(doc, "3 通用页面操作", 1)
|
||
add_image(doc, ASSET_DIR / "03_table_query.png", "图 3 查询列表和按钮区域示意", width=6.4)
|
||
add_table(
|
||
doc,
|
||
["操作", "适用场景", "操作方法"],
|
||
[
|
||
["查询", "订单、物料、库存、任务、记录等列表。", "输入关键字、状态、日期等条件后点击查询。若结果过多,可缩小时间范围或增加编号条件。"],
|
||
["新增", "新增基础资料、业务单据或明细。", "点击新增,填写弹窗中的必填项,确认编号、名称、数量和日期后点击确定。"],
|
||
["编辑", "修正未审核或允许修改的数据。", "在列表中选择目标行,点击编辑,修改字段后保存。已审核或已流转数据通常不建议直接编辑。"],
|
||
["删除", "删除误录或无效数据。", "点击删除后阅读确认提示,再确认。删除前应确认该数据未被下游业务引用。"],
|
||
["导出", "需要离线核对、打印或统计。", "先查询出所需范围,再点击导出。导出前确认筛选条件,避免导出过大数据量。"],
|
||
["上传图片或附件", "物料图片、图纸、质检资料、异常照片。", "进入上传窗口选择文件,上传后回到列表或详情页确认附件显示正常。"],
|
||
],
|
||
widths=[2.2, 4.8, 8.2],
|
||
)
|
||
|
||
heading(doc, "4 业务流程总览", 1)
|
||
add_image(doc, ASSET_DIR / "04_business_flow.png", "图 4 订单到发货的典型业务流程", width=6.4)
|
||
paragraph(doc, "JY1.0 系统以订单和物料数据为主线。销售部门维护合同与订单,技术中心维护物料、BOM 和图纸确认,采购和制造中心处理采购、派工、加工和审核,仓储管理负责入库、出库、调拨、盘点和库存查询,装配管理负责领料、装配执行和任务跟踪,设备管理用于查看设备状态、点检和维修记录。")
|
||
|
||
heading(doc, "5 主要模块使用说明", 1)
|
||
module_rows = [
|
||
["基础数据", "人员、角色、菜单、页面权限、物料、工艺、班次、工厂日历、设备能力等。", "管理员和基础资料维护人员应先维护主数据,再开放业务操作。"],
|
||
["销售管理", "客户、合同、订单、报价、订单下达、发货、售后、订单追溯等。", "按合同和订单编号查询,提交前重点核对客户、数量、交期和收货信息。"],
|
||
["技术中心", "BOM导入维护、物料维护、图纸确认、零件改制、材料查询等。", "BOM和图纸确认会影响采购、生产和装配,应确保版本和物料编码一致。"],
|
||
["采购管理", "采购订单、供应商、到货通知、采购件查询、采购进度和移动端入库单生成。", "到货和入库相关页面需核对合同、物料、批次和数量。"],
|
||
["制造中心和精工车间", "生产计划、派工、工序、加工完成审核、工时统计、工价、质量信息等。", "派工和完工审核会影响生产进度与库存流转,现场人员应及时提交。"],
|
||
["装配管理", "装配任务接收、执行、查询、补货备货、领料和自检记录。", "装配执行时关注任务状态、暂停原因、领料明细和完成数量。"],
|
||
["仓储管理", "库存查询、入库、出库、退货、调拨、盘点、库位、补货、PDA扫码入库等。", "库存类操作必须核对物料编码、图号型号、批次、库位和数量。"],
|
||
["设备管理", "设备信息、实时状态、点检记录、维修记录、能耗、历史信息等。", "设备异常应及时记录原因和维修过程,便于后续追溯。"],
|
||
]
|
||
add_table(doc, ["模块", "主要功能", "使用要点"], module_rows, widths=[2.8, 7.2, 5.2])
|
||
|
||
heading(doc, "5.1 基础数据和权限管理", 2)
|
||
paragraph(doc, "基础数据是其他业务页面的前置条件。管理员应先维护人员、部门、角色、菜单和页面权限,再维护物料、工艺、班次、工厂日历和设备能力。权限调整后,用户通常需要重新登录才能看到最新菜单。")
|
||
paragraph(doc, "人员管理页面可维护部门、员工信息、照片和离职状态;菜单管理和页面权限管理用于控制用户能访问哪些模块和按钮。进行权限调整时,应优先按岗位配置角色,避免给单个用户反复做零散授权。")
|
||
|
||
heading(doc, "5.2 销售管理", 2)
|
||
paragraph(doc, "销售管理覆盖客户、报价、合同、订单、订单下达、订单进度、发货通知、发货记录、售后合同和订单追溯。常用操作是按合同编号、订单编号、客户名称或日期范围查询,再查看明细、提交订单或导出结果。")
|
||
paragraph(doc, "订单下达和发货类页面属于业务状态推进页面。提交前应确认订单编号、产品名称、数量、交期、收货人和关联补货来源,避免后续生产、仓储和发货环节出现错误。")
|
||
|
||
heading(doc, "5.3 技术中心", 2)
|
||
paragraph(doc, "技术中心用于维护物料、材料、BOM和图纸确认信息。导入BOM时应使用指定模板,导入后检查物料编码、图号、名称、数量和层级关系。图纸确认、零件改制等操作会影响后续采购和生产,提交前应核对原零件信息和改制目标。")
|
||
|
||
heading(doc, "5.4 采购管理", 2)
|
||
paragraph(doc, "采购管理用于供应商维护、采购订单、到货通知、采购件进度查询和移动端入库单生成。采购到货和入库相关操作应按合同或采购订单查询明细,选择待入库物料,确认数量、批次和库位后提交。")
|
||
|
||
heading(doc, "5.5 制造中心和精工车间", 2)
|
||
paragraph(doc, "制造中心和精工车间页面主要服务生产计划、派工、工序流转、加工完成审核、工时统计、工价维护和质量信息查询。车间用户应按任务状态处理,派工时确认剩余数量,完工时填写真实完成数量,审核人员按生产记录和质量结果确认是否通过。")
|
||
|
||
heading(doc, "5.6 装配管理", 2)
|
||
paragraph(doc, "装配管理围绕装配任务接收、装配执行、任务查询、备货补货和领料展开。执行装配时,先按订单或产品查询任务,查看领料明细和图纸资料,再按实际进度提交完成、暂停、自检或补货操作。")
|
||
|
||
heading(doc, "6 仓储可视化与库房操作", 1)
|
||
if (ASSET_DIR / "main.png").exists():
|
||
add_image(doc, ASSET_DIR / "main.png", "图 5 仓库可视化主界面示例", width=6.2)
|
||
if (ASSET_DIR / "filter.png").exists():
|
||
add_image(doc, ASSET_DIR / "filter.png", "图 6 仓库可视化筛选区域示例", width=6.2)
|
||
if (ASSET_DIR / "detail.png").exists():
|
||
add_image(doc, ASSET_DIR / "detail.png", "图 7 库位详情示例", width=6.2)
|
||
paragraph(doc, "仓储管理是 JY1.0 的核心模块之一。库存查询用于查看库存、需求数、可用库存、加工中、采购中、批次和出入库记录;库存盘点用于录入盘点库存并支持导入;库存调拨用于库位或仓库之间移动物料;入库、出库和退货页面用于记录库存增减。")
|
||
add_table(
|
||
doc,
|
||
["仓储操作", "关键字段", "注意事项"],
|
||
[
|
||
["入库", "物料编码、图号型号、数量、批次、库位、入库日期。", "入库前确认来源单据和实物一致,提交后检查库存是否更新。"],
|
||
["出库", "领料单、物料编码、数量、批次、领用人、用途。", "出库数量不得超过可用库存,涉及批次时按实际批次选择。"],
|
||
["调拨", "原库位、目标库位、物料、数量。", "确认目标库位可用,调拨后在库存查询中核对库位变化。"],
|
||
["盘点", "物料、账面库存、盘点库存、差异、备注。", "盘点导入前检查Excel列名,盘点差异应说明原因。"],
|
||
["补货", "最低库存、需求量、补货来源、关联订单。", "补货应关联正确合同或订单,避免影响订单成本和追溯。"],
|
||
],
|
||
widths=[2.6, 5.4, 7.2],
|
||
)
|
||
if (ASSET_DIR / "flow_inbound.png").exists():
|
||
add_image(doc, ASSET_DIR / "flow_inbound.png", "图 8 入库流程示意", width=5.8)
|
||
if (ASSET_DIR / "flow_outbound.png").exists():
|
||
add_image(doc, ASSET_DIR / "flow_outbound.png", "图 9 出库流程示意", width=5.8)
|
||
if (ASSET_DIR / "flow_count.png").exists():
|
||
add_image(doc, ASSET_DIR / "flow_count.png", "图 10 盘点流程示意", width=5.8)
|
||
|
||
heading(doc, "7 移动端和现场扫码操作", 1)
|
||
add_image(doc, ASSET_DIR / "05_mobile_pda.png", "图 11 PDA采购扫码入库移动端示意", width=4.8)
|
||
paragraph(doc, "移动端页面适合现场扫码、采购入库和车间派工等场景。操作时先扫描条码或输入单号,再核对系统带出的物料名称、图号型号、数量和库位。遇到扫码失败、数量不一致或物料不匹配时,不要强行提交,应返回重新扫描或联系对应业务人员确认。")
|
||
|
||
heading(doc, "8 常见问题处理", 1)
|
||
add_table(
|
||
doc,
|
||
["问题", "可能原因", "处理方法"],
|
||
[
|
||
["无法登录", "账号密码错误、账号停用、网络异常。", "重新输入账号密码;仍失败时联系管理员检查账号状态和服务器连接。"],
|
||
["菜单缺失", "用户角色未授权或权限未刷新。", "记录缺失菜单名称,联系管理员配置角色;配置后重新登录。"],
|
||
["查询无数据", "筛选条件过窄、日期范围不正确、数据未提交。", "清空部分条件重新查询,确认日期范围和业务状态。"],
|
||
["保存失败", "必填项为空、编号重复、数据状态不允许修改。", "按页面提示补全字段;检查编号、数量和状态;必要时联系管理员。"],
|
||
["导出较慢", "查询范围过大或明细数据较多。", "缩小日期范围,按订单、合同、物料等关键条件分批导出。"],
|
||
["图片或附件打不开", "文件未上传成功或路径配置异常。", "重新上传并刷新页面;仍异常时反馈文件名和页面路径。"],
|
||
],
|
||
widths=[3.2, 5.2, 6.8],
|
||
)
|
||
|
||
heading(doc, "9 操作注意事项", 1)
|
||
notes = [
|
||
"提交、审核、入库、出库、调拨、盘点等操作会改变业务数据,提交前必须核对编号、数量、日期、经办人和状态。",
|
||
"列表查询应优先使用编号、日期和状态等条件缩小范围,避免一次性查询过大数据量。",
|
||
"涉及订单、合同、补货来源和批次的数据,应保持上下游一致,避免影响追溯、库存和统计结果。",
|
||
"发现数据异常时,先截图或记录页面名称、查询条件、单据编号和异常现象,再反馈给管理员或开发人员。",
|
||
"多人同时操作同一业务时,应先刷新页面查看最新状态,避免重复提交或覆盖他人操作。",
|
||
]
|
||
for note in notes:
|
||
paragraph(doc, "• " + note, size=10.5)
|
||
|
||
doc.add_section(WD_SECTION.NEW_PAGE)
|
||
heading(doc, "附录 页面模块清单", 1)
|
||
add_table(
|
||
doc,
|
||
["一级模块", "常见页面或功能"],
|
||
[
|
||
["基础数据", "人员管理、角色维护、菜单管理、页面权限管理、物料维护、工艺维护、班次管理、工厂日历、设备能力设置。"],
|
||
["销售管理", "客户管理、报价、合同查询、订单管理、订单下达、订单进度、发货通知、发货记录、售后、订单追溯。"],
|
||
["技术中心", "BOM导入、BOM维护、BOM查询、物料查询、物料维护、图纸确认、零件改制。"],
|
||
["采购管理", "供应商、采购订单、采购件查询、采购进度、到货通知、移动端采购入库单。"],
|
||
["精工车间", "生产计划、车间派工、生产执行、任务查询、加工完成审核、工时统计、工序工价、质量信息。"],
|
||
["装配管理", "接收任务、装配执行、任务查询、备货补货、领料、自检记录。"],
|
||
["仓储管理", "库存查询、入库记录、出库单、出库明细、退货、盘点、调拨、库位、库房、可视化、PDA扫码入库。"],
|
||
["设备管理", "设备信息、设备状态、实时信息、点检、维修、能耗和历史记录。"],
|
||
],
|
||
widths=[3.2, 12.0],
|
||
)
|
||
|
||
paragraph(doc, "修改人:Ld 修改时间:2026-09-29 09:58:57;", size=10, align=WD_ALIGN_PARAGRAPH.RIGHT, color="4B5563")
|
||
doc.save(DOCX_PATH)
|
||
|
||
|
||
if __name__ == "__main__":
|
||
build_docx()
|
||
print(str(DOCX_PATH))
|