We design the workflow of the factory assembly line
For example: component assembly, photographing-cleaning-welding-cutting, etc.
Using the mysql database, the main workflow-related tables are:
1. Operation procedure (link, node) table: work_procedure
Enumeration of all operation procedures (links, nodes)
DROP TABLE IF EXISTS `work_procedure`;
CREATE TABLE `work_procedure` (
`CoreId` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键自增编号',
`Operation` varchar(50) NOT NULL DEFAULT '' COMMENT '操作工序',
`OperationName` varchar(50) NOT NULL DEFAULT '' COMMENT '操作工序名称',
`ProductTimespan` int(11) NOT NULL DEFAULT '1' COMMENT '预计加工时间间隔(秒)',
`CreateName` varchar(30) NOT NULL DEFAULT '' COMMENT '创建人',
`CreateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`Enabled` int(11) NOT NULL DEFAULT '1' COMMENT '是否有效',
PRIMARY KEY (`CoreId`),
KEY `IDX_Operation` (`Operation`) USING BTREE,
KEY `IDX_OperationName` (`OperationName`) USING BTREE,
KEY `IDX_OperateTime` (`CreateTime`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COMMENT='所有操作工序表';
-- ----------------------------
-- Records of work_procedure
-- ----------------------------
INSERT INTO `work_procedure` VALUES ('1', 'Assemble', '堆叠装配', '300', '管理员', '2022-11-10 14:27:53', '1');
INSERT INTO `work_procedure` VALUES ('2', 'Photo', '极柱扫码拍照', '200', '管理员', '2022-11-10 14:33:12', '1');
INSERT INTO `work_procedure` VALUES ('3', 'ISO_Test', '绝缘极性检测', '200', '管理员', '2022-11-10 14:34:52', '1');
INSERT INTO `work_procedure` VALUES ('4', 'Laser_Clean', '激光清洗', '200', '管理员', '2022-11-10 14:35:16', '1');
INSERT INTO `work_procedure` VALUES ('5', 'Busbar', 'Busbar焊接', '300', '管理员', '2022-11-10 14:36:02', '1');
INSERT INTO `work_procedure` VALUES ('6', 'DCIR', 'DCIR测试', '300', '管理员', '2022-11-10 14:36:16', '1');
INSERT INTO `work_procedure` VALUES ('7', 'FPC', 'FPC焊接', '300', '管理员', '2022-11-10 14:37:05', '1');
INSERT INTO `work_procedure` VALUES ('8', 'EOL', 'EOL测试', '300', '管理员', '2022-11-10 14:37:21', '1');
INSERT INTO `work_procedure` VALUES ('9', 'Offline', '模组下线', '300', '管理员', '2022-11-10 14:39:13', '1');
2. Process route or circulation link configuration table: process_router
Records are automatically transferred from link A to link B, with a linked list structure.
If the previous operation procedure is empty, it is the starting point of the workflow.
If there is no next operation procedure, it is the starting point of the workflow.
DROP TABLE IF EXISTS `process_router`;
CREATE TABLE `process_router` (
`CoreId` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键自增编号',
`Operation` varchar(50) NOT NULL DEFAULT '' COMMENT '操作工序',
`OperationName` varchar(50) NOT NULL DEFAULT '' COMMENT '操作工序名称',
`PreviousOperation` varchar(50) NOT NULL DEFAULT '' COMMENT '上一个操作工序',
`PreviousOperationName` varchar(50) NOT NULL DEFAULT '' COMMENT '上一个操作工序名称',
`ProductTimespan` int(11) NOT NULL DEFAULT '1' COMMENT '预计加工时间间隔(秒)',
`CreateName` varchar(30) NOT NULL DEFAULT '' COMMENT '创建时间',
`CreateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`IsValid` int(11) NOT NULL DEFAULT '1' COMMENT '是否有效',
PRIMARY KEY (`CoreId`),
KEY `IDX_Operation` (`Operation`) USING BTREE,
KEY `IDX_OperationName` (`OperationName`) USING BTREE,
KEY `IDX_PreviousOperation` (`PreviousOperation`) USING BTREE,
KEY `IDX_PreviousOperationName` (`PreviousOperationName`) USING BTREE,
KEY `IDX_OperateTime` (`CreateTime`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COMMENT='工艺路线表';
-- ----------------------------
-- Records of process_router
-- ----------------------------
INSERT INTO `process_router` VALUES ('1', 'Assemble', '堆叠装配', '', '', '300', '管理员', '2022-11-10 15:26:44', '1');
INSERT INTO `process_router` VALUES ('2', 'Photo', '极柱扫码拍照', 'Assemble', '堆叠装配', '300', '管理员', '2022-11-10 15:27:23', '1');
INSERT INTO `process_router` VALUES ('3', 'ISO_Test', '绝缘极性检测', 'Photo', '极柱扫码拍照', '300', '管理员', '2022-11-10 15:45:00', '1');
INSERT INTO `process_router` VALUES ('4', 'Laser_Clean', '激光清洗', 'ISO_Test', '绝缘极性检测', '300', '管理员', '2022-11-10 15:46:42', '1');
INSERT INTO `process_router` VALUES ('5', 'Busbar', 'Busbar焊接', 'Laser_Clean', '激光清洗', '300', '管理员', '2022-11-10 15:47:00', '1');
INSERT INTO `process_router` VALUES ('6', 'DCIR', 'DCIR测试', 'Busbar', 'Busbar焊接', '300', '管理员', '2022-11-10 15:47:14', '1');
INSERT INTO `process_router` VALUES ('7', 'FPC', 'FPC焊接', 'DCIR', 'DCIR测试', '300', '管理员', '2022-11-10 15:47:31', '1');
INSERT INTO `process_router` VALUES ('8', 'EOL', 'EOL测试', 'FPC', 'FPC焊接', '300', '管理员', '2022-11-10 15:47:44', '1');
INSERT INTO `process_router` VALUES ('9', 'Offline', '模组下线', 'EOL', 'EOL测试', '300', '管理员', '2022-11-10 15:48:00', '1');
3. Workflow tracking link list: workflow_trace
Record the start time and end time of the current node (link) of the workflow, as well as the workflow status and the last node number
CREATE TABLE `workflow_trace` (
`CoreId` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键自增编号',
`ParentCoreId` int(11) DEFAULT NULL COMMENT '上一跟踪编号',
`Barcode` varchar(50) DEFAULT '' COMMENT '模组码',
`WorkOrder` varchar(50) DEFAULT NULL COMMENT '工单号',
`Operation` varchar(50) NOT NULL DEFAULT '' COMMENT '操作工序编码',
`OperationName` varchar(50) NOT NULL DEFAULT '' COMMENT '操作工序名称',
`ProcessStartTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '处理开始时间',
`ProcessEndTime` datetime DEFAULT NULL COMMENT '处理结束时间',
`WorkStatus` varchar(50) NOT NULL DEFAULT 'Queue' COMMENT '状态【Queue,Working,Completed,DirectDelivery直送,Abolished作废的】',
`CreateName` varchar(30) NOT NULL DEFAULT '' COMMENT '创建人',
`CreateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`IsAllCompleted` int(11) NOT NULL DEFAULT '0' COMMENT '是否完工下料',
PRIMARY KEY (`CoreId`),
KEY `IDX_ParentCoreId` (`ParentCoreId`) USING BTREE,
KEY `IDX_Barcode` (`Barcode`) USING BTREE,
KEY `IDX_WorkOrder` (`WorkOrder`) USING BTREE,
KEY `IDX_OperationName` (`OperationName`) USING BTREE,
KEY `IDX_Operation` (`Operation`) USING BTREE,
KEY `IDX_ProcessStartTime` (`ProcessStartTime`) USING BTREE,
KEY `IDX_ProcessEndTime` (`ProcessEndTime`) USING BTREE,
KEY `IDX_CreateTime` (`CreateTime`) USING BTREE,
KEY `IDX_WorkStatus` (`WorkStatus`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='工作流跟踪表';
4. Workflow filing table: workflow_trace_archive
The essence of filing the completed workflow is to copy the contents of the workflow_trace table
CREATE TABLE `workflow_trace_archive` (
`CoreId` int(11) NOT NULL COMMENT '编号',
`ParentCoreId` int(11) DEFAULT NULL COMMENT '上一跟踪编号',
`Barcode` varchar(50) DEFAULT '' COMMENT '模组码',
`WorkOrder` varchar(50) DEFAULT NULL COMMENT '工单号',
`Operation` varchar(50) NOT NULL DEFAULT '' COMMENT '操作工序编码',
`OperationName` varchar(50) NOT NULL DEFAULT '' COMMENT '操作工序名称',
`ProcessStartTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '处理开始时间',
`ProcessEndTime` datetime DEFAULT NULL COMMENT '处理结束时间',
`WorkStatus` varchar(50) NOT NULL DEFAULT 'Queue' COMMENT '状态【Queue,Working,Completed,DirectDelivery直送,Abolished作废的】',
`CreateName` varchar(30) NOT NULL DEFAULT '' COMMENT '创建人',
`CreateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`IsAllCompleted` int(11) NOT NULL DEFAULT '0' COMMENT '是否完工下料',
PRIMARY KEY (`CoreId`),
KEY `IDX_ParentCoreId` (`ParentCoreId`) USING BTREE,
KEY `IDX_Barcode` (`Barcode`) USING BTREE,
KEY `IDX_WorkOrder` (`WorkOrder`) USING BTREE,
KEY `IDX_OperationName` (`OperationName`) USING BTREE,
KEY `IDX_Operation` (`Operation`) USING BTREE,
KEY `IDX_ProcessStartTime` (`ProcessStartTime`) USING BTREE,
KEY `IDX_ProcessEndTime` (`ProcessEndTime`) USING BTREE,
KEY `IDX_CreateTime` (`CreateTime`) USING BTREE,
KEY `IDX_WorkStatus` (`WorkStatus`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='工作流办结表';