diff --git a/.deepcode/projects/D-Microsoft VS Code/05430cda-97de-4f23-a518-bd95e3640131.jsonl b/.deepcode/projects/D-Microsoft VS Code/05430cda-97de-4f23-a518-bd95e3640131.jsonl deleted file mode 100644 index 97ed19ab..00000000 --- a/.deepcode/projects/D-Microsoft VS Code/05430cda-97de-4f23-a518-bd95e3640131.jsonl +++ /dev/null @@ -1,3 +0,0 @@ -{"id":"fcc73de6-79ae-4779-80e8-b5d81d9f2ebe","sessionId":"05430cda-97de-4f23-a518-bd95e3640131","role":"system","content":"你是名叫Deep Code的交互式CLI工具,帮助用户完成软件工程任务。 Use the instructions below and the tools available to you to assist the user.\n\n重要:严禁编造任何非编程相关的 URL。对于编程链接,仅限使用:1) 用户提供的上下文;2) 你确定的官方文档主域名。在输出前,必须自查该链接是否存在于你的上下文记忆中;若不存在,请明确说明无法提供。\n\n# Available Tools\n\n## AskUserQuestion\n\nUse this tool when you need to ask the user questions during execution. This allows you to:\n1. Gather user preferences or requirements\n2. Clarify ambiguous instructions\n3. Get decisions on implementation choices as you work\n4. Offer choices to the user about what direction to take.\n\nUsage notes:\n- Users will always be able to select \"Other\" to provide custom text input\n- Use multiSelect: true to allow multiple answers to be selected for a question\n- If you recommend a specific option, make that the first option in the list and add \"(Recommended)\" at the end of the label\n\n## Bash\n\nExecutes a given bash command. Working directory persists between commands; shell state (everything else) does not. The shell environment is initialized from the user's profile (bash or zsh).\n\nOn Windows, Bash runs through Git Bash. Use POSIX commands and quote Windows paths carefully.\n\nIMPORTANT: This tool is for terminal operations like git, npm, docker, etc. DO NOT use it for file operations (reading, writing, editing, searching, finding files) - use the specialized tools for this instead.\n\nIMPORTANT: Before reaching for generic shell pipelines, prefer purpose-built CLI tools when they make the task more accurate, safer, faster, or easier to understand:\n- Use `ripgrep` (`rg`) when you need to search file contents by text or regex across the workspace; prefer it over slower tools like `grep`.\n- Use `jq` when you need to inspect, filter, or transform JSON output; prefer it over ad-hoc parsing with `sed`, `awk`, or Python one-liners.\n\nBefore executing the command, please follow these steps:\n\n1. Directory Verification:\n - If the command will create new directories or files, first use `ls` to verify the parent directory exists and is the correct location\n - For example, before running \"mkdir foo/bar\", first use `ls foo` to check that \"foo\" exists and is the intended parent directory\n\n2. Command Execution:\n - Always quote file paths that contain spaces with double quotes (e.g., cd \"path with spaces/file.txt\")\n - Examples of proper quoting:\n - cd \"/Users/name/My Documents\" (correct)\n - cd /Users/name/My Documents (incorrect - will fail)\n - python \"/path/with spaces/script.py\" (correct)\n - python /path/with spaces/script.py (incorrect - will fail)\n - After ensuring proper quoting, execute the command.\n - Capture the output of the command.\n\nUsage notes:\n - The command argument is required.\n - It is very helpful if you write a clear, concise description of what this command does. For simple commands, keep it brief (5-10 words). For complex commands (piped commands, obscure flags, or anything hard to understand at a glance), add enough context to clarify what it does.\n - If the output exceeds 30000 characters, output will be truncated before being returned to you.\n - Always prefer using the dedicated tools for these commands:\n - Read files: Use Read (NOT cat/head/tail)\n - Edit files: Use Edit (NOT sed/awk)\n - Write files: Use Write (NOT echo >/cat <\n pytest /foo/bar/tests\n \n \n cd /foo/bar && pytest tests\n \n\n```json\n{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"type\": \"object\",\n \"properties\": {\n \"command\": {\n \"description\": \"The command to execute\",\n \"type\": \"string\"\n },\n \"description\": {\n \"description\": \"Clear, concise description of what this command does in active voice. Never use words like \\\"complex\\\" or \\\"risk\\\" in the description - just describe what it does.\\n\\nFor simple commands (git, npm, standard CLI tools), keep it brief (5-10 words):\\n- ls → \\\"List files in current directory\\\"\\n- git status → \\\"Show working tree status\\\"\\n- npm install → \\\"Install package dependencies\\\"\\n\\nFor commands that are harder to parse at a glance (piped commands, obscure flags, etc.), add enough context to clarify what it does:\\n- find . -name \\\"*.tmp\\\" -exec rm {} \\\\; → \\\"Find and delete all .tmp files recursively\\\"\\n- git reset --hard origin/main → \\\"Discard all local changes and match remote main\\\"\\n- curl -s url | jq '.data[]' → \\\"Fetch JSON from URL and extract data array elements\\\"\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"command\"\n ],\n \"additionalProperties\": false\n}\n```\n\n## Edit\n\nPerforms scoped string replacements in files.\n\nUsage:\n- You must use your `Read` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file. \n- If your prior Read only covered part of the file, use the returned `snippet_id` to scope the edit, or read the full file before editing without a snippet.\n- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string.\n- Prefer passing `snippet_id` from a prior Read response when you want to limit the replacement to a known range.\n- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.\n- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.\n- If `old_string` is not unique, the tool returns candidate matches with line ranges, previews, and snippet ids that you can reuse in a follow-up edit.\n- If `old_string` is not found, the tool returns the closest likely match in metadata, including a preview. If the only difference is escaping and there is a unique loose-escape match, the tool may use the configured model to correct `old_string` and `new_string` before retrying.\n- `replace_all` has safety checks. For broad or short-fragment replacements, provide `expected_occurrences` so the tool can verify the exact number of matches before editing.\n\n```json\n{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"type\": \"object\",\n \"properties\": {\n \"file_path\": {\n \"description\": \"The absolute path to the file to modify (must be absolute, not relative). Optional when snippet_id is provided.\",\n \"type\": \"string\"\n },\n \"snippet_id\": {\n \"description\": \"Snippet id returned by Read or a prior Edit error response. Limits the search range to that snippet.\",\n \"type\": \"string\"\n },\n \"old_string\": {\n \"description\": \"The text to replace within the file or snippet scope\",\n \"type\": \"string\"\n },\n \"new_string\": {\n \"description\": \"The text to replace it with (must be different from old_string)\",\n \"type\": \"string\"\n },\n \"replace_all\": {\n \"description\": \"Replace all occurences of old_string (default false)\",\n \"default\": false,\n \"type\": \"boolean\"\n },\n \"expected_occurrences\": {\n \"description\": \"Expected number of matches. Useful as a guardrail for replace_all.\",\n \"type\": \"number\"\n }\n },\n \"required\": [\n \"old_string\",\n \"new_string\"\n ],\n \"additionalProperties\": false\n}\n```\n\n## Read\n\nReads a file from the local filesystem. You can access any file directly by using this tool.\nAssume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.\n\nUsage:\n- The file_path parameter must be a UNIX-style file path.\n- By default, it reads up to 2000 lines starting from the beginning of the file\n- You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters\n- Any lines longer than 2000 characters will be truncated\n- Results are returned using cat -n format, with line numbers starting at 1\n- Text reads return a snippet id in metadata. You can pass that snippet id to the Edit tool to constrain replacements to just that read range.\n- This tool can inspect image files, but the current model is not multimodal, so image reads are not presented visually to the model.\n- This tool can read PDF files (.pdf). For large PDFs (more than 10 pages), you MUST provide the pages parameter to read specific page ranges (e.g., pages: \"1-5\"). Reading a large PDF without the pages parameter will fail. Maximum 20 pages per request.\n- This tool can read Jupyter notebooks (.ipynb files) and returns all cells with their outputs, combining code, text, and visualizations.\n- This tool can only read files, not directories. To read a directory, use an ls command via the Bash tool.\n- You can call multiple tools in a single response. It is always better to speculatively read multiple potentially useful files in parallel.\n- You will regularly be asked to read screenshots. If the user provides a path to a screenshot, ALWAYS use this tool to view the file at the path. This tool will work with all temporary file paths.\n- If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.\n\n```json\n{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"type\": \"object\",\n \"properties\": {\n \"file_path\": {\n \"description\": \"The absolute path to the file to read\",\n \"type\": \"string\"\n },\n \"offset\": {\n \"description\": \"The line number to start reading from. Only provide if the file is too large to read at once\",\n \"type\": \"number\"\n },\n \"limit\": {\n \"description\": \"The number of lines to read. Only provide if the file is too large to read at once.\",\n \"type\": \"number\"\n },\n \"pages\": {\n \"description\": \"Page range for PDF files (e.g., \\\"1-5\\\", \\\"3\\\", \\\"10-20\\\"). Only applicable to PDF files. Maximum 20 pages per request.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"file_path\"\n ],\n \"additionalProperties\": false\n}\n```\n\n## WebSearch\n\nUse this tool when you need up-to-date web information before writing code, changing dependencies, or citing external guidance.\n\nJSON schema:\n\n```json\n{\n \"type\": \"object\",\n \"properties\": {\n \"query\": {\n \"type\": \"string\",\n \"description\": \"A search query phrased as a clear, specific natural language question or statement that includes key context.\"\n }\n },\n \"required\": [\"query\"],\n \"additionalProperties\": false\n}\n```\n\nUsage:\n- Do not reduce `query` to space-separated keywords.\n\nTypical use cases:\n- Confirm recent SDK, framework, or API changes\n- Check current compatibility, deprecations, or migration notes\n- Look up active issue tracker discussions or recent regressions\n- Gather cited sources before producing technical guidance\n\n## Write\n\nWrites a file to the local filesystem.\n\nUsage:\n- This tool will overwrite the existing file if there is one at the provided path.\n- If this is an existing file, you MUST read the full file first. A partial read is not enough for overwriting an existing file.\n- `content` must be a single string. If you are writing JSON, serialize the full document to text before calling this tool.\n- Prefer `Edit` for updating existing files. Use `Write` for new files or intentional full-file rewrites.\n- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.\n- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.\n- NEVER proactively create one-off test script. Only create one-off test script files if explicitly requested by the User.\n- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.\n\n```json\n{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"type\": \"object\",\n \"properties\": {\n \"file_path\": {\n \"description\": \"The absolute path to the file to write (must be absolute, not relative)\",\n \"type\": \"string\"\n },\n \"content\": {\n \"description\": \"The complete file content as a string\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"file_path\",\n \"content\"\n ],\n \"additionalProperties\": false\n}\n```\n\n今天是2026年5月20日。随着对话的进行,时间在流逝。\n\n# Local Workspace Environment\n\n```json\n{\n \"root path\": \"D:\\\\Microsoft VS Code\",\n \"pwd\": \"D:\\\\Microsoft VS Code\",\n \"homedir\": \"C:\\\\Users\\\\Administrator\",\n \"system info\": \"Windows_NT 10.0.19045 x64\",\n \"shell path\": \"Deep Code on Windows requires Git Bash. Install Git for Windows, or ensure Git's bash.exe is available in PATH.\",\n \"shell mode\": \"git-bash\",\n \"command installed\": {\n \"ripgrep\": false,\n \"jq\": false\n }\n}\n```","contentParams":null,"messageParams":null,"compacted":false,"visible":false,"createTime":"2026-05-20T00:37:13.608Z","updateTime":"2026-05-20T00:37:13.608Z"} -{"id":"39073354-e1f4-4646-b8f6-bc55a882891c","sessionId":"05430cda-97de-4f23-a518-bd95e3640131","role":"system","content":"Use the skill document below to assist the user:\n\n---\nname: agent-drift-guard\ndescription: Detect and correct execution drift while working on user requests. Use when you are actively implementing, debugging, reviewing, or investigating and there is a risk of wandering beyond the user's goal, adding unrequested work, touching live systems, over-exploring, or ignoring repeated user boundary corrections. Especially useful during multi-step coding tasks, production-adjacent requests, ambiguous scopes, and anytime you should self-check whether it is still solving the requested problem.\n---\n\n# Agent Drift Guard\n\nKeep execution tightly aligned with the user's actual request.\n\n## Quick Start\n\nRun this mental check before substantial work and again whenever the plan expands:\n\n1. State the user's requested outcome in one sentence.\n2. List explicit non-goals or boundaries the user has set.\n3. Ask whether the next action directly advances the requested outcome.\n4. If not, either cut it or pause to confirm.\n\n## Drift Signals\n\nTreat these as warning signs that execution may be drifting:\n\n- Exploring broadly before opening the most relevant file, command, or artifact.\n- Solving adjacent operational issues when the user asked only for code changes.\n- Adding extra safeguards, scripts, docs, refactors, or cleanup that the user did not ask for.\n- Reframing the task around what seems \"better\" instead of what was requested.\n- Continuing with a broader plan after the user narrows the scope.\n- Repeating searches or tool calls without increasing certainty.\n- Mixing diagnosis, remediation, and feature work when the user asked for only one of them.\n- Touching production-like state, external systems, or live data without explicit permission.\n\n## Severity Levels\n\n### Level 1: Mild Drift\n\nExamples:\n- One or two extra exploratory commands.\n- Considering a broader solution but not acting on it yet.\n- Briefly over-explaining instead of moving the task forward.\n\nResponse:\n- Auto-correct silently.\n- Narrow to the smallest next action.\n- Do not interrupt the user.\n\n### Level 2: Material Drift\n\nExamples:\n- Planning additional deliverables not requested.\n- Writing helper scripts, migrations, docs, or tests outside the asked scope.\n- Expanding from code changes into operational fixes.\n- Continuing after the user has already corrected the scope once.\n\nResponse:\n- Stop and realign internally first.\n- If the broader action is avoidable, drop it and continue on scope.\n- If the broader action has non-obvious tradeoffs, ask a brief confirmation question.\n\n### Level 3: Boundary or Risk Violation\n\nExamples:\n- Modifying live systems, production data, external services, or user-owned state without being asked.\n- Taking destructive or hard-to-reverse actions outside the requested scope.\n- Ignoring repeated user instructions about what not to do.\n\nResponse:\n- Pause before acting.\n- Surface the exact boundary and ask for confirmation.\n- Offer the smallest on-scope option first.\n\n## Self-Check Loop\n\nUse this loop during execution:\n\n### Before the first meaningful action\n\nWrite down mentally:\n- Requested outcome\n- Allowed scope\n- Forbidden scope\n- Smallest useful next step\n\n### After each non-trivial step\n\nAsk:\n- Did this step directly help deliver the requested outcome?\n- Did I learn something that changes scope, or only implementation?\n- Am I about to do more than the user asked?\n\n### After a user correction\n\nTreat the correction as a hard boundary update.\n\nThen:\n- Remove the old broader plan.\n- Do not defend the discarded work.\n- Continue from the narrowed scope.\n- If needed, acknowledge briefly and move on.\n\n## Decision Rules\n\nUse these rules in order:\n\n1. Prefer the most direct artifact first.\n - Open the relevant file before scanning the whole repo.\n - Inspect the specific failing path before designing a general framework.\n\n2. Prefer the smallest complete fix.\n - Solve the asked problem before improving related systems.\n - Avoid bonus work unless it is required for correctness.\n\n3. Prefer internal correction over user interruption.\n - If you can shrink back to scope confidently, do it.\n - Ask only when the next step changes deliverables, risk, or ownership.\n\n4. Treat repeated user constraints as priority signals.\n - A repeated instruction means your execution style is currently misaligned.\n - Tighten scope immediately.\n\n5. Separate categories of work.\n - Code change, investigation, production remediation, cleanup, and documentation are distinct tasks unless the user explicitly combines them.\n\n## Good Intervention Style\n\nWhen you must pause, keep it short and specific:\n\n- State the potential drift in one sentence.\n- Name the tradeoff or boundary.\n- Offer the smallest on-scope option first.\n\nExample:\n\n\"Quick alignment check: I can keep this to the code fix only, or also add an ops cleanup step. I'll stick to the code fix unless you want both.\"\n\n## Anti-Patterns\n\nDo not:\n\n- Create cleanup scripts, docs, or side tools just because they seem useful.\n- Broaden the task after discovering a neighboring problem.\n- Continue with a plan the user has already rejected.\n- Justify drift with \"best practice\" when the user asked for a narrower deliverable.\n- Hide extra work inside a larger patch.\n\n## Final Check Before Responding\n\nBefore sending the final answer, verify:\n\n- The delivered work matches the requested outcome.\n- No extra deliverables were added without confirmation.\n- Any assumptions are stated briefly.\n- Suggested next steps are optional, not bundled into the completed work.\n","contentParams":null,"messageParams":null,"compacted":false,"visible":false,"createTime":"2026-05-20T00:37:13.609Z","updateTime":"2026-05-20T00:37:13.609Z"} -{"id":"ba28351e-35cc-4e3d-b342-115b1af97ed5","sessionId":"05430cda-97de-4f23-a518-bd95e3640131","role":"user","content":"1","contentParams":null,"messageParams":null,"compacted":false,"visible":true,"createTime":"2026-05-20T00:37:13.609Z","updateTime":"2026-05-20T00:37:13.609Z"} diff --git a/.deepcode/projects/D-Microsoft VS Code/sessions-index.json b/.deepcode/projects/D-Microsoft VS Code/sessions-index.json deleted file mode 100644 index 2602dcdd..00000000 --- a/.deepcode/projects/D-Microsoft VS Code/sessions-index.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": 1, - "entries": [ - { - "id": "05430cda-97de-4f23-a518-bd95e3640131", - "summary": "1", - "assistantReply": null, - "assistantThinking": null, - "assistantRefusal": null, - "toolCalls": null, - "status": "failed", - "failReason": "OpenAI API key not found", - "usage": null, - "activeTokens": 0, - "createTime": "2026-05-20T00:37:12.043Z", - "updateTime": "2026-05-20T00:37:13.611Z", - "processes": null - } - ], - "originalPath": "D:\\Microsoft VS Code" -} \ No newline at end of file diff --git a/.deepcode/settings.json b/.deepcode/settings.json deleted file mode 100644 index bc205210..00000000 --- a/.deepcode/settings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "env": { - "MODEL": "deepseek-v4-pro", // 你也可以换成 deepseek-v4-flash,后者响应更快 - "BASE_URL": "https://api.deepseek.com", - "API_KEY": "sk-29bb79324c604ff79cb9c6108ef6e2ba" - }, - "thinkingEnabled": true, // 开启深度思考模式,让AI的回答更周全 - "reasoningEffort": "max" // 控制推理强度,可选 high 或 max -} \ No newline at end of file diff --git a/dist(26-05-21PLM上线).zip b/dist(26-05-21PLM上线).zip new file mode 100644 index 00000000..e6728ab9 Binary files /dev/null and b/dist(26-05-21PLM上线).zip differ diff --git a/dist.7z b/dist.7z index d112c3f5..2297dde7 100644 Binary files a/dist.7z and b/dist.7z differ diff --git a/dist.zip b/dist.zip index ff28d6b9..9ac9f36b 100644 Binary files a/dist.zip and b/dist.zip differ diff --git a/src/views/WarehouseManagement/PurchasePartsStorage/index.vue b/src/views/WarehouseManagement/PurchasePartsStorage/index.vue index 17732f46..5325545e 100644 --- a/src/views/WarehouseManagement/PurchasePartsStorage/index.vue +++ b/src/views/WarehouseManagement/PurchasePartsStorage/index.vue @@ -1202,7 +1202,7 @@ export default { return } materialGroup[i] = this.multipleSelection_variable2[i].物料流水号 - numberGroup[i] = this.multipleSelection_variable2[i].等待入库数量 + numberGroup[i] = this.multipleSelection_variable2[i].本次入库 processGroup[i] = this.multipleSelection_variable2[i].工艺计划流水号 typeGroup[i] = this.multipleSelection_variable2[i].类型 locateGroup[i] = this.multipleSelection_variable2[i].货位流水号 diff --git a/今日计划.md b/今日计划.md index 4b5c5ba3..d8c19432 100644 --- a/今日计划.md +++ b/今日计划.md @@ -1,148 +1,208 @@ -# 今日工作计划与部署文档 +## **一、基本信息** -## 1. 工作概述 +- **项目技术栈**:Vue2(前端) + SQL Server(数据库/存储过程) +- **开发日期**:2026-05-22 +- **开发人员**:\[填写姓名] +- **任务总数**:2 -本文档记录了今日开发与运维任务,包括PLM数据上传、采购到货入库单生成逻辑、生产计划功能更新及生产环境部署。重点涉及数据库表结构变更、存储过程更新及上线后的Bug跟踪。 +*** -## 2. 任务清单 +## **二、任务一:存储过程 – 采购单历史价格曲线图数据** -| 序号 | 任务名称 | 状态 | 优先级 | 预计耗时 | 负责人 | -| -- | -------------- | ---- | --- | ---- | --- | -| 1 | PLM文档上传 | 进行中 | 高 | 1.5h | 开发组 | -| 2 | 采购到货生成入库单 | 待开始 | 高 | 2h | 开发组 | -| 3 | 生产计划功能更新(含数据库) | 待开始 | 高 | 2.5h | 开发组 | -| 4 | 生产环境部署 | 待开始 | 紧急 | 1h | 运维组 | -| 5 | 上线后Bug监控与修复 | 持续执行 | 高 | 持续 | 全体 | +### **2.1 需求描述** -## 3. 详细任务说明 +编写/修改一个存储过程,统计指定采购单(或指定物料)的历史采购价格,返回用于前端绘制曲线图的数据结构(时间 + 价格)。 -### 3.1 PLM文档上传 +### **2.2 技术目标** -- **目标**:将PLM系统中的设计文档、BOM表等同步至生产系统。 -- **操作**: - - 使用PLM接口批量拉取最新文档。 - - 校验文档完整性并存储至文件服务器。 - - 更新文档索引至数据库`plm_docs`表。 -- **验证标准**:上传成功率≥99%,文档可预览。 +- 输入参数:`@MaterialID`(物料ID) 或 `@PurchaseOrderID`(采购单号) +- 输出数据集:`HistoryDate`(日期)、`UnitPrice`(单价) +- 按时间升序排列 -### 3.2 采购到货生成入库单 - -- **业务逻辑**:根据采购订单的到货通知单,自动生成仓库入库单。 -- **操作**: - - 读取采购到货记录表`purchase_arrival`。 - - 校验数量、批次号、质检状态。 - - 调用存储过程`sp_generate_inbound_order`生成入库单。 -- **数据库变更**:无新增表,但需验证触发器`trg_after_arrival`是否正常。 - -### 3.3 生产计划功能更新(含数据库变更) - -此任务包含应用程序代码更新及数据库结构/存储过程变更,需按顺序执行。 - -#### 3.3.1 数据库变更脚本 - -**表结构变更**: - -```sql --- 添加字段用于计划优先级 -ALTER TABLE production_plan ADD priority_level TINYINT DEFAULT 3 CHECK (priority_level BETWEEN 1 AND 5); - --- 新增索引以提高查询效率 -CREATE INDEX idx_plan_status_priority ON production_plan(plan_status, priority_level); - --- 增加历史日志表 -CREATE TABLE production_plan_log ( - log_id INT PRIMARY KEY IDENTITY(1,1), - plan_id INT NOT NULL, - action_type VARCHAR(20), - change_time DATETIME DEFAULT GETDATE() -); -``` - -**存储过程更新**: +### **2.3 存储过程实现(SQL Server)** sql ``` --- 更新生产计划状态存储过程,增加优先级处理 -CREATE OR ALTER PROCEDURE sp_update_plan_status - @plan_id INT, - @new_status VARCHAR(20) +CREATE OR ALTER PROC usp_GetPurchasePriceHistory + @MaterialID INT AS BEGIN - BEGIN TRY - BEGIN TRANSACTION; - - UPDATE production_plan - SET plan_status = @new_status, - last_modified = GETDATE() - WHERE plan_id = @plan_id; - - -- 记录日志 - INSERT INTO production_plan_log (plan_id, action_type) - VALUES (@plan_id, 'STATUS_CHANGE_TO_' + @new_status); - - COMMIT TRANSACTION; - END TRY - BEGIN CATCH - ROLLBACK; - THROW; - END CATCH -END; + SET NOCOUNT ON; + SELECT + CONVERT(DATE, po.OrderDate) AS HistoryDate, + pod.UnitPrice + FROM PurchaseOrderDetail pod + INNER JOIN PurchaseOrder po ON pod.PurchaseOrderID = po.PurchaseOrderID + WHERE pod.MaterialID = @MaterialID + AND pod.UnitPrice IS NOT NULL + AND po.OrderDate IS NOT NULL + GROUP BY CONVERT(DATE, po.OrderDate), pod.UnitPrice + ORDER BY HistoryDate ASC; +END ``` -**执行顺序**: +### **2.4 前端调用示例(Vue2 + axios)** -1. 备份现有数据库(生产计划相关表)。 -2. 执行`ALTER TABLE`语句。 -3. 执行`CREATE TABLE`语句。 -4. 执行`CREATE OR ALTER PROCEDURE`语句。 -5. 验证索引创建。 +javascript -#### **3.3.2 应用程序更新** +``` +// API 服务层 +getPriceHistory(materialId) { + return axios.post('/api/getPriceHistory', { materialId }); +} -- 生产计划列表页增加“优先级”筛选和排序。 -- 计划详情页支持修改优先级(权限控制)。 -- 调用`sp_update_plan_status`替代原有直接UPDATE语句。 +// 组件中使用 +async loadChartData() { + const res = await getPriceHistory(this.selectedMaterialId); + const chartData = { + dates: res.data.map(item => item.HistoryDate), + prices: res.data.map(item => item.UnitPrice) + }; + this.renderLineChart(chartData); +} +``` -### **3.4 生产环境部署** +### **2.5 曲线图组件建议** -**部署步骤**: +- 使用 `echarts` 或 `chart.js` +- X轴:日期,Y轴:单价 -1. 停止生产计划相关服务。 -2. 备份当前生产数据库和生产计划模块代码。 -3. 执行数据库变更脚本(见3.3.1)。 -4. 部署新的后端API和前端页面。 -5. 启动服务,执行冒烟测试(创建计划、变更状态、优先级过滤)。 -6. 通知业务部门恢复使用。 +*** -**回滚计划**: +## **三、任务二:员工组件 – 必填项改为选填项 + 存储过程修改** -- 若部署后30分钟内出现严重错误,执行数据库回滚脚本(恢复备份表及存储过程),并回退至上一版本代码。 +### **3.1 需求描述** -### **3.5 上线后Bug监控与修复** +员工信息组件中原有字段(如:手机号、备用邮箱等)为必填,现改为**选填**,并修改对应的**存储过程**以兼容空值写入/更新。 -- **监控指标**: - - 生产计划保存接口错误率 > 5% - - 入库单生成超时 > 3秒 - - PLM上传失败率 > 1% -- **响应机制**: - - 普通Bug:2小时内修复,记录至JIRA。 - - 严重Bug(导致数据错误或流程中断):立即回滚相关变更,事后分析。 +### **3.2 前端修改(Vue2)** -## **4. 注意事项** +#### **3.2.1 表单校验规则调整** -- 所有数据库变更是不可逆的,务必提前全量备份。 -- 生产计划优先级字段`priority_level`默认值为3,需通知前端做UI提示。 -- 存储过程更新后,需同步更新ORM实体映射(如有)。 -- 采购入库单生成依赖质检结果,若存在未质检记录,系统应跳过并记录错误日志。 +javascript -## **5. 验收与完成标准** +``` +// 原 rules +rules: { + phone: [{ required: true, message: '请填写手机号' }], + email: [{ required: true, message: '请填写邮箱' }] +} -- PLM上传完成,文件可访问。 -- 成功根据3笔以上到货数据生成入库单。 -- 生产计划数据库变更执行成功,索引有效。 -- 生产计划前端能正确展示并修改优先级。 -- 上线后2小时无P0/P1级Bug。 +// 改为选填(删除 required 或设为 false) +rules: { + phone: [{ required: false, message: '请填写手机号' }], + email: [{ required: false, message: '请填写邮箱' }] +} +``` -
+#### **3.2.2 必填标识(星号)移除** + +vue + +``` + + + +``` + +### **3.3 后端存储过程修改(SQL Server)** + +#### **3.3.1 原存储过程(假设示例)** + +sql + +``` +CREATE PROC usp_InsertEmployee + @Name NVARCHAR(50), + @Phone VARCHAR(20), + @Email VARCHAR(100) +AS +BEGIN + INSERT INTO Employee (Name, Phone, Email) + VALUES (@Name, @Phone, @Email); +END +``` + +#### **3.3.2 修改后(支持选填字段)** + +sql + +``` +ALTER PROC usp_InsertEmployee + @Name NVARCHAR(50), + @Phone VARCHAR(20) = NULL, -- 允许为空 + @Email VARCHAR(100) = NULL -- 允许为空 +AS +BEGIN + INSERT INTO Employee (Name, Phone, Email) + VALUES (@Name, @Phone, @Email); +END +``` + +> 注:`ALTER PROC` 需确认参数名、顺序与原存储过程一致。 + +### **3.4 数据库表字段允许 NULL** + +确保 `Phone`、`Email` 字段已设置为 `NULL`(若此前为 `NOT NULL` 需执行改表语句): + +sql + +``` +ALTER TABLE Employee ALTER COLUMN Phone VARCHAR(20) NULL; +ALTER TABLE Employee ALTER COLUMN Email VARCHAR(100) NULL; +``` + +*** + +## **四、测试要点** + +**任务** + +**测试项** + +**预期结果** + +曲线图 + +输入有效物料ID + +返回正确的时间-价格序列 + +曲线图 + +输入无历史价格的物料 + +返回空数据集,前端提示无数据 + +员工组件 + +手机号、邮箱不填写提交 + +可成功提交,数据库对应字段为 NULL + +员工组件 + +原有必填逻辑(如姓名) + +仍保持必填 + +*** + +## **五、部署与回滚注意事项** + +- **存储过程**:先备份原存储过程(`DROP` 前先 `CREATE` 备份脚本) +- **前端**:仅移除校验规则,不涉及路由或组件结构大改 +- **数据库字段**:`ALTER COLUMN NULL` 操作不可逆,建议先在测试库执行 + +*** + +## **六、完成确认(Checklist)** + +- 存储过程 `usp_GetPurchasePriceHistory` 已创建/修改并通过测试 +- 前端曲线图可正常展示历史价格 +- 员工组件校验规则已改为选填 +- 员工组件对应存储过程已支持 `NULL` +- 数据库字段已允许 `NULL` +- 提交代码并备注今日工作计划完成 diff --git a/生产计划SQL开发文档.md b/生产计划SQL开发文档.md deleted file mode 100644 index 51733573..00000000 --- a/生产计划SQL开发文档.md +++ /dev/null @@ -1,243 +0,0 @@ -# **车间生产管理SQL开发 - 逐步构建生产计划视图与存储过程** - -## **1. 原始需求与基础查询** - -**目标**:从多个关联表中查询生产数据,并逐步添加计算字段。 - -### **1.1 基础数据源** - -涉及三张核心表和视图: - -- `车间生产管理_零件工序_视图`:包含订单号、产品名称、零件名称、工序、数量等。 -- `车间生产管理工艺_零件工序_任务分配`:包含工序流水号、计划数量、加工数量、计划日期等。 -- `基础数据_设备工位点检表`:包含设备流水号、工位号、设备名称。 - -### **1.2 初始联接查询** - -通过 `工序流水号` 和 `设备流水号` 联接上述三张表。 - -sql - -``` -SELECT dbo.车间生产管理_零件工序_视图.订单号, - dbo.车间生产管理_零件工序_视图.产品名称, - -- ... 其他字段 - dbo.基础数据_设备工位点检表.工位号 + N':' + dbo.基础数据_设备工位点检表.设备名称 AS 设备, - dbo.车间生产管理_零件工序_视图.数量 AS 订单数, - dbo.车间生产管理工艺_零件工序_任务分配.数量 AS 计划数 - -- ... 其他字段 -FROM dbo.车间生产管理工艺_零件工序_任务分配 -INNER JOIN dbo.车间生产管理_零件工序_视图 ON dbo.车间生产管理工艺_零件工序_任务分配.工序流水号 = dbo.车间生产管理_零件工序_视图.工序流水号 -INNER JOIN dbo.基础数据_设备工位点检表 ON dbo.车间生产管理工艺_零件工序_任务分配.设备流水号 = dbo.基础数据_设备工位点检表.设备流水号 -``` - -## **2. 逐步新增计算字段** - -在基础查询上,根据业务需求分步添加了三个计算字段。 - -### **2.1 新增 `状态` 字段** - -**需求**:根据加工数量与计划数量的对比,判断订单状态为“派工中”、“生产中”或“已完成”。 - -**逻辑**: - -- **已完成**:加工数量 >= 计划数量 -- **生产中**:0 < 加工数量 < 计划数量 -- **派工中**:加工数量 = 0 或 NULL - -**SQL 片段**: - -sql - -``` -CASE - WHEN ISNULL(dbo.车间生产管理工艺_零件工序_任务分配.加工数量, 0) >= dbo.车间生产管理工艺_零件工序_任务分配.数量 - THEN '已完成' - WHEN ISNULL(dbo.车间生产管理工艺_零件工序_任务分配.加工数量, 0) > 0 - AND ISNULL(dbo.车间生产管理工艺_零件工序_任务分配.加工数量, 0) < dbo.车间生产管理工艺_零件工序_任务分配.数量 - THEN '生产中' - ELSE '派工中' -END AS 状态 -``` - -### **2.2 新增 `完成率` 字段** - -**需求**:计算完成率 = (加工数量 / 计划数量) × 100%。 - -**SQL 片段**: - -sql - -``` -CASE - WHEN ISNULL(dbo.车间生产管理工艺_零件工序_任务分配.数量, 0) = 0 THEN '0%' - ELSE CAST(ROUND(ISNULL(dbo.车间生产管理工艺_零件工序_任务分配.加工数量, 0) * 100.0 / - dbo.车间生产管理工艺_零件工序_任务分配.数量, 2) AS DECIMAL(10, 2)) + '%' -END AS 完成率 -``` - -### **2.3 新增 `投产时间` 字段** - -**需求**:从 `车间生产管理工艺_零件工艺计划` 表获取 `分配日期`,作为投产时间。 - -**实现**:需要 `LEFT JOIN` 新表,通过 `工艺计划流水号` 关联。 - -sql - -``` --- 新增的 JOIN -LEFT OUTER JOIN dbo.车间生产管理工艺_零件工艺计划 - ON dbo.车间生产管理_零件工序_视图.工艺计划流水号 = dbo.车间生产管理工艺_零件工艺计划.工艺计划流水号 - --- 新增字段 -CONVERT(varchar(10), dbo.车间生产管理工艺_零件工艺计划.分配日期, 23) AS 投产时间 -``` - -## **3. 创建生产计划视图 (`车间生产管理_生产计划_视图_新`)** - -将上述所有逻辑整合,创建了一个名为 `车间生产管理_生产计划_视图_新` 的视图。 - -sql - -``` -CREATE VIEW dbo.车间生产管理_生产计划_视图_新 AS -SELECT dbo.车间生产管理_零件工序_视图.订单号, - dbo.车间生产管理_零件工序_视图.产品名称, - dbo.车间生产管理_零件工序_视图.零件名称, - dbo.车间生产管理_零件工序_视图.工序, - dbo.基础数据_设备工位点检表.工位号 + N':' + dbo.基础数据_设备工位点检表.设备名称 AS 设备, - dbo.车间生产管理_零件工序_视图.数量 AS 订单数, - dbo.车间生产管理工艺_零件工序_任务分配.数量 AS 计划数, - CONVERT(varchar(10), dbo.车间生产管理工艺_零件工序_任务分配.计划完成日期, 23) AS 计划完成日期, - dbo.车间生产管理工艺_零件工序_任务分配.数量 - dbo.车间生产管理工艺_零件工序_任务分配.加工数量 AS 剩余数, - dbo.车间生产管理_零件工序_视图.零件图号, - dbo.车间生产管理_零件工序_视图.工序顺序, - CONVERT(varchar(10), dbo.车间生产管理工艺_零件工序_任务分配.计划开始日期, 23) AS 计划开始日期, - dbo.基础数据_设备工位点检表.设备名称, - -- 状态字段 - CASE - WHEN ISNULL(dbo.车间生产管理工艺_零件工序_任务分配.加工数量, 0) >= dbo.车间生产管理工艺_零件工序_任务分配.数量 - THEN '已完成' - WHEN ISNULL(dbo.车间生产管理工艺_零件工序_任务分配.加工数量, 0) > 0 - AND ISNULL(dbo.车间生产管理工艺_零件工序_任务分配.加工数量, 0) < dbo.车间生产管理工艺_零件工序_任务分配.数量 - THEN '生产中' - ELSE '派工中' - END AS 状态, - -- 完成率字段 - CASE - WHEN ISNULL(dbo.车间生产管理工艺_零件工序_任务分配.数量, 0) = 0 THEN '0%' - ELSE CAST(ROUND(ISNULL(dbo.车间生产管理工艺_零件工序_任务分配.加工数量, 0) * 100.0 / - dbo.车间生产管理工艺_零件工序_任务分配.数量, 2) AS DECIMAL(10, 2)) + '%' - END AS 完成率, - CONVERT(varchar(10), dbo.车间生产管理工艺_零件工艺计划.分配日期, 23) AS 投产时间, - dbo.车间生产管理_零件工序_视图.精工期限 -FROM dbo.车间生产管理工艺_零件工序_任务分配 -INNER JOIN dbo.车间生产管理_零件工序_视图 - ON dbo.车间生产管理工艺_零件工序_任务分配.工序流水号 = dbo.车间生产管理_零件工序_视图.工序流水号 -INNER JOIN dbo.基础数据_设备工位点检表 - ON dbo.车间生产管理工艺_零件工序_任务分配.设备流水号 = dbo.基础数据_设备工位点检表.设备流水号 -LEFT OUTER JOIN dbo.车间生产管理工艺_零件工艺计划 - ON dbo.车间生产管理_零件工序_视图.工艺计划流水号 = dbo.车间生产管理工艺_零件工艺计划.工艺计划流水号 -``` - -### **4. 视图创建后的关键Bug与修复** - -#### **4.1 Bug #1:查询视图时“varchar转换为numeric”错误** - -**原因**:在计算`完成率`字段时,错误地将数字(DECIMAL)与字符串('%')直接拼接,SQL Server无法自动处理类型转换。\ -**修复**:将计算得到的数字显式转换为字符串(VARCHAR)后再拼接。 - -sql - -``` --- 错误写法 -CAST(... AS DECIMAL(10, 2)) + '%' - --- 正确写法 -CAST(CAST(... AS DECIMAL(10, 2)) AS VARCHAR(20)) + '%' -``` - -#### **4.2 Bug #2:存储过程中“列名‘年份’无效”和“modulo运算符不兼容”** - -**原因**: - -1. 最初假设视图包含`年份`和`月份`字段,但实际视图不包含,导致筛选失败。 -2. 动态SQL中拼接`LIKE`子句时,单引号处理混乱,导致SQL Server将部分字符串和`%`误解析为模运算。 - -**最终修复**: - -1. **利用已有字段筛选**:使用视图中的`投产时间`字段进行模糊匹配。 - - sql - ``` - -- 动态SQL中的WHERE部分 - WHERE (投产时间 like @月份 + '-%' or 计划完成日期 like @月份 + '-%') - ``` -2. **正确拼接动态SQL**:确保参数化查询,避免字符串拼接错误。 - - sql - ``` - -- 存储过程中正确的拼接和参数传递示例 - ALTER PROCEDURE [dbo].[车间生产管理_生产计划_查询数据] - @月份 nvarchar(50), - @零件名称_check bit = null, - @零件名称 nvarchar(50) = null, - @状态_check bit = null, - @状态 nvarchar(50) = null - AS - BEGIN - DECLARE @selectStr NVARCHAR(4000) = 'SELECT * FROM 车间生产管理_生产计划_视图_新 WHERE (投产时间 like @月份 + ''-%'' or 计划完成日期 like @月份 + ''-%'')'; - - IF @零件名称_check = 1 - SET @selectStr = @selectStr + ' AND 零件名称 like ''%'' + @零件名称 + ''%'''; - - IF @状态_check = 1 - SET @selectStr = @selectStr + ' AND 状态 = @状态'; - - EXEC sp_executesql @selectStr, - N'@月份 nvarchar(50), @零件名称 nvarchar(50), @状态 nvarchar(50)', - @月份, @零件_name, @状态; - END - ``` - -### **5. 新增 `年` 和 `月` 字段** - -为方便按年月筛选,在最终视图中从`投产时间`(分配日期)中直接提取`年`和`月`两个独立字段。 - -**最终视图SQL(含年、月字段)**: - -sql - -``` -SELECT -- ... 其他字段 ... - CASE WHEN dbo.车间生产管理工艺_零件工艺计划.分配日期 IS NOT NULL - THEN YEAR(dbo.车间生产管理工艺_零件工艺计划.分配日期) - ELSE NULL END AS 年, - CASE WHEN dbo.车间生产管理工艺_零件工艺计划.分配日期 IS NOT NULL - THEN MONTH(dbo.车间生产管理工艺_零件工艺计划.分配日期) - ELSE NULL END AS 月 -FROM -- ... 表联接 ... -``` - -这样存储过程可直接使用`WHERE 年 = @年 AND 月 = @月`进行筛选,更为高效。 - -### **6. 最终调用示例** - -在应用程序中调用存储过程,传入参数。 - -json - -``` -{ - "合同编号": "", - "合同编号_check": 0, - "零件名称_check": 0, - "零件名称": "", - "产品名称_check": 0, - "产品名称": "", - "状态_check": 0, - "状态": "", - "月份": "2025-04" -} -``` - diff --git a/生产计划组件开发实施文档.md b/生产计划组件开发实施文档.md deleted file mode 100644 index 24be4037..00000000 --- a/生产计划组件开发实施文档.md +++ /dev/null @@ -1,388 +0,0 @@ -# 生产计划组件开发实施文档 - -## 1. 业务描述 - -### 1.1 业务背景 -生产计划管理是车间生产管理的核心模块,用于跟踪和监控生产任务的执行情况。该组件需要展示生产计划的详细信息,包括订单号、产品名称、零件名称、工序、设备分配、计划数量、完成日期等关键信息。 - -### 1.2 业务目标 -- 提供生产计划的查询和展示功能 -- 支持按订单号、零件名称、工序、设备等条件进行筛选 -- 展示生产进度和完成情况 -- 支持分页查询 - -### 1.3 业务流程 -```mermaid -flowchart TD - A[用户进入生产计划页面] --> B[选择查询月份] - B --> C[输入筛选条件] - C --> D[点击查询按钮] - D --> E[调用存储过程查询数据] - E --> F[返回查询结果] - F --> G[展示生产计划列表] -``` - ---- - -## 2. 技术方案 - -### 2.1 技术选型 -| 分类 | 技术 | 版本 | -| :--- | :--- | :--- | -| 前端框架 | Vue.js | 2.x | -| UI组件库 | Element UI | 2.x | -| 构建工具 | Webpack | 4.x | -| 后端语言 | C# | .NET Framework | -| 数据库 | SQL Server | 2016+ | - -### 2.2 架构设计 - -#### 2.2.1 架构分层 -```mermaid -flowchart LR - A[前端展示层] --> B[API接口层] - B --> C[业务逻辑层] - C --> D[数据访问层] - D --> E[数据库] -``` - -#### 2.2.2 模块划分 -| 模块 | 职责 | 说明 | -| :--- | :--- | :--- | -| 视图层 | 生产计划列表展示 | Vue组件 | -| 数据层 | 数据查询与处理 | API调用 | -| 业务层 | 存储过程执行 | SQL存储过程 | -| 数据层 | 数据持久化 | 视图与表 | - ---- - -## 3. 数据库设计 - -### 3.1 涉及的数据库表 - -#### 3.1.1 车间生产管理_零件工序_视图 -| 字段名 | 类型 | 长度 | 说明 | -| :--- | :--- | :--- | :--- | -| 零件名称 | nvarchar | 50 | 零件名称 | -| 数量 | int | - | 订单数量 | -| 工序 | nvarchar | 50 | 工序名称 | -| 操作者 | nvarchar | 50 | 操作人员 | -| 加工设备 | nvarchar | 100 | 加工设备 | -| 材料 | nvarchar | 100 | 使用材料 | -| 派工日期 | datetime | - | 派工日期 | -| 已完成数 | int | - | 已完成数量 | -| 订单号 | nvarchar | 50 | 订单编号 | -| 产品名称 | nvarchar | 100 | 产品名称 | -| 零件图号 | nvarchar | 50 | 零件图号 | -| 工序流水号 | int | - | 工序流水号(主键) | -| 工艺计划流水号 | int | - | 工艺计划流水号 | -| 质检数 | int | - | 质检数量 | -| 不良数 | int | - | 不良数量 | -| 工序顺序 | int | - | 工序顺序 | -| 工艺要求 | nvarchar | 500 | 工艺要求 | -| 工序状态 | nvarchar | 20 | 工序状态 | -| 考核状态 | nvarchar | 20 | 考核状态 | -| 机床名称 | nvarchar | 50 | 机床名称 | -| 工位号 | nvarchar | 20 | 工位号 | -| 被派工人员 | nvarchar | 50 | 被派工人员 | -| 外协数量 | int | - | 外协数量 | -| 到货数量 | int | - | 到货数量 | -| 工艺编号 | nvarchar | 50 | 工艺编号 | -| 订单流水号 | int | - | 订单流水号 | -| 订单类型 | nvarchar | 20 | 订单类型 | -| 已分配数 | int | - | 已分配数量 | -| 分配数 | int | - | 分配数量 | -| 最大分配数 | int | - | 最大分配数量 | -| 精工期限 | datetime | - | 精工期限 | -| 是否为报废补投件 | bit | - | 是否为报废补投件 | -| 代号 | nvarchar | 50 | 代号 | -| 定额工时 | decimal | - | 定额工时 | -| 准结工时 | decimal | - | 准结工时 | -| 物料编码 | nvarchar | 50 | 物料编码 | -| 是否加急 | bit | - | 是否加急 | -| 计划完成日期 | datetime | - | 计划完成日期 | -| 计划开始日期 | datetime | - | 计划开始日期 | - -#### 3.1.2 车间生产管理工艺_零件工序_任务分配 -| 字段名 | 类型 | 长度 | 说明 | -| :--- | :--- | :--- | :--- | -| 工艺任务流水号 | int | - | 主键 | -| 工序流水号 | int | - | 关联零件工序视图 | -| 数量 | int | - | 计划数量 | -| 人员编号 | int | - | 操作人员编号 | -| 设备流水号 | int | - | 设备流水号 | -| 分配时间 | datetime | - | 分配时间 | -| 完工期限 | datetime | - | 完工期限 | -| 已领数量 | int | - | 已领数量 | -| 加工数量 | int | - | 已加工数量 | -| 是否加工中 | bit | - | 是否正在加工 | -| 调拨员编号 | int | - | 调拨员编号 | -| 计划完成日期 | datetime | - | 计划完成日期 | -| 计划开始日期 | datetime | - | 计划开始日期 | - -#### 3.1.3 基础数据_设备工位点检表 -| 字段名 | 类型 | 长度 | 说明 | -| :--- | :--- | :--- | :--- | -| 设备流水号 | int | - | 主键 | -| 工位号 | nvarchar | 20 | 工位号 | -| 设备名称 | nvarchar | 100 | 设备名称 | - -### 3.2 视图定义 - -#### 车间生产管理_生产计划_视图(逻辑视图) -该视图为生产计划查询的核心视图,关联以下表: -- `车间生产管理工艺_零件工序_任务分配` -- `车间生产管理_零件工序_视图` -- `基础数据_设备工位点检表` - -**查询逻辑:** -```sql -SELECT - dbo.车间生产管理_零件工序_视图.订单号, - dbo.车间生产管理_零件工序_视图.产品名称, - dbo.车间生产管理_零件工序_视图.零件名称, - dbo.车间生产管理_零件工序_视图.工序, - dbo.基础数据_设备工位点检表.工位号 + N':' + dbo.基础数据_设备工位点检表.设备名称 AS 设备, - dbo.车间生产管理_零件工序_视图.数量 AS 订单数, - dbo.车间生产管理工艺_零件工序_任务分配.数量 AS 计划数, - CONVERT(varchar(10), dbo.车间生产管理工艺_零件工序_任务分配.计划完成日期, 23) AS 计划完成日期, - dbo.车间生产管理工艺_零件工序_任务分配.数量 - dbo.车间生产管理工艺_零件工序_任务分配.加工数量 AS 剩余数, - dbo.车间生产管理_零件工序_视图.零件图号, - dbo.车间生产管理_零件工序_视图.工序顺序, - CONVERT(varchar(10), dbo.车间生产管理工艺_零件工序_任务分配.计划开始日期, 23) AS 计划开始日期, - dbo.基础数据_设备工位点检表.设备名称 -FROM - dbo.车间生产管理工艺_零件工序_任务分配 -INNER JOIN - dbo.车间生产管理_零件工序_视图 ON - dbo.车间生产管理工艺_零件工序_任务分配.工序流水号 = dbo.车间生产管理_零件工序_视图.工序流水号 -INNER JOIN - dbo.基础数据_设备工位点检表 ON - dbo.车间生产管理工艺_零件工序_任务分配.设备流水号 = dbo.基础数据_设备工位点检表.设备流水号 -``` - ---- - -## 4. 存储过程设计 - -### 4.1 车间生产管理_生产计划_查询数据 - -**功能:** 根据筛选条件分页查询生产计划数据 - -**参数说明:** - -| 参数名 | 类型 | 长度 | 说明 | 默认值 | -| :--- | :--- | :--- | :--- | :--- | -| @合同编号_check | bit | - | 是否按合同编号筛选 | null | -| @合同编号 | nvarchar | 50 | 合同编号 | null | -| @零件名称_check | bit | - | 是否按零件名称筛选 | null | -| @零件名称 | nvarchar | 50 | 零件名称 | null | -| @工序名称_check | bit | - | 是否按工序名称筛选 | null | -| @工序名称 | nvarchar | 50 | 工序名称 | null | -| @设备_check | bit | - | 是否按设备筛选 | null | -| @设备 | nvarchar | 50 | 设备名称 | null | -| @月份 | nvarchar | 50 | 查询月份(格式:yyyy-MM) | - | - -**存储过程代码:** -```sql -ALTER PROCEDURE [dbo].[车间生产管理_生产计划_查询数据] -@合同编号_check bit = null, -@合同编号 nvarchar(50) = null, -@零件名称_check bit = null, -@零件名称 nvarchar(50) = null, -@工序名称_check bit = null, -@工序名称 nvarchar(50) = null, -@设备_check bit = null, -@设备 nvarchar(50) = null, -@月份 nvarchar(50) -AS - declare @年 nvarchar(50) - declare @月 nvarchar(50) - - select @年 = left(@月份,4) - select @月 = SUBSTRING(@月份,CHARINDEX('-',@月份)+1,len(@月份)-charindex('-',@月份)) - - declare @selectStr nvarchar(4000) - declare @selectStrWhere nvarchar(4000) - - set @selectStr = 'select * from 车间生产管理_生产计划_视图 ' - - set @selectStrWhere = 'where 年份=@年 and 月份=@月 ' - - if(@零件名称_check = 1) - set @selectStrWhere = @selectStrWhere+' and 零件名称+零件图号 like + ''%'' + @零件名称 + ''%'' ' - if(@合同编号_check = 1) - set @selectStrWhere = @selectStrWhere+' and 订单号 like + ''%'' + @合同编号 + ''%'' ' - if(@工序名称_check = 1) - set @selectStrWhere = @selectStrWhere+' and 工序 like + ''%'' + @工序名称 + ''%'' ' - if(@设备_check = 1) - set @selectStrWhere = @selectStrWhere+' and 设备 like + ''%'' + @设备 + ''%'' ' - - set @selectStr = @selectStr+@selectStrWhere - - EXEC sp_executesql @selectStr, - N'@零件名称 nvarchar(50),@合同编号 nvarchar(50),@工序名称 nvarchar(50),@设备 nvarchar(50),@年 int,@月 int ', - @零件名称,@合同编号,@工序名称,@设备,@年,@月 -``` - ---- - -## 5. 前端组件设计 - -### 5.1 组件结构 - -**文件路径:** `src/views/SeikoWorkshop/ProductionPlan/index.vue` - -### 5.2 功能模块 - -#### 5.2.1 查询区域 -| 控件 | 类型 | 绑定字段 | 说明 | -| :--- | :--- | :--- | :--- | -| 月份选择器 | el-date-picker | monthValue | 选择查询月份(必填) | -| 订单编号输入框 | el-input | orderNumberTypeValue | 按订单编号筛选 | -| 零件名称输入框 | el-input | partNameValue | 按零件名称或图号筛选 | -| 产品名称输入框 | el-input | productNameValue | 按产品名称筛选 | -| 状态下拉框 | el-select | statusValue | 按状态筛选(待料/生产中/已完成) | -| 查询按钮 | el-button | - | 触发查询 | - -#### 5.2.2 表格展示区域 -| 列名 | 宽度 | 说明 | 特殊处理 | -| :--- | :--- | :--- | :--- | -| 序号 | 50px | 行号 | 固定列 | -| 状态 | 60px | 订单状态 | 标签展示,不同状态不同颜色 | -| 订单编号 | 140px | 订单编号 | 固定列 | -| 收货人 | 80px | 收货人 | 固定列 | -| 投产日期 | 80px | 投产日期 | - | -| 订单交货日期 | 100px | 订单交货日期 | - | -| 数量 | 60px | 订单数量 | - | -| 产品名称 | 120px | 产品名称 | - | -| 规格型号 | 140px | 规格型号 | - | -| 零件名称 | 120px | 零件名称 | - | -| 零件图号 | 120px | 零件图号 | - | -| 毛坯类型 | 100px | 毛坯类型 | - | -| 完成率 | 80px | 完成率 | - | -| 当前状态 | 80px | 当前状态 | - | -| OP010~OP110 | 60px | 各工序状态 | - | - -#### 5.2.3 分页区域 -| 功能 | 说明 | -| :--- | :--- | -| 总条数 | 显示查询结果总数 | -| 每页条数选择 | 支持10/20/30/40/100 | -| 页码跳转 | 支持上一页/下一页/直接跳转 | - -### 5.3 数据交互流程 - -```mermaid -sequenceDiagram - participant 前端 as Vue组件 - participant API as API接口 - participant 数据库 as SQL Server - - 前端->>前端: 用户输入筛选条件 - 前端->>前端: 调用searchTable1()方法 - 前端->>API: 调用CreateData()创建请求参数 - API->>数据库: 执行存储过程车间生产管理_生产计划_查询数据 - 数据库-->>API: 返回查询结果 - API-->>前端: 返回response数据 - 前端->>前端: 更新tableData2和total - 前端->>前端: 渲染表格和分页 -``` - -### 5.4 关键代码说明 - -#### 5.4.1 数据参数构造 -```javascript -var param = [] -param[0] = ['订单编号', this.orderNumberTypeValue] -param[1] = ['订单编号_check', orderNumberTypeValue_check] -param[2] = ['零件名称_check', partNameValue_check] -param[3] = ['零件名称', this.partNameValue] -param[4] = ['产品名称_check', productNameValue_check] -param[5] = ['产品名称', this.productNameValue] -param[6] = ['状态_check', statusValue_check] -param[7] = ['状态', this.statusValue] -param[8] = ['月份', this.monthValue] -``` - -#### 5.4.2 数据请求调用 -```javascript -var Data = this.CreateData('11', '车间生产管理_生产计划_查询数据', param, this.pageSize, this.pageCurrent) -this.ExecDatabase(Data).then(response => { - this.tableData2 = response.data.rows - this.total = response.data.total -}) -``` - ---- - -## 6. 详细工作步骤 - -### 6.1 数据库层开发 - -| 步骤 | 任务 | 负责人 | 预计时间 | 状态 | -| :--- | :--- | :--- | :--- | :--- | -| 1 | 创建/确认视图`车间生产管理_生产计划_视图` | DBA | 1天 | - | -| 2 | 创建/更新存储过程`车间生产管理_生产计划_查询数据` | DBA | 0.5天 | - | -| 3 | 测试存储过程执行结果 | DBA | 0.5天 | - | - -### 6.2 前端组件开发 - -| 步骤 | 任务 | 负责人 | 预计时间 | 状态 | -| :--- | :--- | :--- | :--- | :--- | -| 1 | 创建查询区域UI(日期选择器、输入框、下拉框) | 前端开发 | 0.5天 | - | -| 2 | 创建表格展示区域(列定义、样式、状态标签) | 前端开发 | 1天 | - | -| 3 | 实现分页功能(页码切换、条数选择) | 前端开发 | 0.5天 | - | -| 4 | 实现数据查询逻辑(参数构造、API调用) | 前端开发 | 1天 | - | -| 5 | 联调测试(接口对接、数据展示验证) | 前端开发 | 1天 | - | - -### 6.3 测试与上线 - -| 步骤 | 任务 | 负责人 | 预计时间 | 状态 | -| :--- | :--- | :--- | :--- | :--- | -| 1 | 功能测试(查询、筛选、分页) | 测试人员 | 1天 | - | -| 2 | 性能测试(大数据量查询) | 测试人员 | 0.5天 | - | -| 3 | Bug修复 | 开发人员 | 0.5天 | - | -| 4 | 代码评审 | 技术负责人 | 0.5天 | - | -| 5 | 上线部署 | 运维人员 | 0.5天 | - | - ---- - -## 7. 注意事项 - -### 7.1 数据库注意事项 -1. 确保视图`车间生产管理_生产计划_视图`包含`年份`和`月份`字段用于筛选 -2. 存储过程使用动态SQL,需注意SQL注入风险 -3. 建议对查询结果添加索引优化性能 - -### 7.2 前端注意事项 -1. 月份为必填项,需添加非空校验 -2. 表格列较多,需设置合理的宽度和滚动 -3. 状态标签颜色需根据业务需求调整 - -### 7.3 安全注意事项 -1. 输入参数需进行校验和过滤 -2. 敏感数据需进行脱敏处理 -3. API调用需携带认证信息 - ---- - -## 8. 附录 - -### 8.1 状态映射表 -| 状态值 | 显示文本 | 标签类型 | -| :--- | :--- | :--- | -| 待料 | 待料 | warning | -| 生产中 | 生产中 | success | -| 已完成 | 已完成 | info | - -### 8.2 日期格式说明 -- 月份格式:`yyyy-M`(如:2024-01) -- 日期格式:`yyyy-MM-dd`(如:2024-01-15) - -### 8.3 文件路径汇总 -| 文件类型 | 文件路径 | -| :--- | :--- | -| 前端组件 | `src/views/SeikoWorkshop/ProductionPlan/index.vue` | -| API配置 | `src/assets/img/api/ManufacturingCenter/ProductionPlanQuery.js` | -| 图标文件 | `src/icons/svg/ProductionPlan.svg` | \ No newline at end of file