提交
This commit is contained in:
1 parent
2de86b0500
commit
7f4c9720e9
37 files changed
+33121
-28528
No files matched your search
@@ -0,0 +1,31 @@
|
||||
-- 生产产品类型:从中试细胞产品类型解耦
|
||||
-- 表结构对齐 biz_cell_product_type;同 id 拷贝现有未删除数据(幂等)
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `biz_production_product_type` (
|
||||
`id` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '主键ID',
|
||||
`product_type_code` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '产品类型编码',
|
||||
`product_type_name` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '产品类型名称',
|
||||
`tenant_no` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'zkxw' COMMENT '租户编号',
|
||||
`order_num` int(11) DEFAULT NULL COMMENT '排序号',
|
||||
`remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
|
||||
`create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人id',
|
||||
`create_dept_id` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '创建人部门ID',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人id',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标记:0-正常 1-已删除',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='生产产品类型';
|
||||
|
||||
INSERT INTO `biz_production_product_type` (
|
||||
`id`, `product_type_code`, `product_type_name`, `tenant_no`, `order_num`, `remark`,
|
||||
`create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`
|
||||
)
|
||||
SELECT
|
||||
src.`id`, src.`product_type_code`, src.`product_type_name`, src.`tenant_no`, src.`order_num`, src.`remark`,
|
||||
src.`create_by`, src.`create_dept_id`, src.`create_time`, src.`update_by`, src.`update_time`, src.`del_flag`
|
||||
FROM `biz_cell_product_type` src
|
||||
WHERE src.`del_flag` = 0
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `biz_production_product_type` dst WHERE dst.`id` = src.`id`
|
||||
);
|
||||
@@ -4405,8 +4405,39 @@ INSERT INTO `biz_cell_product_type` (`id`, `product_type_code`, `product_type_na
|
||||
INSERT INTO `biz_cell_product_type` (`id`, `product_type_code`, `product_type_name`, `tenant_no`, `order_num`, `remark`, `create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`) VALUES ('E3FC0E45254E4F20A4BAB9C7BC0F80D3', 'NK', 'NK', 'zkxw', 0, '', 'd3000000000000000000000000000001', 'b13c2be2-4e71-11f1-9f47-00163e3bdd96', '2026-06-24 06:21:19', 'd3000000000000000000000000000001', '2026-06-24 06:21:19', 0);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
-- ----------------------------
|
||||
-- Table structure for biz_production_product_type
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `biz_production_product_type`;
|
||||
CREATE TABLE `biz_production_product_type` (
|
||||
`id` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '主键ID',
|
||||
`product_type_code` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '产品类型编码',
|
||||
`product_type_name` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '产品类型名称',
|
||||
`tenant_no` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'zkxw' COMMENT '租户编号',
|
||||
`order_num` int(11) DEFAULT NULL COMMENT '排序号',
|
||||
`remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
|
||||
`create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人id',
|
||||
`create_dept_id` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '创建人部门ID',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人id',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标记:0-正常 1-已删除',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='生产产品类型';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of biz_production_product_type
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `biz_production_product_type` (`id`, `product_type_code`, `product_type_name`, `tenant_no`, `order_num`, `remark`, `create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`) VALUES ('07440FAD25DB4EE5BBF2E4CE4522C23D', 'MSC', 'MSC', 'zkxw', 0, '', 'd3000000000000000000000000000001', 'b13c2be2-4e71-11f1-9f47-00163e3bdd96', '2026-06-24 06:21:27', 'd3000000000000000000000000000001', '2026-06-24 06:21:27', 0);
|
||||
INSERT INTO `biz_production_product_type` (`id`, `product_type_code`, `product_type_name`, `tenant_no`, `order_num`, `remark`, `create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`) VALUES ('C413F90754034384A55D6345EC425787', '存储', '存储', 'zkxw', 0, '', 'd3000000000000000000000000000001', 'b13c2be2-4e71-11f1-9f47-00163e3bdd96', '2026-06-24 06:21:35', 'd3000000000000000000000000000001', '2026-06-24 06:21:35', 0);
|
||||
INSERT INTO `biz_production_product_type` (`id`, `product_type_code`, `product_type_name`, `tenant_no`, `order_num`, `remark`, `create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`) VALUES ('E3FC0E45254E4F20A4BAB9C7BC0F80D3', 'NK', 'NK', 'zkxw', 0, '', 'd3000000000000000000000000000001', 'b13c2be2-4e71-11f1-9f47-00163e3bdd96', '2026-06-24 06:21:19', 'd3000000000000000000000000000001', '2026-06-24 06:21:19', 0);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for biz_cell_sample_type
|
||||
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `biz_cell_sample_type`;
|
||||
CREATE TABLE `biz_cell_sample_type` (
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
# 生产产品类型表解耦 Implementation Plan
|
||||
|
||||
> **For agentic workers:** Execute task-by-task. Steps use checkbox syntax for tracking.
|
||||
|
||||
**Goal:** 生产侧产品类型改用 `biz_production_product_type`,中试继续用 `biz_cell_product_type`。
|
||||
|
||||
**Architecture:** 同结构新表 + 同 ID 种子拷贝;生产 API CRUD;前端三处下拉换接口;cell_product / process_route join 切新表。
|
||||
|
||||
**Tech Stack:** MySQL、FastAPI、SQLAlchemy、Vue 3、web-admin API 模块
|
||||
|
||||
---
|
||||
|
||||
### Task 1: SQL + Model
|
||||
|
||||
- [x] 创建 `docs/sql/patch_2026-07-24_production_product_type.sql`(建表 + 幂等拷贝)
|
||||
- [x] 在 `models.py` 增加 `BizProductionProductType`
|
||||
- [x] 在 `zkxw.sql` 追加表结构(与 patch 一致,便于全量基线)
|
||||
|
||||
### Task 2: Backend CRUD + API
|
||||
|
||||
- [x] 创建 `backend/app/crud/production_product_type.py`(对齐 output_type / cell product type)
|
||||
- [x] 在 `production.py` 增加 `/production-product-types` CRUD 路由
|
||||
|
||||
### Task 3: Switch joins
|
||||
|
||||
- [x] `cell_product.py`:`BizCellProductType` → `BizProductionProductType`
|
||||
- [x] `process_route.py`:outerjoin 切到新表
|
||||
|
||||
### Task 4: Frontend
|
||||
|
||||
- [x] `api/production.ts` 增加 fetch 封装
|
||||
- [x] 三处 Vue 改用新 list API
|
||||
|
||||
### Task 5: Verify
|
||||
|
||||
- [x] 导入模型/路由可达;更新 graphify(backend + frontend)
|
||||
@@ -0,0 +1,59 @@
|
||||
# 生产产品类型表解耦设计
|
||||
|
||||
**日期:** 2026-07-24
|
||||
**状态:** 已批准
|
||||
|
||||
## 目标
|
||||
|
||||
将生产侧「产品类型」与中试侧 `biz_cell_product_type` 解耦:中试继续使用旧表;生产改用结构相同的新表 `biz_production_product_type`。
|
||||
|
||||
## 数据边界
|
||||
|
||||
| 侧 | 表 | 行为 |
|
||||
|----|-----|------|
|
||||
| 中试 | `biz_cell_product_type` | 主数据维护 + 价格体系(`biz_cell_product_price` / `biz_cell_product_project_system_item`),不变 |
|
||||
| 生产 | `biz_production_product_type` | 新表,字段与旧表一致 |
|
||||
|
||||
新表字段:`id`, `product_type_code`, `product_type_name`, `tenant_no`, `order_num`, `remark`,以及公共字段(`create_by` … `del_flag`)。
|
||||
|
||||
初始化:从 `biz_cell_product_type` **按相同 `id`** 拷贝未删除行到新表(幂等),保证 `biz_cell_product.product_type_id` / `biz_process_route.product_type_id` 无需改库即可继续解析名称。之后两边数据各自维护,不再同步。
|
||||
|
||||
## API
|
||||
|
||||
前缀:`/web/admin/production-product-types`
|
||||
|
||||
| 方法 | 路径 | 说明 |
|
||||
|------|------|------|
|
||||
| GET | `/` | 分页列表(keyword 搜编码/名称) |
|
||||
| POST | `/` | 新增 |
|
||||
| PUT | `/{id}` | 更新 |
|
||||
| DELETE | `/{id}` | 软删 |
|
||||
|
||||
鉴权与现有生产/中试主数据接口一致(`require_admin_or_super_admin`)。本期不做管理端菜单页。
|
||||
|
||||
## 改动范围
|
||||
|
||||
**后端**
|
||||
|
||||
- 新模型 `BizProductionProductType`
|
||||
- 新 CRUD + 挂到 `production` 路由
|
||||
- `cell_product` / `process_route` 解析类型名称时改为关联新表
|
||||
- `docs/sql/` 建表 + 同 ID 拷贝迁移脚本
|
||||
|
||||
**前端**(只换数据源)
|
||||
|
||||
- `TaskOutputProductDialog.vue`
|
||||
- `production/cell-product/index.vue`
|
||||
- `ProcessRouteTab.vue`
|
||||
|
||||
**明确不动**
|
||||
|
||||
- 中试 `cell-product-types` API、维护页、价格体系
|
||||
- 生产侧类型维护 UI、两表持续双向同步
|
||||
|
||||
## 验收
|
||||
|
||||
- 生产三处「产品类型」下拉数据来自新接口/新表
|
||||
- 中试类型 CRUD、价格体系仍用旧表
|
||||
- 已有细胞产品、工艺路线的类型名称显示正常
|
||||
- 无新菜单页;可用 SQL/接口维护新表
|
||||
Reference in new issue
Block a user