01_create_tables.sql 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. /*Table structure for table `sys_dictionary` */
  2. DROP TABLE IF EXISTS `sys_dictionary`;
  3. CREATE TABLE `sys_dictionary` (
  4. `dict_id` INT(11) NOT NULL AUTO_INCREMENT,
  5. `dict_code` VARCHAR(20) NOT NULL COMMENT '字典编码',
  6. `dict_name` VARCHAR(50) NOT NULL COMMENT '字典名称',
  7. `dict_type` VARCHAR(20) NOT NULL COMMENT '字典类型',
  8. `parent_dict_id` INT(11) DEFAULT NULL COMMENT '父类型ID默认为0',
  9. `enable_state` CHAR(1) NOT NULL COMMENT '启用状态,1为启用,0禁用',
  10. `order_no` TINYINT(4) DEFAULT NULL COMMENT '排序值',
  11. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  12. PRIMARY KEY (`dict_id`)
  13. ) ENGINE=INNODB COMMENT='数据字典';
  14. /*Table structure for table `sys_resource` */
  15. DROP TABLE IF EXISTS `sys_resource`;
  16. CREATE TABLE `sys_resource` (
  17. `resource_id` INT(11) NOT NULL AUTO_INCREMENT,
  18. `resource_name` VARCHAR(50) NOT NULL COMMENT '名称',
  19. `resource_code` VARCHAR(80) DEFAULT NULL COMMENT '编码',
  20. `resource_type` CHAR(1) DEFAULT NULL COMMENT '资源类型(M菜单,B按钮)',
  21. `resource_url` VARCHAR(120) DEFAULT NULL COMMENT '菜单地址',
  22. `parent_resource_id` INT(11) DEFAULT NULL COMMENT '父ID',
  23. `is_show` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '1显示,0不显示',
  24. `menu_order` TINYINT(4) DEFAULT NULL COMMENT '顺序',
  25. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  26. PRIMARY KEY (`resource_id`),
  27. UNIQUE KEY `uk_name` (`resource_name`),
  28. UNIQUE KEY `uk_code` (`resource_code`)
  29. ) ENGINE=INNODB COMMENT='系统资源(菜单项及按钮)';
  30. /*Table structure for table `sys_role` */
  31. DROP TABLE IF EXISTS `sys_role`;
  32. CREATE TABLE `sys_role` (
  33. `role_id` INT(11) NOT NULL AUTO_INCREMENT,
  34. `role_name` VARCHAR(50) NOT NULL COMMENT '角色名称',
  35. `role_code` VARCHAR(20) DEFAULT NULL COMMENT '角色编号',
  36. `remark` VARCHAR(200) DEFAULT NULL COMMENT '说明',
  37. `is_default` VARCHAR(1) DEFAULT '0',
  38. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  39. PRIMARY KEY (`role_id`),
  40. UNIQUE KEY `uk_name` (`role_name`),
  41. UNIQUE KEY `uk_code` (`role_code`)
  42. ) ENGINE=INNODB COMMENT='角色表';
  43. /*Table structure for table `sys_role_resource` */
  44. DROP TABLE IF EXISTS `sys_role_resource`;
  45. CREATE TABLE `sys_role_resource` (
  46. `id` INT(11) NOT NULL AUTO_INCREMENT,
  47. `role_id` INT(11) NOT NULL,
  48. `resource_id` INT(11) NOT NULL,
  49. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  50. PRIMARY KEY (`id`),
  51. UNIQUE KEY `uk_role_resource` (`role_id`, `resource_id`)
  52. ) ENGINE=INNODB COMMENT='角色资源权限表';
  53. /*Table structure for table `sys_user` */
  54. DROP TABLE IF EXISTS `sys_user`;
  55. CREATE TABLE `sys_user` (
  56. `user_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
  57. `login_name` VARCHAR(50) NOT NULL COMMENT '登录账号',
  58. `password` VARCHAR(128) DEFAULT NULL COMMENT '登录密码',
  59. `user_name` VARCHAR(50) DEFAULT NULL COMMENT '用户名称',
  60. `mobile_phone` VARCHAR(50) DEFAULT NULL COMMENT '手机',
  61. `status` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '状态1有效,0无效',
  62. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  63. PRIMARY KEY (`user_id`),
  64. UNIQUE KEY `uk_login_name` (`login_name`)
  65. ) ENGINE=INNODB COMMENT='用户表';
  66. /*Table structure for table `sys_user_role` */
  67. DROP TABLE IF EXISTS `sys_user_role`;
  68. CREATE TABLE `sys_user_role` (
  69. `id` INT(11) NOT NULL AUTO_INCREMENT,
  70. `user_id` INT(11) NOT NULL COMMENT '用户ID',
  71. `role_id` INT(11) NOT NULL COMMENT '角色ID',
  72. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  73. PRIMARY KEY (`id`),
  74. UNIQUE KEY `uk_user_role` (`user_id`, `role_id`)
  75. ) ENGINE=INNODB COMMENT='用户角色';
  76. /*Table structure for table `oa_department` */
  77. DROP TABLE IF EXISTS `oa_department`;
  78. CREATE TABLE `oa_department` (
  79. `dept_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '部门ID',
  80. `dept_name` VARCHAR(50) NOT NULL COMMENT '部门名称',
  81. `dept_code` VARCHAR(50) DEFAULT NULL COMMENT '部门编号',
  82. `parent_id` INT(11) DEFAULT NULL COMMENT '上级部门',
  83. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  84. PRIMARY KEY (`dept_id`),
  85. UNIQUE KEY `uk_dept_name` (`dept_name`)
  86. ) ENGINE=INNODB COMMENT='部门表';
  87. /*Table structure for table `oa_staff` */
  88. DROP TABLE IF EXISTS `oa_staff`;
  89. CREATE TABLE `oa_staff` (
  90. `staff_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '员工ID',
  91. `staff_no` VARCHAR(20) NOT NULL COMMENT '员工工号',
  92. `staff_name` VARCHAR(20) DEFAULT NULL COMMENT '员工姓名',
  93. `dept_id` INT(11) DEFAULT NULL COMMENT '部门ID',
  94. `is_worker` INT(11) NOT NULL DEFAULT 1 COMMENT '是否产线工人',
  95. `status` TINYINT(1) DEFAULT NULL COMMENT '状态1有效,0无效',
  96. `sex` VARCHAR(1) DEFAULT NULL COMMENT '性别,男 女',
  97. `post` VARCHAR(20) DEFAULT NULL COMMENT '职务',
  98. `email` VARCHAR(30) DEFAULT NULL COMMENT '邮件',
  99. `mobile_phone` VARCHAR(50) DEFAULT NULL COMMENT '手机',
  100. `inner_phone` VARCHAR(10) DEFAULT NULL COMMENT '内线电话',
  101. `outer_phone` VARCHAR(30) DEFAULT NULL COMMENT '外线电话',
  102. `home_phone` VARCHAR(30) DEFAULT NULL COMMENT '家庭电话',
  103. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  104. PRIMARY KEY (`staff_id`),
  105. UNIQUE KEY `uk_staff_no` (`staff_no`)
  106. ) ENGINE=INNODB COMMENT='员工信息表';
  107. /*Table structure for table `sys_visit_log` */
  108. DROP TABLE IF EXISTS `sys_visit_log`;
  109. CREATE TABLE `sys_visit_log` (
  110. `log_id` BIGINT(20) NOT NULL AUTO_INCREMENT,
  111. `log_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '日志记录时间',
  112. `call_api` VARCHAR(50) DEFAULT NULL COMMENT '调用API',
  113. `api_desc` TEXT DEFAULT NULL COMMENT 'API描述',
  114. `user_id` INT(11) DEFAULT NULL COMMENT '来自用户',
  115. `device` VARCHAR(20) DEFAULT NULL COMMENT '来自设备',
  116. `remote_addr` VARCHAR(20) DEFAULT NULL COMMENT '设备地址',
  117. `remote_host` VARCHAR(20) DEFAULT NULL COMMENT '设备名称',
  118. `input_params` TEXT DEFAULT NULL COMMENT '输入参数',
  119. `error` INT(11) DEFAULT NULL COMMENT '调用结果',
  120. `time_consuming` INT(11) DEFAULT NULL COMMENT '调用耗时(毫秒)',
  121. `bak` TEXT DEFAULT NULL COMMENT '备注',
  122. PRIMARY KEY (`log_id`)
  123. ) ENGINE=INNODB COMMENT='系统API调用日志表';
  124. /* ============================= */
  125. /* 业务数据 */
  126. /* ============================= */
  127. /*Table structure for table `fc_staff_device_binding` */
  128. DROP TABLE IF EXISTS `fc_staff_device_binding`;
  129. CREATE TABLE `fc_staff_device_binding` (
  130. `binding_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '绑定关系ID',
  131. `staff_no` VARCHAR(20) NOT NULL COMMENT '员工工号',
  132. `handheld_id` INT(11) NOT NULL COMMENT '手持机ID',
  133. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  134. PRIMARY KEY (`binding_id`),
  135. UNIQUE KEY `uk_staff_handset` (`staff_no`, `handheld_id`)
  136. ) ENGINE=INNODB COMMENT='职员和手持机设备的绑定关系';
  137. /*Table structure for table `fc_flow` */
  138. DROP TABLE IF EXISTS `fc_flow`;
  139. CREATE TABLE `fc_flow` (
  140. `flow_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '生产线ID',
  141. `flow_name` VARCHAR(100) NOT NULL COMMENT '生产线名称',
  142. `flow_place` VARCHAR(100) NOT NULL COMMENT '生产线地点',
  143. `master_staff_no` VARCHAR(20) NOT NULL COMMENT '负责人的员工工号',
  144. `flow_spots` INT(11) NOT NULL COMMENT '生产线工位数量',
  145. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  146. PRIMARY KEY (`flow_id`)
  147. ) ENGINE=INNODB COMMENT='生产线信息';
  148. /*Table structure for table `fc_spot` */
  149. DROP TABLE IF EXISTS `fc_spot`;
  150. CREATE TABLE `fc_spot` (
  151. `spot_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '工位ID',
  152. `flow_id` INT(11) NOT NULL COMMENT '生产线ID',
  153. `spot_name` VARCHAR(50) DEFAULT NULL COMMENT '工位名称',
  154. `order_num` INT(11) NOT NULL COMMENT '生产线内顺序',
  155. `ratio` INT(11) NOT NULL COMMENT '产能比例',
  156. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  157. PRIMARY KEY (`spot_id`)
  158. ) ENGINE=INNODB COMMENT='生产工位表';
  159. /*Table structure for table `ep_config` */
  160. DROP TABLE IF EXISTS `ep_config`;
  161. CREATE TABLE `ep_config` (
  162. `ep_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '采集机ID',
  163. `flow_id` INT(11) NOT NULL COMMENT '生产线ID',
  164. `spots` INT(11) NOT NULL COMMENT '工位数量',
  165. `extra` TEXT COMMENT '设置选项',
  166. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  167. PRIMARY KEY (`ep_id`)
  168. ) ENGINE=INNODB COMMENT='采集设置';
  169. /*Table structure for table `ep_board_spot` */
  170. DROP TABLE IF EXISTS `ep_board_spot`;
  171. CREATE TABLE `ep_board_spot` (
  172. `combine_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '对应关系编码',
  173. `ep_id` INT(11) NOT NULL COMMENT '采集机ID',
  174. `spot_id` INT(11) NOT NULL COMMENT '工位ID',
  175. `board_id` INT(11) NOT NULL COMMENT '控制板ID',
  176. `arg` INT(11) COMMENT '附加参数',
  177. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  178. PRIMARY KEY (`combine_id`),
  179. UNIQUE KEY `uk_board` (`ep_id`, `spot_id`, `board_id`)
  180. ) ENGINE=INNODB COMMENT='采集点对应';
  181. /*Table structure for table `ep_state` */
  182. DROP TABLE IF EXISTS `ep_state`;
  183. CREATE TABLE `ep_state` (
  184. `ep_id` INT(11) NOT NULL COMMENT '采集机ID',
  185. `spot_data` TEXT NOT NULL COMMENT '工位数据',
  186. `spot_worker` TEXT NOT NULL COMMENT '工人产量数据',
  187. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  188. PRIMARY KEY (`ep_id`)
  189. ) ENGINE=INNODB COMMENT='采集状态';
  190. /*Table structure for table `ep_system` */
  191. DROP TABLE IF EXISTS `ep_system`;
  192. CREATE TABLE `ep_system` (
  193. `data_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '数据ID',
  194. `ep_id` INT(11) NOT NULL COMMENT '采集机Id',
  195. `cpu` TEXT NOT NULL COMMENT 'CPU使用',
  196. `memory` TEXT NOT NULL COMMENT '内存使用',
  197. `processes` TEXT COMMENT '进程信息',
  198. `os` TEXT NOT NULL COMMENT '操作系统',
  199. `runtime` TEXT COMMENT '运行环境',
  200. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  201. PRIMARY KEY (`data_id`)
  202. ) ENGINE=INNODB COMMENT='采集机运行状态';
  203. /*Table structure for table `fc_sector` */
  204. DROP TABLE IF EXISTS `fc_sector`;
  205. CREATE TABLE `fc_sector` (
  206. `sector_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '工序ID',
  207. `sector_name` VARCHAR(200) NOT NULL COMMENT '工序名称',
  208. `flow_id` INT(11) NOT NULL COMMENT '生产线ID',
  209. `sector_order` INT(11) NOT NULL COMMENT '产线内顺序',
  210. `counter` INT(11) DEFAULT '1' COMMENT '计数方法',
  211. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  212. PRIMARY KEY (`sector_id`)
  213. ) ENGINE=INNODB COMMENT='工序定义';
  214. /*Table structure for table `fc_sector_spot` */
  215. DROP TABLE IF EXISTS `fc_sector_spot`;
  216. CREATE TABLE `fc_sector_spot` (
  217. `combine_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '关系ID',
  218. `sector_id` INT(11) NOT NULL COMMENT '工序ID',
  219. `spot_id` INT(11) NOT NULL COMMENT '工位ID',
  220. `spot_order` INT(11) NOT NULL COMMENT '工序内工位顺序',
  221. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  222. PRIMARY KEY (`combine_id`)
  223. ) ENGINE=INNODB AUTO_INCREMENT=1 COMMENT='工序内部';
  224. /*Table structure for table `fc_spot_extra` */
  225. DROP TABLE IF EXISTS `fc_spot_extra`;
  226. CREATE TABLE `fc_spot_extra` (
  227. `spot_id` INT(11) NOT NULL COMMENT '工位ID',
  228. `spot_period` INT(11) NOT NULL COMMENT '工位统计周期',
  229. `spot_threshold_failnum` INT(11) NOT NULL COMMENT '坏品数阈值',
  230. `spot_threshold_failrate` DECIMAL(10,0) NOT NULL COMMENT '坏品率阈值',
  231. `spot_threshold_min_output` INT(11) NOT NULL COMMENT '产能阈值',
  232. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  233. PRIMARY KEY (`spot_id`)
  234. ) ENGINE=INNODB COMMENT='工位统计信息';
  235. /*Table structure for table `fc_system_event` */
  236. DROP TABLE IF EXISTS `fc_system_event`;
  237. CREATE TABLE `fc_system_event` (
  238. `sysev_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '事件记录ID',
  239. `event_type` INT(11) NOT NULL COMMENT '事件类型',
  240. `event_level` INT(11) NOT NULL COMMENT '事件严重等级',
  241. `event_title` VARCHAR(300) DEFAULT NULL COMMENT '事件标题',
  242. `event_detail` VARCHAR(1000) DEFAULT NULL COMMENT '事件详情',
  243. `event_status` INT(11) NOT NULL COMMENT '事件状态',
  244. `time_point` BIGINT(20) NOT NULL COMMENT '发生时间',
  245. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  246. PRIMARY KEY (`sysev_id`)
  247. ) ENGINE=INNODB COMMENT='系统事件';
  248. /*Table structure for table `fc_work_period` */
  249. DROP TABLE IF EXISTS `fc_work_period`;
  250. CREATE TABLE `fc_work_period` (
  251. `period_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '时间段ID',
  252. `period_name` VARCHAR(100) NOT NULL COMMENT '时间段名称',
  253. `start_second` INT(11) NOT NULL COMMENT '开始时间',
  254. `end_second` INT(11) NOT NULL COMMENT '结束时间',
  255. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  256. PRIMARY KEY (`period_id`)
  257. ) ENGINE=INNODB COMMENT='工作时间段信息';
  258. /*Table structure for table `fc_work_schedule` */
  259. DROP TABLE IF EXISTS `fc_work_schedule`;
  260. CREATE TABLE `fc_work_schedule` (
  261. `schedule_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '班次ID',
  262. `work_day` DATE NOT NULL COMMENT '班次日期',
  263. `start_time` DATETIME NOT NULL COMMENT '实际开始',
  264. `end_time` DATETIME NOT NULL COMMENT '实际结束',
  265. `period_id` INT(11) NOT NULL COMMENT '工作时间段ID',
  266. `flow_id` INT(11) NOT NULL COMMENT '生产线ID',
  267. `start_uid` INT(11) NOT NULL COMMENT '上班操作人',
  268. `end_uid` INT(11) NOT NULL COMMENT '下班操作人',
  269. `status` INT(11) NOT NULL COMMENT '班次状态',
  270. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  271. PRIMARY KEY (`schedule_id`)
  272. ) ENGINE=INNODB COMMENT='班次信息';
  273. /*Table structure for table `fc_work_schedule_event` */
  274. DROP TABLE IF EXISTS `fc_work_schedule_event`;
  275. CREATE TABLE `fc_work_schedule_event` (
  276. `event_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '事件记录ID',
  277. `schedule_id` INT(11) NOT NULL COMMENT '班次ID',
  278. `evtype` INT(11) NOT NULL COMMENT '事件类型',
  279. `period_id` INT(11) NOT NULL COMMENT '时间段ID',
  280. `worker_no` VARCHAR(20) NOT NULL COMMENT '工人工号',
  281. `spot_id` INT(11) NOT NULL COMMENT '工位ID',
  282. `occurance_time` DATETIME NOT NULL COMMENT '实际发生时间',
  283. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  284. PRIMARY KEY (`event_id`)
  285. ) ENGINE=INNODB AUTO_INCREMENT=1 COMMENT='工作上下班信息';
  286. /*Table structure for table `fc_work_raw` */
  287. DROP TABLE IF EXISTS `fc_work_raw`;
  288. CREATE TABLE `fc_work_raw` (
  289. `raw_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '原始数据ID',
  290. `schedule_id` INT(11) NOT NULL DEFAULT '0' COMMENT '班次ID',
  291. `board_id` INT(11) NOT NULL COMMENT '控制板ID',
  292. `timing` BIGINT(20) NOT NULL COMMENT '时间点',
  293. `handheld_id` INT(11) NOT NULL COMMENT '手持机ID',
  294. `pass_num` INT(11) NOT NULL COMMENT '合格品数量',
  295. `total_num` INT(11) NOT NULL COMMENT '总计数量',
  296. `hand_pass` INT(11) NOT NULL COMMENT '手持合格数',
  297. `hand_total` INT(11) NOT NULL COMMENT '手持总计数',
  298. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  299. PRIMARY KEY (`raw_id`),
  300. KEY `idx_handheld_id` (`handheld_id`),
  301. KEY `idx_board_id` (`board_id`)
  302. ) ENGINE=INNODB COMMENT='原始工作量数据';
  303. /*Table structure for table `fc_bi_factory_daily` */
  304. DROP TABLE IF EXISTS `fc_bi_factory_daily`;
  305. CREATE TABLE `fc_bi_factory_daily` (
  306. `data_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '数据标识',
  307. `pass_num` INT(11) NOT NULL COMMENT '合格品数量',
  308. `fc_day` DATE NOT NULL COMMENT '记录日期',
  309. `fail_num` INT(11) NOT NULL COMMENT '坏品数量',
  310. `fail_rate` INT(11) NOT NULL COMMENT '坏品率',
  311. `avg_due` INT(11) NOT NULL COMMENT '平均堆积数',
  312. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  313. PRIMARY KEY (`data_id`)
  314. ) ENGINE=INNODB COMMENT='全厂按日统计';
  315. /*Table structure for table `fc_bi_flow_daily` */
  316. DROP TABLE IF EXISTS `fc_bi_flow_daily`;
  317. CREATE TABLE `fc_bi_flow_daily` (
  318. `data_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '统计ID',
  319. `flow_id` INT(11) NOT NULL COMMENT '生产线ID',
  320. `fc_day` DATE NOT NULL COMMENT '记录日期',
  321. `fail_num` INT(11) NOT NULL COMMENT '坏品数量',
  322. `fail_rate` INT(11) NOT NULL COMMENT '坏品率',
  323. `avg_due` INT(11) NOT NULL COMMENT '平均堆积数',
  324. `pass_num` INT(11) NOT NULL COMMENT '合格品数量',
  325. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  326. PRIMARY KEY (`data_id`)
  327. ) ENGINE=INNODB COMMENT='产线按日统计';
  328. /*Table structure for table `fc_bi_worker_daily` */
  329. DROP TABLE IF EXISTS `fc_bi_worker_daily`;
  330. CREATE TABLE `fc_bi_worker_daily` (
  331. `data_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '统计数据ID',
  332. `worker_id` INT(11) NOT NULL COMMENT '员工ID',
  333. `fc_day` DATE NOT NULL COMMENT '记录日期',
  334. `fail_num` INT(11) NOT NULL COMMENT '坏品数量',
  335. `fail_rate` INT(11) NOT NULL COMMENT '坏品率',
  336. `avg_due` INT(11) NOT NULL COMMENT '平均堆积数',
  337. `pass_num` INT(11) NOT NULL COMMENT '合格品数量',
  338. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  339. PRIMARY KEY (`data_id`)
  340. ) ENGINE=INNODB COMMENT='按日统计';
  341. /*Table structure for table `fc_work_schedule_load` */
  342. DROP TABLE IF EXISTS `fc_work_schedule_load`;
  343. CREATE TABLE `fc_work_schedule_load` (
  344. `load_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '班次产量ID',
  345. `schedule_id` INT(11) NOT NULL COMMENT '班次ID',
  346. `spot_id` INT(11) NOT NULL COMMENT '工位ID',
  347. `user_id` INT(11) NOT NULL COMMENT '员工ID',
  348. `pass_num` INT(11) NOT NULL COMMENT '合格数量',
  349. `fail_num` INT(11) NOT NULL COMMENT '坏品数量',
  350. `due` INT(11) NOT NULL COMMENT '堆积数量',
  351. `time_point` BIGINT(20) NOT NULL COMMENT '时间点',
  352. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  353. PRIMARY KEY (`load_id`)
  354. ) ENGINE=INNODB COMMENT='班次产量信息';
  355. /*Table structure for table `fc_work_schedule_outcome` */
  356. DROP TABLE IF EXISTS `fc_work_schedule_outcome`;
  357. CREATE TABLE `fc_work_schedule_outcome` (
  358. `outcome_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '产能数据ID',
  359. `schedule_id` INT(4) NOT NULL COMMENT '班次ID',
  360. `spot_id` INT(11) NOT NULL COMMENT '工位ID',
  361. `worker_id` INT(11) NOT NULL COMMENT '员工ID',
  362. `pass_num` INT(11) NOT NULL COMMENT '合格数量',
  363. `fail_num` INT(11) NOT NULL COMMENT '坏品数量',
  364. `avg_due` INT(11) NOT NULL COMMENT '平均堆积数量',
  365. `updated_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  366. PRIMARY KEY (`outcome_id`)
  367. ) ENGINE=INNODB COMMENT='产能数据结算';
  368. DROP TABLE IF EXISTS `fc_bi_board_daily`;
  369. CREATE TABLE fc_bi_board_daily(
  370. data_id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT '数据id',
  371. flow_id INT(11) NOT NULL COMMENT '产线id',
  372. board_id INT(11) NOT NULL COMMENT '板子id',
  373. fc_day DATE NOT NULL,
  374. pass_num INT(11) NOT NULL,
  375. fail_num INT(11) NOT NULL,
  376. updated_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
  377. )ENGINE=INNODB COMMENT='板子当日统计';